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