fix: else and endif arguments
This commit is contained in:
parent
13c7c529d7
commit
3d23db47a5
|
@ -106,3 +106,42 @@ endif()
|
|||
(endif_command (endif))
|
||||
)
|
||||
)
|
||||
|
||||
==============================================
|
||||
Condition with not and parentheses [condition]
|
||||
==============================================
|
||||
if(NOT (A AND B) OR C)
|
||||
else(NOT (A AND B) OR C)
|
||||
endif(NOT (A AND B) OR C)
|
||||
---
|
||||
(source_file
|
||||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
(else_command
|
||||
(else)
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
(endif_command
|
||||
(endif)
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -50,8 +50,8 @@ module.exports = grammar({
|
|||
|
||||
if_command: ($) => command($.if, repeat($._untrimmed_argument)),
|
||||
elseif_command: ($) => command($.elseif, repeat($._untrimmed_argument)),
|
||||
else_command: ($) => command($.else, optional(seq(/\s*/, $.argument, /\s*/))),
|
||||
endif_command: ($) => command($.endif, optional(seq(/\s*/, $.argument, /\s*/))),
|
||||
else_command: ($) => command($.else, repeat($._untrimmed_argument)),
|
||||
endif_command: ($) => command($.endif, repeat($._untrimmed_argument)),
|
||||
if_condition: ($) =>
|
||||
seq(
|
||||
$.if_command,
|
||||
|
|
|
@ -505,29 +505,11 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s*"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "argument"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -554,29 +536,11 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s*"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "argument"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
|
|
@ -49,9 +49,17 @@
|
|||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "else",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -141,9 +149,17 @@
|
|||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "endif",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
22450
src/parser.c
22450
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue