remove unnecessary _non_newline_whitespace
This commit is contained in:
parent
63b21914a5
commit
23ca71644d
41
grammar.js
41
grammar.js
|
@ -32,7 +32,6 @@ module.exports = grammar({
|
||||||
from_instruction: ($) =>
|
from_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[fF][rR][oO][mM]/, "FROM"),
|
alias(/[fF][rR][oO][mM]/, "FROM"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
optional($.param),
|
optional($.param),
|
||||||
$.image_spec,
|
$.image_spec,
|
||||||
optional(seq(alias(/[aA][sS]/, "AS"), field("as", $.image_alias)))
|
optional(seq(alias(/[aA][sS]/, "AS"), field("as", $.image_alias)))
|
||||||
|
@ -41,21 +40,18 @@ module.exports = grammar({
|
||||||
run_instruction: ($) =>
|
run_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[rR][uU][nN]/, "RUN"),
|
alias(/[rR][uU][nN]/, "RUN"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice($.string_array, $.shell_command)
|
choice($.string_array, $.shell_command)
|
||||||
),
|
),
|
||||||
|
|
||||||
cmd_instruction: ($) =>
|
cmd_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[cC][mM][dD]/, "CMD"),
|
alias(/[cC][mM][dD]/, "CMD"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice($.string_array, $.shell_command)
|
choice($.string_array, $.shell_command)
|
||||||
),
|
),
|
||||||
|
|
||||||
label_instruction: ($) =>
|
label_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[lL][aA][bB][eE][lL]/, "LABEL"),
|
alias(/[lL][aA][bB][eE][lL]/, "LABEL"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
repeat1($.label_pair)
|
repeat1($.label_pair)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -68,14 +64,12 @@ module.exports = grammar({
|
||||||
env_instruction: ($) =>
|
env_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[eE][nN][vV]/, "ENV"),
|
alias(/[eE][nN][vV]/, "ENV"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice(repeat1($.env_pair), alias($._spaced_env_pair, $.env_pair))
|
choice(repeat1($.env_pair), alias($._spaced_env_pair, $.env_pair))
|
||||||
),
|
),
|
||||||
|
|
||||||
add_instruction: ($) =>
|
add_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[aA][dD][dD]/, "ADD"),
|
alias(/[aA][dD][dD]/, "ADD"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
optional($.param),
|
optional($.param),
|
||||||
$.path,
|
$.path,
|
||||||
$._non_newline_whitespace,
|
$._non_newline_whitespace,
|
||||||
|
@ -85,7 +79,6 @@ module.exports = grammar({
|
||||||
copy_instruction: ($) =>
|
copy_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[cC][oO][pP][yY]/, "COPY"),
|
alias(/[cC][oO][pP][yY]/, "COPY"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
optional($.param),
|
optional($.param),
|
||||||
$.path,
|
$.path,
|
||||||
$._non_newline_whitespace,
|
$._non_newline_whitespace,
|
||||||
|
@ -95,14 +88,12 @@ module.exports = grammar({
|
||||||
entrypoint_instruction: ($) =>
|
entrypoint_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[eE][nN][tT][rR][yY][pP][oO][iI][nN][tT]/, "ENTRYPOINT"),
|
alias(/[eE][nN][tT][rR][yY][pP][oO][iI][nN][tT]/, "ENTRYPOINT"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice($.string_array, $.shell_command)
|
choice($.string_array, $.shell_command)
|
||||||
),
|
),
|
||||||
|
|
||||||
volume_instruction: ($) =>
|
volume_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[vV][oO][lL][uU][mM][eE]/, "VOLUME"),
|
alias(/[vV][oO][lL][uU][mM][eE]/, "VOLUME"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice(
|
choice(
|
||||||
$.string_array,
|
$.string_array,
|
||||||
seq($.path, repeat(seq($._non_newline_whitespace, $.path)))
|
seq($.path, repeat(seq($._non_newline_whitespace, $.path)))
|
||||||
|
@ -112,30 +103,24 @@ module.exports = grammar({
|
||||||
user_instruction: ($) =>
|
user_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[uU][sS][eE][rR]/, "USER"),
|
alias(/[uU][sS][eE][rR]/, "USER"),
|
||||||
$._non_newline_whitespace,
|
field("user", alias($._user_name_or_group, $.unquoted_string)),
|
||||||
field("user", alias($._user_name_group, $.unquoted_string)),
|
|
||||||
optional(
|
optional(
|
||||||
seq(
|
seq(
|
||||||
token.immediate(":"),
|
token.immediate(":"),
|
||||||
field("group", alias($._user_name_group, $.unquoted_string))
|
field("group", alias($._user_name_or_group, $.unquoted_string))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
_user_name_group: ($) =>
|
_user_name_or_group: ($) =>
|
||||||
repeat1(choice(token.immediate(/[a-z][-a-z0-9_]*/), $.expansion)),
|
repeat1(choice(/[a-z][-a-z0-9_]*/, $.expansion)),
|
||||||
|
|
||||||
workdir_instruction: ($) =>
|
workdir_instruction: ($) =>
|
||||||
seq(
|
seq(alias(/[wW][oO][rR][kK][dD][iI][rR]/, "WORKDIR"), $.path),
|
||||||
alias(/[wW][oO][rR][kK][dD][iI][rR]/, "WORKDIR"),
|
|
||||||
$._non_newline_whitespace,
|
|
||||||
$.path
|
|
||||||
),
|
|
||||||
|
|
||||||
arg_instruction: ($) =>
|
arg_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[aA][rR][gG]/, "ARG"),
|
alias(/[aA][rR][gG]/, "ARG"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
field("name", alias(/[a-zA-Z0-9_]+/, $.unquoted_string)),
|
field("name", alias(/[a-zA-Z0-9_]+/, $.unquoted_string)),
|
||||||
optional(
|
optional(
|
||||||
seq(
|
seq(
|
||||||
|
@ -146,16 +131,11 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
onbuild_instruction: ($) =>
|
onbuild_instruction: ($) =>
|
||||||
seq(
|
seq(alias(/[oO][nN][bB][uU][iI][lL][dD]/, "ONBUILD"), $._instruction),
|
||||||
alias(/[oO][nN][bB][uU][iI][lL][dD]/, "ONBUILD"),
|
|
||||||
$._non_newline_whitespace,
|
|
||||||
$._instruction
|
|
||||||
),
|
|
||||||
|
|
||||||
stopsignal_instruction: ($) =>
|
stopsignal_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[sS][tT][oO][pP][sS][iI][gG][nN][aA][lL]/, "STOPSIGNAL"),
|
alias(/[sS][tT][oO][pP][sS][iI][gG][nN][aA][lL]/, "STOPSIGNAL"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
$._stopsignal_value
|
$._stopsignal_value
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -164,16 +144,11 @@ module.exports = grammar({
|
||||||
healthcheck_instruction: ($) =>
|
healthcheck_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
alias(/[hH][eE][aA][lL][tT][hH][cC][hH][eE][cC][kK]/, "HEALTHCHECK"),
|
alias(/[hH][eE][aA][lL][tT][hH][cC][hH][eE][cC][kK]/, "HEALTHCHECK"),
|
||||||
$._non_newline_whitespace,
|
|
||||||
choice("NONE", seq(repeat($.param), $.cmd_instruction))
|
choice("NONE", seq(repeat($.param), $.cmd_instruction))
|
||||||
),
|
),
|
||||||
|
|
||||||
shell_instruction: ($) =>
|
shell_instruction: ($) =>
|
||||||
seq(
|
seq(alias(/[sS][hH][eE][lL][lL]/, "SHELL"), $.string_array),
|
||||||
alias(/[sS][hH][eE][lL][lL]/, "SHELL"),
|
|
||||||
$._non_newline_whitespace,
|
|
||||||
$.string_array
|
|
||||||
),
|
|
||||||
|
|
||||||
maintainer_instruction: ($) =>
|
maintainer_instruction: ($) =>
|
||||||
seq(
|
seq(
|
||||||
|
@ -240,7 +215,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
image_name: ($) =>
|
image_name: ($) =>
|
||||||
repeat1(choice(token.immediate(/[^@:\s\$]+/), $.expansion)),
|
repeat1(choice(/[^@:\s\$]+/, $.expansion)),
|
||||||
|
|
||||||
image_tag: ($) =>
|
image_tag: ($) =>
|
||||||
seq(
|
seq(
|
||||||
|
|
|
@ -119,10 +119,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "FROM"
|
"value": "FROM"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -183,10 +179,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "RUN"
|
"value": "RUN"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -214,10 +206,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "CMD"
|
"value": "CMD"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -245,10 +233,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "LABEL"
|
"value": "LABEL"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "REPEAT1",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -300,10 +284,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "ENV"
|
"value": "ENV"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -339,10 +319,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "ADD"
|
"value": "ADD"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -381,10 +357,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "COPY"
|
"value": "COPY"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -423,10 +395,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "ENTRYPOINT"
|
"value": "ENTRYPOINT"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -454,10 +422,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "VOLUME"
|
"value": "VOLUME"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -506,10 +470,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "USER"
|
"value": "USER"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "user",
|
"name": "user",
|
||||||
|
@ -517,7 +477,7 @@
|
||||||
"type": "ALIAS",
|
"type": "ALIAS",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_user_name_group"
|
"name": "_user_name_or_group"
|
||||||
},
|
},
|
||||||
"named": true,
|
"named": true,
|
||||||
"value": "unquoted_string"
|
"value": "unquoted_string"
|
||||||
|
@ -543,7 +503,7 @@
|
||||||
"type": "ALIAS",
|
"type": "ALIAS",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_user_name_group"
|
"name": "_user_name_or_group"
|
||||||
},
|
},
|
||||||
"named": true,
|
"named": true,
|
||||||
"value": "unquoted_string"
|
"value": "unquoted_string"
|
||||||
|
@ -558,17 +518,14 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"_user_name_group": {
|
"_user_name_or_group": {
|
||||||
"type": "REPEAT1",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "IMMEDIATE_TOKEN",
|
"type": "PATTERN",
|
||||||
"content": {
|
"value": "[a-z][-a-z0-9_]*"
|
||||||
"type": "PATTERN",
|
|
||||||
"value": "[a-z][-a-z0-9_]*"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
@ -589,10 +546,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "WORKDIR"
|
"value": "WORKDIR"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "path"
|
"name": "path"
|
||||||
|
@ -611,10 +564,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "ARG"
|
"value": "ARG"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "name",
|
"name": "name",
|
||||||
|
@ -679,10 +628,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "ONBUILD"
|
"value": "ONBUILD"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_instruction"
|
"name": "_instruction"
|
||||||
|
@ -701,10 +646,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "STOPSIGNAL"
|
"value": "STOPSIGNAL"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_stopsignal_value"
|
"name": "_stopsignal_value"
|
||||||
|
@ -739,10 +680,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "HEALTHCHECK"
|
"value": "HEALTHCHECK"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -782,10 +719,6 @@
|
||||||
"named": false,
|
"named": false,
|
||||||
"value": "SHELL"
|
"value": "SHELL"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_non_newline_whitespace"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "string_array"
|
"name": "string_array"
|
||||||
|
@ -1117,11 +1050,8 @@
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "IMMEDIATE_TOKEN",
|
"type": "PATTERN",
|
||||||
"content": {
|
"value": "[^@:\\s\\$]+"
|
||||||
"type": "PATTERN",
|
|
||||||
"value": "[^@:\\s\\$]+"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
|
5937
src/parser.c
5937
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue