Hide command_invocation
This commit is contained in:
parent
a4960577dd
commit
9e0798cc16
|
@ -6,12 +6,10 @@ message([[]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (bracket_argument))
|
||||||
(argument (bracket_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -20,16 +18,14 @@ message([[]])
|
||||||
One bracket argument [bracket_argument]
|
One bracket argument [bracket_argument]
|
||||||
=======================================
|
=======================================
|
||||||
|
|
||||||
message([[An argument]])
|
message([[an argument]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -38,18 +34,16 @@ message([[An argument]])
|
||||||
Two bracket arguments [bracket_argument]
|
Two bracket arguments [bracket_argument]
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
message([[First argument]] [[Second argument]])
|
message([[first argument]] [[second argument]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
(seperation (space))
|
||||||
(seperation (space))
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -59,22 +53,20 @@ Two bracket with two equals arguments [bracket_argument]
|
||||||
========================================================
|
========================================================
|
||||||
|
|
||||||
message(
|
message(
|
||||||
[====[First argument]====]
|
[====[first argument]====]
|
||||||
[====[Second argument]====]
|
[====[second argument]====]
|
||||||
)
|
)
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (space))
|
||||||
|
(arguments
|
||||||
|
(argument (bracket_argument (bracket_content)))
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
(arguments
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
(seperation (line_ending (newline)))
|
||||||
(seperation (space))
|
|
||||||
(argument (bracket_argument (bracket_content)))
|
|
||||||
(seperation (line_ending (newline)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -83,18 +75,16 @@ message(
|
||||||
Bracket argument with line break [bracket_argument]
|
Bracket argument with line break [bracket_argument]
|
||||||
===================================================
|
===================================================
|
||||||
|
|
||||||
message([[An argument
|
message([[an argument
|
||||||
with line break
|
with line break
|
||||||
]])
|
]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,18 +8,14 @@ endforeach()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(foreach_command
|
||||||
(foreach_command
|
(foreach)
|
||||||
(foreach)
|
(variable)
|
||||||
(variable)
|
)
|
||||||
)
|
(endforeach_command
|
||||||
|
(endforeach)
|
||||||
)
|
)
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
|
||||||
(endforeach)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=========================================================
|
=========================================================
|
||||||
Empty foreach loop with one argument endforeach [foreach]
|
Empty foreach loop with one argument endforeach [foreach]
|
||||||
|
@ -31,17 +27,13 @@ endforeach(var)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(foreach_command
|
||||||
(foreach_command
|
(foreach)
|
||||||
(foreach)
|
(variable)
|
||||||
(variable)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
(command_invocation
|
(endforeach_command
|
||||||
(endforeach_command
|
(endforeach)
|
||||||
(endforeach)
|
(variable)
|
||||||
(variable)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -55,18 +47,14 @@ ENDFOREACH()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(foreach_command
|
||||||
(foreach_command
|
(foreach)
|
||||||
(foreach)
|
(variable)
|
||||||
(variable)
|
)
|
||||||
)
|
(endforeach_command
|
||||||
|
(endforeach)
|
||||||
)
|
)
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
|
||||||
(endforeach)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
============================
|
============================
|
||||||
Mixed case foreach [foreach]
|
Mixed case foreach [foreach]
|
||||||
|
@ -78,15 +66,11 @@ endForEach()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(foreach_command
|
||||||
(foreach_command
|
(foreach)
|
||||||
(foreach)
|
(variable)
|
||||||
(variable)
|
)
|
||||||
)
|
(endforeach_command
|
||||||
|
(endforeach)
|
||||||
)
|
)
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
|
||||||
(endforeach)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
|
@ -7,10 +7,8 @@ message()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,11 +21,9 @@ message( )
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (space))
|
||||||
(seperation (space))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -42,12 +38,10 @@ message(
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation
|
||||||
(seperation
|
(line_ending (newline))
|
||||||
(line_ending (newline))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,12 +6,10 @@ message("")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (quoted_argument))
|
||||||
(argument (quoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -24,12 +22,10 @@ message("An argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (quoted_argument (quoted_element)))
|
||||||
(argument (quoted_argument (quoted_element)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -42,14 +38,12 @@ message("First argument" "Second argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (quoted_argument (quoted_element)))
|
||||||
(argument (quoted_argument (quoted_element)))
|
(seperation (space))
|
||||||
(seperation (space))
|
(argument (quoted_argument (quoted_element)))
|
||||||
(argument (quoted_argument (quoted_element)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -63,12 +57,10 @@ with line break")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (quoted_argument (quoted_element)))
|
||||||
(argument (quoted_argument (quoted_element)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -81,15 +73,13 @@ message("${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument
|
||||||
(argument
|
(quoted_argument
|
||||||
(quoted_argument
|
(quoted_element
|
||||||
(quoted_element
|
(variable_ref (normal_var (variable)))
|
||||||
(variable_ref (normal_var (variable)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -105,16 +95,14 @@ message("${var} ${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument
|
||||||
(argument
|
(quoted_argument
|
||||||
(quoted_argument
|
(quoted_element
|
||||||
(quoted_element
|
(variable_ref (normal_var (variable)))
|
||||||
(variable_ref (normal_var (variable)))
|
(variable_ref (normal_var (variable)))
|
||||||
(variable_ref (normal_var (variable)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,12 +7,10 @@ message(STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -26,14 +24,12 @@ message(STATUS Hello)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
(seperation (space))
|
||||||
(seperation (space))
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -48,22 +44,18 @@ STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (space))
|
||||||
(seperation (space))
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (line_ending (newline)))
|
||||||
(seperation (line_ending (newline)))
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -71,28 +63,24 @@ STATUS)
|
||||||
Command invocations with escape sequence [unquoted_argument]
|
Command invocations with escape sequence [unquoted_argument]
|
||||||
============================================================
|
============================================================
|
||||||
|
|
||||||
message( STATUS)
|
message( STATUS)
|
||||||
message(
|
message(
|
||||||
STATUS)
|
STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (space))
|
||||||
(seperation (space))
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(seperation (line_ending (newline)))
|
||||||
(seperation (line_ending (newline)))
|
(arguments
|
||||||
(arguments
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -104,14 +92,12 @@ message(${var_ref})
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(normal_command
|
||||||
(normal_command
|
(identifier)
|
||||||
(identifier)
|
(arguments
|
||||||
(arguments
|
(argument
|
||||||
(argument
|
(unquoted_argument
|
||||||
(unquoted_argument
|
(variable_ref (normal_var (variable)))
|
||||||
(variable_ref (normal_var (variable)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ module.exports = grammar({
|
||||||
name: "cmake",
|
name: "cmake",
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
source_file: ($) => repeat($.command_invocation),
|
source_file: ($) => repeat($._command_invocation),
|
||||||
|
|
||||||
line_ending: ($) => $.newline,
|
line_ending: ($) => $.newline,
|
||||||
seperation: ($) => choice($.space, $.line_ending),
|
seperation: ($) => choice($.space, $.line_ending),
|
||||||
|
@ -46,7 +46,7 @@ module.exports = grammar({
|
||||||
normal_command: ($) =>
|
normal_command: ($) =>
|
||||||
seq($.identifier, "(", repeat($.seperation), optional($.arguments), ")"),
|
seq($.identifier, "(", repeat($.seperation), optional($.arguments), ")"),
|
||||||
|
|
||||||
command_invocation: ($) => choice($.normal_command, $.foreach_command, $.endforeach_command),
|
_command_invocation: ($) => choice($.normal_command, $.foreach_command, $.endforeach_command),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"type": "REPEAT",
|
"type": "REPEAT",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "command_invocation"
|
"name": "_command_invocation"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"line_ending": {
|
"line_ending": {
|
||||||
|
@ -13,25 +13,32 @@
|
||||||
"name": "newline"
|
"name": "newline"
|
||||||
},
|
},
|
||||||
"seperation": {
|
"seperation": {
|
||||||
"type": "CHOICE",
|
"type": "PREC_LEFT",
|
||||||
"members": [
|
"value": 0,
|
||||||
{
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "REPEAT1",
|
||||||
"name": "space"
|
"content": {
|
||||||
},
|
"type": "CHOICE",
|
||||||
{
|
"members": [
|
||||||
"type": "SYMBOL",
|
{
|
||||||
"name": "line_ending"
|
"type": "SYMBOL",
|
||||||
|
"name": "space"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "line_ending"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
"space": {
|
"space": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[ \\t]+"
|
"value": "[ \\t]"
|
||||||
},
|
},
|
||||||
"newline": {
|
"newline": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "\\n+"
|
"value": "\\n"
|
||||||
},
|
},
|
||||||
"foreach": {
|
"foreach": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
|
@ -490,7 +497,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"command_invocation": {
|
"_command_invocation": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,29 +76,6 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "command_invocation",
|
|
||||||
"named": true,
|
|
||||||
"fields": {},
|
|
||||||
"children": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "endforeach_command",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "foreach_command",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "normal_command",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "endforeach_command",
|
"type": "endforeach_command",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
@ -261,7 +238,7 @@
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": false,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
|
@ -284,7 +261,15 @@
|
||||||
"required": false,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "command_invocation",
|
"type": "endforeach_command",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "foreach_command",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "normal_command",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
2150
src/parser.c
2150
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue