Merge pull request #8 from theHamsta/empty-env
fix: allow empty value for env_pair
This commit is contained in:
commit
22bdef3e27
105
corpus/vars.txt
105
corpus/vars.txt
|
@ -1,10 +1,10 @@
|
|||
==================
|
||||
================================================================================
|
||||
Add
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
ADD /$FOO ./${bar}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(add_instruction
|
||||
|
@ -15,13 +15,13 @@ ADD /$FOO ./${bar}
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Copy
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
COPY $FOO ./${bar}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(copy_instruction
|
||||
|
@ -32,13 +32,13 @@ COPY $FOO ./${bar}
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Special chars
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
COPY $FOO ./${bar:-abc}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(copy_instruction
|
||||
|
@ -49,16 +49,16 @@ COPY $FOO ./${bar:-abc}
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Env
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
ENV TEST="foo$BAR" \
|
||||
TEST_2=foo\ bar$BAZ \
|
||||
TEST_3="foo${bar}" \
|
||||
TEST_4=foo\ ${baz}bar
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(env_instruction
|
||||
|
@ -86,26 +86,58 @@ ENV TEST="foo$BAR" \
|
|||
(expansion
|
||||
(variable))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Empty Env
|
||||
================================================================================
|
||||
|
||||
ENV TEST= \
|
||||
TEST_2= \
|
||||
TEST_3="foo${bar}" \
|
||||
TEST_4=
|
||||
ENV FOO=
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string))
|
||||
(line_continuation)
|
||||
(env_pair
|
||||
(unquoted_string))
|
||||
(line_continuation)
|
||||
(env_pair
|
||||
(unquoted_string)
|
||||
(double_quoted_string
|
||||
(expansion
|
||||
(variable))))
|
||||
(line_continuation)
|
||||
(env_pair
|
||||
(unquoted_string)))
|
||||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string))))
|
||||
|
||||
================================================================================
|
||||
Expose
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
EXPOSE $FOO
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(expose_instruction
|
||||
(expansion
|
||||
(variable))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
From
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
FROM foo/$FOO:$BAR@sha256:$BAZ AS baz$QUX
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(from_instruction
|
||||
|
@ -123,13 +155,13 @@ FROM foo/$FOO:$BAR@sha256:$BAZ AS baz$QUX
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Label
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
LABEL key="value$FOO"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(label_instruction
|
||||
|
@ -139,26 +171,26 @@ LABEL key="value$FOO"
|
|||
(expansion
|
||||
(variable))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Stopsignal
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
STOPSIGNAL $FOO
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(stopsignal_instruction
|
||||
(expansion
|
||||
(variable))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
User
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
USER foo$FOO:bar${bar}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(user_instruction
|
||||
|
@ -169,14 +201,14 @@ USER foo$FOO:bar${bar}
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Volume
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
volume /my$FOO /my${bar}
|
||||
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(volume_instruction
|
||||
|
@ -187,13 +219,13 @@ volume /my$FOO /my${bar}
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Workdir
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
WORKDIR /tmp/$FOO
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(workdir_instruction
|
||||
|
@ -201,14 +233,13 @@ WORKDIR /tmp/$FOO
|
|||
(expansion
|
||||
(variable)))))
|
||||
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
Onbuild
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
ONBUILD ADD /$FOO ./${bar}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(onbuild_instruction
|
||||
|
|
|
@ -180,7 +180,7 @@ module.exports = grammar({
|
|||
seq(
|
||||
field("name", $._env_key),
|
||||
token.immediate("="),
|
||||
field("value", choice($.double_quoted_string, $.unquoted_string))
|
||||
optional(field("value", choice($.double_quoted_string, $.unquoted_string)))
|
||||
),
|
||||
|
||||
_spaced_env_pair: ($) =>
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
"nan": "^2.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tree-sitter-cli": "^0.19.4"
|
||||
"tree-sitter-cli": "^0.20.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -857,6 +857,9 @@
|
|||
"value": "="
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "value",
|
||||
|
@ -873,6 +876,11 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1045,7 +1053,23 @@
|
|||
]
|
||||
},
|
||||
"image_name": {
|
||||
"type": "REPEAT1",
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^@:\\s\\$-]"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expansion"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
|
@ -1059,6 +1083,8 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"image_tag": {
|
||||
"type": "SEQ",
|
||||
|
@ -1235,8 +1261,13 @@
|
|||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "line_continuation"
|
||||
"name": "required_line_continuation"
|
||||
},
|
||||
"named": true,
|
||||
"value": "line_continuation"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
|
@ -1274,6 +1305,10 @@
|
|||
"type": "STRING",
|
||||
"value": "\\\n"
|
||||
},
|
||||
"required_line_continuation": {
|
||||
"type": "STRING",
|
||||
"value": "\\\n"
|
||||
},
|
||||
"_comment_line": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
},
|
||||
"value": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "double_quoted_string",
|
||||
|
@ -408,6 +408,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "line_continuation",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "maintainer_instruction",
|
||||
"named": true,
|
||||
|
@ -910,6 +915,10 @@
|
|||
"type": "[",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "\\\n",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "\\ ",
|
||||
"named": false
|
||||
|
@ -922,10 +931,6 @@
|
|||
"type": "escape_sequence",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_continuation",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "variable",
|
||||
"named": true
|
||||
|
|
7226
src/parser.c
7226
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue