Update tests for differentiating commands
This commit is contained in:
parent
6973cc46d2
commit
387faac594
|
@ -6,13 +6,15 @@ message([[]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (bracket_argument))
|
(arguments
|
||||||
)
|
(argument (bracket_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
One empty bracket argument
|
One empty bracket argument
|
||||||
|
@ -22,13 +24,15 @@ message([[An argument]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (bracket_argument (bracket_content)))
|
(arguments
|
||||||
)
|
(argument (bracket_argument (bracket_content)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
One bracket argument
|
One bracket argument
|
||||||
|
@ -38,13 +42,15 @@ message([[An argument]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (bracket_argument (bracket_content)))
|
(arguments
|
||||||
)
|
(argument (bracket_argument (bracket_content)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================
|
=====================
|
||||||
Two bracket arguments
|
Two bracket arguments
|
||||||
|
@ -54,15 +60,17 @@ message([[First argument]] [[Second argument]])
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (bracket_argument (bracket_content)))
|
(arguments
|
||||||
(seperation (space))
|
(argument (bracket_argument (bracket_content)))
|
||||||
(argument (bracket_argument (bracket_content)))
|
(seperation (space))
|
||||||
)
|
(argument (bracket_argument (bracket_content)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Two bracket with two equals arguments
|
Two bracket with two equals arguments
|
||||||
|
@ -75,17 +83,19 @@ message(
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
|
(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)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
================================
|
================================
|
||||||
Bracket argument with line break
|
Bracket argument with line break
|
||||||
|
@ -97,11 +107,13 @@ with line break
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (bracket_argument (bracket_content)))
|
(arguments
|
||||||
)
|
(argument (bracket_argument (bracket_content)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,12 @@ message()
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)))
|
(normal_command
|
||||||
|
(identifier)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
===============================================
|
===============================================
|
||||||
Command invocation without argument with spaces
|
Command invocation without argument with spaces
|
||||||
|
@ -19,11 +23,13 @@ message( )
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(seperation (space))
|
(identifier)
|
||||||
|
(seperation (space))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
================================================
|
================================================
|
||||||
Command invocation without argument with newline
|
Command invocation without argument with newline
|
||||||
|
@ -36,11 +42,13 @@ message(
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(seperation
|
(identifier)
|
||||||
(line_ending (newline))
|
(seperation
|
||||||
)
|
(line_ending (newline))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,15 @@ message("")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (quoted_argument))
|
(arguments
|
||||||
)
|
(argument (quoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
===================
|
===================
|
||||||
One quoted argument
|
One quoted argument
|
||||||
|
@ -22,13 +24,15 @@ message("An argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (quoted_argument (quoted_element)))
|
(arguments
|
||||||
)
|
(argument (quoted_argument (quoted_element)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
Two quoted arguments
|
Two quoted arguments
|
||||||
|
@ -38,15 +42,17 @@ message("First argument" "Second argument")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (quoted_argument (quoted_element)))
|
(arguments
|
||||||
(seperation (space))
|
(argument (quoted_argument (quoted_element)))
|
||||||
(argument (quoted_argument (quoted_element)))
|
(seperation (space))
|
||||||
)
|
(argument (quoted_argument (quoted_element)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=================================
|
=================================
|
||||||
A quoted argument with line break
|
A quoted argument with line break
|
||||||
|
@ -57,13 +63,15 @@ with line break")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (quoted_argument (quoted_element)))
|
(arguments
|
||||||
)
|
(argument (quoted_argument (quoted_element)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
======================
|
======================
|
||||||
One variable reference
|
One variable reference
|
||||||
|
@ -73,19 +81,21 @@ message("${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument
|
(arguments
|
||||||
(quoted_argument
|
(argument
|
||||||
(quoted_element
|
(quoted_argument
|
||||||
(variable_ref (normal_var (variable)))
|
(quoted_element
|
||||||
)
|
(variable_ref (normal_var (variable)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=======================
|
=======================
|
||||||
Two Variable references
|
Two Variable references
|
||||||
|
@ -95,17 +105,19 @@ message("${var} ${var}")
|
||||||
|
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument
|
(arguments
|
||||||
(quoted_argument
|
(argument
|
||||||
(quoted_element
|
(quoted_argument
|
||||||
(variable_ref (normal_var (variable)))
|
(quoted_element
|
||||||
(variable_ref (normal_var (variable)))
|
(variable_ref (normal_var (variable)))
|
||||||
)
|
(variable_ref (normal_var (variable)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -7,13 +7,15 @@ message(STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (unquoted_argument))
|
(arguments
|
||||||
)
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Command invocation with two arguments
|
Command invocation with two arguments
|
||||||
|
@ -24,15 +26,17 @@ message(STATUS Hello)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (unquoted_argument))
|
(arguments
|
||||||
(seperation (space))
|
(argument (unquoted_argument))
|
||||||
(argument (unquoted_argument))
|
(seperation (space))
|
||||||
)
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
===========================================
|
===========================================
|
||||||
Command invocations with leading seperation
|
Command invocations with leading seperation
|
||||||
|
@ -44,21 +48,25 @@ STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(seperation (space))
|
(identifier)
|
||||||
(arguments
|
(seperation (space))
|
||||||
(argument (unquoted_argument))
|
(arguments
|
||||||
)
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
(command_invocation
|
)
|
||||||
(identifier)
|
(command_invocation
|
||||||
(seperation (line_ending (newline)))
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (unquoted_argument))
|
(seperation (line_ending (newline)))
|
||||||
)
|
(arguments
|
||||||
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
========================================
|
========================================
|
||||||
Command invocations with escape sequence
|
Command invocations with escape sequence
|
||||||
========================================
|
========================================
|
||||||
|
@ -69,21 +77,25 @@ STATUS)
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(seperation (space))
|
(identifier)
|
||||||
(arguments
|
(seperation (space))
|
||||||
(argument (unquoted_argument))
|
(arguments
|
||||||
)
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
(command_invocation
|
)
|
||||||
(identifier)
|
(command_invocation
|
||||||
(seperation (line_ending (newline)))
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument (unquoted_argument))
|
(seperation (line_ending (newline)))
|
||||||
)
|
(arguments
|
||||||
|
(argument (unquoted_argument))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
Variable referencing
|
Variable referencing
|
||||||
|
@ -92,15 +104,17 @@ message(${var_ref})
|
||||||
---
|
---
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
(identifier)
|
(normal_command
|
||||||
(arguments
|
(identifier)
|
||||||
(argument
|
(arguments
|
||||||
(unquoted_argument
|
(argument
|
||||||
(variable_ref (normal_var (variable)))
|
(unquoted_argument
|
||||||
)
|
(variable_ref (normal_var (variable)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -399,9 +399,33 @@
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "("
|
"value": "("
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "seperation"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "arguments"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "foreach_items"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "foreach_range"
|
"name": "foreach_range"
|
||||||
|
@ -467,15 +491,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"foreach_items": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "items"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"foreach_range": {
|
"foreach_range": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
|
|
@ -115,6 +115,25 @@
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {}
|
"fields": {}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "foreach_items",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "argument",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "seperation",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "foreach_lists_items",
|
"type": "foreach_lists_items",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
@ -126,12 +145,16 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "command_invocation",
|
"type": "command_invocation",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "foreach_items",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "foreach_lists_items",
|
"type": "foreach_lists_items",
|
||||||
"named": true
|
"named": true
|
||||||
|
@ -431,10 +454,6 @@
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "items",
|
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "newline",
|
"type": "newline",
|
||||||
"named": true
|
"named": true
|
||||||
|
|
8820
src/parser.c
8820
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue