Merge pull request #23 from marciomazza/variables-can-start-or-end-with-underscores
Allow variables to begin or end with underscores
This commit is contained in:
commit
e808beaf1f
|
@ -40,6 +40,23 @@ ENV X=42
|
||||||
(unquoted_string)
|
(unquoted_string)
|
||||||
(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
|
Multiple
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -86,6 +86,24 @@ ENV TEST="foo$BAR" \
|
||||||
(expansion
|
(expansion
|
||||||
(variable))))))
|
(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
|
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: ($) =>
|
env_pair: ($) =>
|
||||||
seq(
|
seq(
|
||||||
|
@ -228,7 +228,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
_env_key: ($) =>
|
_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"))),
|
expose_port: ($) => seq(/\d+/, optional(choice("/tcp", "/udp"))),
|
||||||
|
|
||||||
|
|
|
@ -949,7 +949,7 @@
|
||||||
"type": "IMMEDIATE_TOKEN",
|
"type": "IMMEDIATE_TOKEN",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[a-zA-Z][a-zA-Z0-9_]*"
|
"value": "[a-zA-Z_][a-zA-Z0-9_]*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"env_pair": {
|
"env_pair": {
|
||||||
|
@ -1038,7 +1038,7 @@
|
||||||
"type": "ALIAS",
|
"type": "ALIAS",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?"
|
"value": "[a-zA-Z_][a-zA-Z0-9_]*"
|
||||||
},
|
},
|
||||||
"named": true,
|
"named": true,
|
||||||
"value": "unquoted_string"
|
"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