Hide command_invocation
This commit is contained in:
parent
a4960577dd
commit
9e0798cc16
|
@ -6,7 +6,6 @@ message([[]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -14,17 +13,15 @@ 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
|
||||||
|
@ -32,17 +29,15 @@ 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
|
||||||
|
@ -52,20 +47,18 @@ message([[First argument]] [[Second argument]])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
========================================================
|
========================================================
|
||||||
Two bracket with two equals arguments [bracket_argument]
|
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))
|
(seperation (space))
|
||||||
|
@ -77,19 +70,17 @@ 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
|
||||||
|
@ -97,5 +88,4 @@ with line break
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,14 @@ endforeach()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(foreach_command
|
(foreach_command
|
||||||
(foreach)
|
(foreach)
|
||||||
(variable)
|
(variable)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
(endforeach_command
|
||||||
(endforeach)
|
(endforeach)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=========================================================
|
=========================================================
|
||||||
Empty foreach loop with one argument endforeach [foreach]
|
Empty foreach loop with one argument endforeach [foreach]
|
||||||
|
@ -31,18 +27,14 @@ 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)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
(endforeach_command
|
||||||
(endforeach)
|
(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)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(command_invocation
|
|
||||||
(endforeach_command
|
(endforeach_command
|
||||||
(endforeach)
|
(endforeach)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
|
@ -7,12 +7,10 @@ message()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=============================================================
|
=============================================================
|
||||||
Command invocation without argument with spaces [no_argument]
|
Command invocation without argument with spaces [no_argument]
|
||||||
|
@ -23,13 +21,11 @@ message( )
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
==============================================================
|
==============================================================
|
||||||
Command invocation without argument with newline [no_argument]
|
Command invocation without argument with newline [no_argument]
|
||||||
|
@ -42,7 +38,6 @@ message(
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation
|
(seperation
|
||||||
|
@ -50,5 +45,4 @@ message(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ message("")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -14,7 +13,6 @@ message("")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
One quoted argument [quoted_argument]
|
One quoted argument [quoted_argument]
|
||||||
|
@ -24,7 +22,6 @@ message("An argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -32,7 +29,6 @@ message("An argument")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
======================================
|
======================================
|
||||||
Two quoted arguments [quoted_argument]
|
Two quoted arguments [quoted_argument]
|
||||||
|
@ -42,7 +38,6 @@ message("First argument" "Second argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -52,7 +47,6 @@ message("First argument" "Second argument")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
===================================================
|
===================================================
|
||||||
A quoted argument with line break [quoted_argument]
|
A quoted argument with line break [quoted_argument]
|
||||||
|
@ -63,7 +57,6 @@ with line break")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -71,7 +64,6 @@ with line break")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
========================================
|
========================================
|
||||||
One variable reference [quoted_argument]
|
One variable reference [quoted_argument]
|
||||||
|
@ -81,7 +73,6 @@ message("${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -95,7 +86,6 @@ message("${var}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=========================================
|
=========================================
|
||||||
Two Variable references [quoted_argument]
|
Two Variable references [quoted_argument]
|
||||||
|
@ -105,7 +95,6 @@ message("${var} ${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -120,4 +109,3 @@ message("${var} ${var}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ message(STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -15,7 +14,6 @@ message(STATUS)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
=========================================================
|
=========================================================
|
||||||
Command invocation with two arguments [unquoted_argument]
|
Command invocation with two arguments [unquoted_argument]
|
||||||
|
@ -26,7 +24,6 @@ message(STATUS Hello)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -36,7 +33,6 @@ message(STATUS Hello)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
===============================================================
|
===============================================================
|
||||||
Command invocations with leading seperation [unquoted_argument]
|
Command invocations with leading seperation [unquoted_argument]
|
||||||
|
@ -48,7 +44,6 @@ STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
|
@ -56,8 +51,6 @@ STATUS)
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (line_ending (newline)))
|
(seperation (line_ending (newline)))
|
||||||
|
@ -66,18 +59,16 @@ 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))
|
||||||
|
@ -85,8 +76,6 @@ STATUS)
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (line_ending (newline)))
|
(seperation (line_ending (newline)))
|
||||||
|
@ -95,7 +84,6 @@ STATUS)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
========================================
|
========================================
|
||||||
Variable referencing [unquoted_argument]
|
Variable referencing [unquoted_argument]
|
||||||
|
@ -104,7 +92,6 @@ message(${var_ref})
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -116,5 +103,4 @@ message(${var_ref})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
|
@ -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,6 +13,11 @@
|
||||||
"name": "newline"
|
"name": "newline"
|
||||||
},
|
},
|
||||||
"seperation": {
|
"seperation": {
|
||||||
|
"type": "PREC_LEFT",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "REPEAT1",
|
||||||
|
"content": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
|
@ -24,14 +29,16 @@
|
||||||
"name": "line_ending"
|
"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