Allow variables to begin or end with underscores
This commit is contained in:
parent
25c71d6a24
commit
4e512c60ef
|
@ -40,6 +40,23 @@ ENV X=42
|
|||
(unquoted_string)
|
||||
(unquoted_string))))
|
||||
|
||||
================================================================================
|
||||
keys can begin or end with underscores
|
||||
================================================================================
|
||||
|
||||
ENV _TEST="foo" TEST__=bar
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(env_instruction
|
||||
(env_pair
|
||||
name: (unquoted_string)
|
||||
value: (double_quoted_string))
|
||||
(env_pair
|
||||
name: (unquoted_string)
|
||||
value: (unquoted_string))))
|
||||
|
||||
================================================================================
|
||||
Multiple
|
||||
================================================================================
|
||||
|
|
|
@ -86,6 +86,24 @@ ENV TEST="foo$BAR" \
|
|||
(expansion
|
||||
(variable))))))
|
||||
|
||||
================================================================================
|
||||
Variables can begin or end with underscores
|
||||
================================================================================
|
||||
|
||||
ENV TEST="$_foo${bar_}"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string)
|
||||
(double_quoted_string
|
||||
(expansion
|
||||
(variable))
|
||||
(expansion
|
||||
(variable))))))
|
||||
|
||||
================================================================================
|
||||
Empty Env
|
||||
================================================================================
|
||||
|
|
|
@ -209,7 +209,7 @@ module.exports = grammar({
|
|||
)
|
||||
),
|
||||
|
||||
variable: ($) => token.immediate(/[a-zA-Z][a-zA-Z0-9_]*/),
|
||||
variable: ($) => token.immediate(/[a-zA-Z_][a-zA-Z0-9_]*/),
|
||||
|
||||
env_pair: ($) =>
|
||||
seq(
|
||||
|
@ -228,7 +228,7 @@ module.exports = grammar({
|
|||
),
|
||||
|
||||
_env_key: ($) =>
|
||||
alias(/[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?/, $.unquoted_string),
|
||||
alias(/[a-zA-Z_][a-zA-Z0-9_]*/, $.unquoted_string),
|
||||
|
||||
expose_port: ($) => seq(/\d+/, optional(choice("/tcp", "/udp"))),
|
||||
|
||||
|
|
|
@ -949,7 +949,7 @@
|
|||
"type": "IMMEDIATE_TOKEN",
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[a-zA-Z][a-zA-Z0-9_]*"
|
||||
"value": "[a-zA-Z_][a-zA-Z0-9_]*"
|
||||
}
|
||||
},
|
||||
"env_pair": {
|
||||
|
@ -1038,7 +1038,7 @@
|
|||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?"
|
||||
"value": "[a-zA-Z_][a-zA-Z0-9_]*"
|
||||
},
|
||||
"named": true,
|
||||
"value": "unquoted_string"
|
||||
|
|
1524
src/parser.c
1524
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue