feat: put arguments in argument_list
node
This commit is contained in:
parent
47564fb004
commit
fe9b5e0229
|
@ -10,10 +10,12 @@ endfunction()
|
|||
(function_def
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endfunction_command
|
||||
(endfunction)
|
||||
|
@ -33,6 +35,7 @@ endfunction()
|
|||
(function_def
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
|
@ -46,6 +49,7 @@ endfunction()
|
|||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endfunction_command
|
||||
(endfunction)
|
||||
|
@ -65,10 +69,12 @@ endmacro()
|
|||
(macro_def
|
||||
(macro_command
|
||||
(macro)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endmacro_command
|
||||
(endmacro)
|
||||
|
@ -88,6 +94,7 @@ endmacro()
|
|||
(macro_def
|
||||
(macro_command
|
||||
(macro)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
|
@ -101,6 +108,7 @@ endmacro()
|
|||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endmacro_command
|
||||
(endmacro)
|
||||
|
@ -120,6 +128,7 @@ endblock()
|
|||
(block_def
|
||||
(block_command
|
||||
(block)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
|
@ -136,6 +145,7 @@ endblock()
|
|||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endblock_command
|
||||
(endblock)
|
||||
|
@ -156,18 +166,22 @@ endfunction()
|
|||
(function_def
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body
|
||||
(function_def
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endfunction_command
|
||||
(endfunction)
|
||||
|
|
|
@ -8,9 +8,11 @@ message([[]])
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=======================================
|
||||
One bracket argument [bracket_argument]
|
||||
|
@ -22,9 +24,11 @@ message([[an argument]])
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
========================================
|
||||
Two bracket arguments [bracket_argument]
|
||||
|
@ -36,10 +40,12 @@ message([[first argument]] [[second argument]])
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
========================================================
|
||||
Two bracket with two equals arguments [bracket_argument]
|
||||
|
@ -54,10 +60,12 @@ message(
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===================================================
|
||||
Bracket argument with line break [bracket_argument]
|
||||
|
@ -71,9 +79,11 @@ with line break
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=====================================================================================
|
||||
Bracket argument with embedded brackets and equal signs line break [bracket_argument]
|
||||
|
@ -87,7 +97,9 @@ with line break ]==]
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -19,12 +19,14 @@ message(STATUS #[[Some comment]] "comment is next" #[[Some comment]])
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(bracket_comment)
|
||||
(argument (quoted_argument (quoted_element)))
|
||||
(bracket_comment)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================
|
||||
Line comment [comment]
|
||||
|
@ -50,9 +52,11 @@ Second #Some other line comment
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(line_comment)
|
||||
(argument (unquoted_argument))
|
||||
(line_comment)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -10,8 +10,10 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endif_command (endif))
|
||||
)
|
||||
|
@ -30,13 +32,17 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(elseif_command
|
||||
(elseif)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endif_command (endif))
|
||||
)
|
||||
|
@ -56,13 +62,17 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(elseif_command
|
||||
(elseif)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(else_command (else))
|
||||
(body)
|
||||
|
@ -84,18 +94,24 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
(endif_command (endif))
|
||||
)
|
||||
)
|
||||
|
@ -120,46 +136,64 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
(elseif_command
|
||||
(elseif)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
(else_command
|
||||
(else)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
(endif_command (endif))
|
||||
)
|
||||
)
|
||||
|
@ -175,12 +209,14 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endif_command (endif))
|
||||
)
|
||||
|
@ -197,6 +233,7 @@ endif(NOT (A AND B) OR C)
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
|
@ -204,9 +241,11 @@ endif(NOT (A AND B) OR C)
|
|||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(else_command
|
||||
(else)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
|
@ -214,9 +253,11 @@ endif(NOT (A AND B) OR C)
|
|||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endif_command
|
||||
(endif)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
|
@ -226,6 +267,7 @@ endif(NOT (A AND B) OR C)
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
============================
|
||||
Nested condition [condition]
|
||||
|
@ -241,14 +283,18 @@ endif()
|
|||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body
|
||||
(if_condition
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endif_command (endif))
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
========================================
|
||||
Escape sequence of "\;" [Escape_sequence]
|
||||
Escape sequence of "\;" [escape_sequence]
|
||||
=========================================
|
||||
|
||||
set(var "It is \; and \"")
|
||||
|
@ -9,10 +9,17 @@ set(var "It is \; and \"")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument))
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
(escape_sequence)
|
||||
(escape_sequence))))))
|
||||
(escape_sequence)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -11,8 +11,10 @@ endforeach()
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command (endforeach))
|
||||
)
|
||||
|
@ -31,14 +33,17 @@ endforeach(var)
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command
|
||||
(endforeach)
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
=================================
|
||||
Uppercase foreach [foreach]
|
||||
|
@ -53,8 +58,10 @@ ENDFOREACH()
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command (endforeach))
|
||||
)
|
||||
|
@ -73,8 +80,10 @@ endForEach()
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command (endforeach))
|
||||
)
|
||||
|
@ -93,9 +102,11 @@ endforeach()
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command (endforeach))
|
||||
)
|
||||
|
@ -114,9 +125,11 @@ endforeach()
|
|||
(foreach_loop
|
||||
(foreach_command
|
||||
(foreach)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endforeach_command (endforeach))
|
||||
)
|
||||
|
|
|
@ -9,10 +9,12 @@ add_custom_target(OUTPUT somefile)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
================================================
|
||||
add_custom_target with new line [function_calls]
|
||||
|
@ -26,7 +28,9 @@ add_custom_target(
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -8,9 +8,15 @@ message($<>)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(gen_exp)))))
|
||||
(gen_exp)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=====================================
|
||||
Quoted generator expression [gen_exp]
|
||||
|
@ -22,10 +28,17 @@ message("$<>")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
(gen_exp))))))
|
||||
(gen_exp)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=====================
|
||||
No argument [gen_exp]
|
||||
|
@ -37,11 +50,19 @@ message($<ANGLE-R>)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(gen_exp
|
||||
(argument
|
||||
(unquoted_argument)))))))
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
============================================
|
||||
No argument with superfluous colon [gen_exp]
|
||||
|
@ -53,11 +74,19 @@ message($<ANGLE-R:>)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(gen_exp
|
||||
(argument
|
||||
(unquoted_argument)))))))
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================
|
||||
One argument [gen_exp]
|
||||
|
@ -69,13 +98,21 @@ message($<BOOL:-NOTFOUND>)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(gen_exp
|
||||
(argument
|
||||
(unquoted_argument))
|
||||
(argument
|
||||
(unquoted_argument)))))))
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=======================
|
||||
Two arguments [gen_exp]
|
||||
|
@ -87,6 +124,7 @@ message($<AND:TRUE,FALSE>)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(gen_exp
|
||||
|
@ -95,4 +133,11 @@ message($<AND:TRUE,FALSE>)
|
|||
(argument
|
||||
(unquoted_argument))
|
||||
(argument
|
||||
(unquoted_argument)))))))
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -23,6 +23,7 @@ message( )
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -39,6 +40,7 @@ message(
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -53,10 +55,12 @@ message(STATUS [=[Some argument ]==] ]=] )
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==============================================================
|
||||
Message with STATUS and bracket argument and newline [message]
|
||||
|
@ -71,10 +75,12 @@ message(STATUS
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (bracket_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================================================
|
||||
Message with STATUS and an unquoted argument [message]
|
||||
|
@ -87,7 +93,9 @@ message(STATUS argument)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -6,10 +6,12 @@ message(STATUS (TEST))
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===========================================================
|
||||
Missing parentheses inside command invocation [parentheses]
|
||||
|
@ -19,8 +21,11 @@ message(STATUS (TEST)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument)) (MISSING ")")
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
(MISSING ")")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -32,8 +37,11 @@ message(STATUS ((TEST))
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument)) (MISSING ")")
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
(MISSING ")")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -45,8 +53,10 @@ message(STATUS (TEST SECOND_TEST))
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -8,9 +8,11 @@ message("")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (quoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=====================================
|
||||
One quoted argument [quoted_argument]
|
||||
|
@ -22,9 +24,11 @@ message("An argument")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (quoted_argument (quoted_element)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================================
|
||||
Two quoted arguments [quoted_argument]
|
||||
|
@ -36,10 +40,12 @@ message("First argument" "Second argument")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (quoted_argument (quoted_element)))
|
||||
(argument (quoted_argument (quoted_element)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===================================================
|
||||
A quoted argument with line break [quoted_argument]
|
||||
|
@ -52,9 +58,11 @@ with line break")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (quoted_argument (quoted_element)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
========================================
|
||||
One variable reference [quoted_argument]
|
||||
|
@ -66,6 +74,7 @@ message("${var}")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
|
@ -75,6 +84,7 @@ message("${var}")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=========================================
|
||||
Two Variable references [quoted_argument]
|
||||
|
@ -86,6 +96,7 @@ message("${var} ${var}")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
|
@ -96,6 +107,7 @@ message("${var} ${var}")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================================================================
|
||||
Variable reference inside another variable reference [quoted_argument]
|
||||
|
@ -107,6 +119,7 @@ message("${var_${var}}")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
|
@ -116,6 +129,7 @@ message("${var_${var}}")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================================================================
|
||||
Lookalike bracket comment inside quoted argument [quoted_argument]
|
||||
|
@ -127,6 +141,7 @@ message("${var_${var}} #[[comment]]")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
|
@ -136,6 +151,7 @@ message("${var_${var}} #[[comment]]")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
======================================================================
|
||||
Lookalike line comment inside quoted argument [quoted_argument]
|
||||
|
@ -147,6 +163,7 @@ message("${var_${var}} #comment")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element
|
||||
|
@ -156,6 +173,7 @@ message("${var_${var}} #comment")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===========================================================
|
||||
Lookalike variable inside quoted argument [quoted_argument]
|
||||
|
@ -167,6 +185,7 @@ message("$var")
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(quoted_argument
|
||||
(quoted_element)
|
||||
|
@ -174,3 +193,4 @@ message("$var")
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -9,9 +9,11 @@ message(STATUS)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=========================================================
|
||||
Command invocation with two arguments [unquoted_argument]
|
||||
|
@ -24,10 +26,12 @@ message(STATUS Hello)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===============================================================
|
||||
Command invocations with leading seperation [unquoted_argument]
|
||||
|
@ -41,13 +45,18 @@ STATUS)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
============================================================
|
||||
Command invocations with escape sequence [unquoted_argument]
|
||||
============================================================
|
||||
|
@ -60,13 +69,17 @@ STATUS)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
========================================
|
||||
Variable referencing [unquoted_argument]
|
||||
|
@ -77,6 +90,7 @@ message(${var_ref})
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(variable_ref (normal_var (variable)))
|
||||
|
@ -84,6 +98,7 @@ message(${var_ref})
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
====================================================================
|
||||
Variable referencing inside variable referencing [unquoted_argument]
|
||||
|
@ -94,6 +109,7 @@ message(${var_${var_ref}})
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument
|
||||
(variable_ref (normal_var (variable (variable_ref (normal_var (variable))))))
|
||||
|
@ -101,6 +117,7 @@ message(${var_${var_ref}})
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
===============================================================
|
||||
Lookalike variable inside unquoted argument [unquoted_argument]
|
||||
|
@ -112,8 +129,10 @@ message($var)
|
|||
(source_file
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument
|
||||
(unquoted_argument)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -11,8 +11,10 @@ endwhile()
|
|||
(while_loop
|
||||
(while_command
|
||||
(while)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endwhile_command (endwhile))
|
||||
)
|
||||
|
@ -31,8 +33,10 @@ endwhile(cond)
|
|||
(while_loop
|
||||
(while_command
|
||||
(while)
|
||||
(argument_list
|
||||
(argument (unquoted_argument))
|
||||
)
|
||||
)
|
||||
(body)
|
||||
(endwhile_command
|
||||
(endwhile)
|
||||
|
|
27
grammar.js
27
grammar.js
|
@ -52,34 +52,35 @@ module.exports = grammar({
|
|||
_unquoted_text: (_) => prec.left(repeat1(choice("$", /[^()#"\\']/))),
|
||||
|
||||
body: ($) => prec.right(repeat1($._untrimmed_command_invocation)),
|
||||
argument_list: ($) => repeat1($._untrimmed_argument),
|
||||
|
||||
if_command: ($) => command($.if, repeat($._untrimmed_argument)),
|
||||
elseif_command: ($) => command($.elseif, repeat($._untrimmed_argument)),
|
||||
else_command: ($) => command($.else, repeat($._untrimmed_argument)),
|
||||
endif_command: ($) => command($.endif, repeat($._untrimmed_argument)),
|
||||
if_command: ($) => command($.if, $.argument_list),
|
||||
elseif_command: ($) => command($.elseif, $.argument_list),
|
||||
else_command: ($) => command($.else, optional($.argument_list)),
|
||||
endif_command: ($) => command($.endif, optional($.argument_list)),
|
||||
if_condition: ($) => seq($.if_command, repeat(choice($.body, $.elseif_command, $.else_command)), $.endif_command),
|
||||
|
||||
foreach_command: ($) => command($.foreach, repeat($._untrimmed_argument)),
|
||||
foreach_command: ($) => command($.foreach, $.argument_list),
|
||||
endforeach_command: ($) => command($.endforeach, optional($.argument)),
|
||||
foreach_loop: ($) => seq($.foreach_command, $.body, $.endforeach_command),
|
||||
|
||||
while_command: ($) => command($.while, repeat($._untrimmed_argument)),
|
||||
while_command: ($) => command($.while, $.argument_list),
|
||||
endwhile_command: ($) => command($.endwhile, optional(seq(/\s*/, $.argument, /\s*/))),
|
||||
while_loop: ($) => seq($.while_command, $.body, $.endwhile_command),
|
||||
|
||||
function_command: ($) => command($.function, repeat($._untrimmed_argument)),
|
||||
endfunction_command: ($) => command($.endfunction, repeat($._untrimmed_argument)),
|
||||
function_command: ($) => command($.function, $.argument_list),
|
||||
endfunction_command: ($) => command($.endfunction, optional($.argument_list)),
|
||||
function_def: ($) => seq($.function_command, $.body, $.endfunction_command),
|
||||
|
||||
macro_command: ($) => command($.macro, repeat($._untrimmed_argument)),
|
||||
endmacro_command: ($) => command($.endmacro, repeat($._untrimmed_argument)),
|
||||
macro_command: ($) => command($.macro, $.argument_list),
|
||||
endmacro_command: ($) => command($.endmacro, optional($.argument_list)),
|
||||
macro_def: ($) => seq($.macro_command, $.body, $.endmacro_command),
|
||||
|
||||
block_command: ($) => command($.block, repeat($._untrimmed_argument)),
|
||||
endblock_command: ($) => command($.endblock, repeat($._untrimmed_argument)),
|
||||
block_command: ($) => command($.block, $.argument_list),
|
||||
endblock_command: ($) => command($.endblock, optional($.argument_list)),
|
||||
block_def: ($) => seq($.block_command, $.body, $.endblock_command),
|
||||
|
||||
normal_command: ($) => command($.identifier, repeat($._untrimmed_argument)),
|
||||
normal_command: ($) => command($.identifier, optional($.argument_list)),
|
||||
|
||||
_command_invocation: ($) =>
|
||||
choice($.normal_command, $.if_condition, $.foreach_loop, $.while_loop, $.function_def, $.macro_def, $.block_def),
|
||||
|
|
108
src/grammar.json
108
src/grammar.json
|
@ -444,6 +444,13 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"argument_list": {
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
},
|
||||
"if_command": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
@ -463,11 +470,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -494,11 +498,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -525,11 +526,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -556,11 +562,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -620,11 +631,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -704,11 +712,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -801,11 +806,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -832,11 +834,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -880,11 +887,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -911,11 +915,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -959,11 +968,8 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
}
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -990,11 +996,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
@ -1038,11 +1049,16 @@
|
|||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_untrimmed_argument"
|
||||
"name": "argument_list"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
|
|
@ -23,21 +23,17 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"type": "block_command",
|
||||
"type": "argument_list",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "block",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"named": true
|
||||
|
@ -49,6 +45,25 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "block_command",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "block",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "block_def",
|
||||
"named": true,
|
||||
|
@ -143,20 +158,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "else",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -170,20 +177,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "elseif",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -197,20 +196,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "endblock",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -243,20 +234,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "endfunction",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -270,20 +253,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "endif",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -297,20 +272,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "endmacro",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -363,20 +330,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "foreach",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -413,20 +372,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -478,20 +429,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -536,15 +479,7 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
|
@ -586,20 +521,12 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -778,15 +705,7 @@
|
|||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "argument",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "bracket_comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"type": "argument_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
|
|
33379
src/parser.c
33379
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue