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