tree-sitter-dust/corpus/control_flow.txt

116 lines
1.8 KiB
Plaintext

==================
If/Then
==================
if true then "True"
---
(root
(item
(statement
(control_flow
(expression
(value
(boolean)))
(statement
(expression
(value
(string))))))))
==================
If/Then Assignment
==================
x = if true then 1
---
(root
(item
(statement
(assignment
(identifier)
(expression
(identifier)))))
(item
(statement
(expression
(value
(boolean)))))
(item
(statement
(expression
(identifier))))
(item
(statement
(expression
(value
(integer))))))
==================
If/Else
==================
if false then "True" else "False"
---
(root
(item
(statement
(control_flow
(expression
(value
(boolean)))
(statement
(expression
(value
(string))))
(statement
(expression
(value
(string))))))))
==================
If/Else If
==================
if 1 == 1
then "math is fun"
else if 4 == 9
then "math is broken"
---
(root
(item
(statement
(control_flow
(expression
(logic
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(value
(string))))
(expression
(logic
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(value
(string))))))))