Update tests for differentiating commands
This commit is contained in:
parent
6973cc46d2
commit
387faac594
|
@ -7,12 +7,14 @@ message([[]])
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (bracket_argument))
|
(argument (bracket_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
One empty bracket argument
|
One empty bracket argument
|
||||||
|
@ -23,12 +25,14 @@ message([[An argument]])
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (bracket_argument (bracket_content)))
|
(argument (bracket_argument (bracket_content)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
One bracket argument
|
One bracket argument
|
||||||
|
@ -39,12 +43,14 @@ message([[An argument]])
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (bracket_argument (bracket_content)))
|
(argument (bracket_argument (bracket_content)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================
|
=====================
|
||||||
Two bracket arguments
|
Two bracket arguments
|
||||||
|
@ -55,6 +61,7 @@ message([[First argument]] [[Second argument]])
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (bracket_argument (bracket_content)))
|
(argument (bracket_argument (bracket_content)))
|
||||||
|
@ -62,7 +69,8 @@ message([[First argument]] [[Second argument]])
|
||||||
(argument (bracket_argument (bracket_content)))
|
(argument (bracket_argument (bracket_content)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Two bracket with two equals arguments
|
Two bracket with two equals arguments
|
||||||
|
@ -76,6 +84,7 @@ message(
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -85,7 +94,8 @@ message(
|
||||||
(seperation (line_ending (newline)))
|
(seperation (line_ending (newline)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
================================
|
================================
|
||||||
Bracket argument with line break
|
Bracket argument with line break
|
||||||
|
@ -98,10 +108,12 @@ with line break
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (bracket_argument (bracket_content)))
|
(argument (bracket_argument (bracket_content)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,11 @@ 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
|
||||||
|
@ -20,10 +24,12 @@ message( )
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
================================================
|
================================================
|
||||||
Command invocation without argument with newline
|
Command invocation without argument with newline
|
||||||
|
@ -37,10 +43,12 @@ message(
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation
|
(seperation
|
||||||
(line_ending (newline))
|
(line_ending (newline))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,14 @@ message("")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (quoted_argument))
|
(argument (quoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
===================
|
===================
|
||||||
One quoted argument
|
One quoted argument
|
||||||
|
@ -23,12 +25,14 @@ message("An argument")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (quoted_argument (quoted_element)))
|
(argument (quoted_argument (quoted_element)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
Two quoted arguments
|
Two quoted arguments
|
||||||
|
@ -39,6 +43,7 @@ message("First argument" "Second argument")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (quoted_argument (quoted_element)))
|
(argument (quoted_argument (quoted_element)))
|
||||||
|
@ -46,7 +51,8 @@ message("First argument" "Second argument")
|
||||||
(argument (quoted_argument (quoted_element)))
|
(argument (quoted_argument (quoted_element)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=================================
|
=================================
|
||||||
A quoted argument with line break
|
A quoted argument with line break
|
||||||
|
@ -58,12 +64,14 @@ with line break")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (quoted_argument (quoted_element)))
|
(argument (quoted_argument (quoted_element)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
======================
|
======================
|
||||||
One variable reference
|
One variable reference
|
||||||
|
@ -74,6 +82,7 @@ message("${var}")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument
|
(argument
|
||||||
|
@ -85,7 +94,8 @@ message("${var}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=======================
|
=======================
|
||||||
Two Variable references
|
Two Variable references
|
||||||
|
@ -96,6 +106,7 @@ message("${var} ${var}")
|
||||||
---
|
---
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument
|
(argument
|
||||||
|
@ -108,4 +119,5 @@ message("${var} ${var}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -8,12 +8,14 @@ message(STATUS)
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Command invocation with two arguments
|
Command invocation with two arguments
|
||||||
|
@ -25,6 +27,7 @@ message(STATUS Hello)
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
|
@ -32,7 +35,8 @@ message(STATUS Hello)
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
===========================================
|
===========================================
|
||||||
Command invocations with leading seperation
|
Command invocations with leading seperation
|
||||||
|
@ -45,20 +49,24 @@ STATUS)
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (line_ending (newline)))
|
(seperation (line_ending (newline)))
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
========================================
|
========================================
|
||||||
Command invocations with escape sequence
|
Command invocations with escape sequence
|
||||||
========================================
|
========================================
|
||||||
|
@ -70,20 +78,24 @@ STATUS)
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (space))
|
(seperation (space))
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(seperation (line_ending (newline)))
|
(seperation (line_ending (newline)))
|
||||||
(arguments
|
(arguments
|
||||||
(argument (unquoted_argument))
|
(argument (unquoted_argument))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
====================
|
====================
|
||||||
Variable referencing
|
Variable referencing
|
||||||
|
@ -93,6 +105,7 @@ message(${var_ref})
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(command_invocation
|
(command_invocation
|
||||||
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(arguments
|
(arguments
|
||||||
(argument
|
(argument
|
||||||
|
@ -102,5 +115,6 @@ message(${var_ref})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -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