Add for expressions
This commit is contained in:
parent
26999482a3
commit
bb6875a11d
5 changed files with 1777 additions and 1006 deletions
|
|
@ -53,3 +53,61 @@ while 12 do 27
|
|||
(while_expression
|
||||
condition: (integer_literal)
|
||||
body: (integer_literal)))
|
||||
|
||||
================================================================================
|
||||
For
|
||||
================================================================================
|
||||
|
||||
for i := 12 to nil do "42"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(for_expression
|
||||
index: (identifier)
|
||||
start: (integer_literal)
|
||||
end: (nil_literal)
|
||||
body: (string_literal)))
|
||||
|
||||
================================================================================
|
||||
For no index
|
||||
================================================================================
|
||||
|
||||
for 12 to nil do "42"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(ERROR
|
||||
(identifier)
|
||||
(identifier)
|
||||
(nil_literal))
|
||||
(string_literal))
|
||||
|
||||
================================================================================
|
||||
For no end
|
||||
================================================================================
|
||||
|
||||
for 12 do "42"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(ERROR
|
||||
(identifier)
|
||||
(identifier))
|
||||
(string_literal))
|
||||
|
||||
================================================================================
|
||||
For no body
|
||||
================================================================================
|
||||
|
||||
for 12 to nil
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(ERROR
|
||||
(identifier)
|
||||
(identifier))
|
||||
(nil_literal))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue