tree-sitter-dust/corpus/control_flow.txt

116 lines
1.8 KiB
Plaintext
Raw Normal View History

2023-09-29 07:52:21 +00:00
==================
If/Then
==================
2023-09-29 17:04:19 +00:00
if true then "True"
2023-09-29 07:52:21 +00:00
---
2023-09-29 13:53:53 +00:00
(root
(item
(statement
2023-10-06 02:05:18 +00:00
(control_flow
(expression
(value
(boolean)))
(statement
2023-10-01 05:13:29 +00:00
(expression
(value
2023-10-06 02:05:18 +00:00
(string))))))))
2023-09-29 07:52:21 +00:00
==================
If/Then Assignment
==================
2023-09-29 17:04:19 +00:00
x = if true then 1
2023-09-29 07:52:21 +00:00
---
2023-09-29 13:53:53 +00:00
(root
2023-10-06 02:05:18 +00:00
(item
(statement
(assignment
(identifier)
(expression
(identifier)))))
(item
(statement
(expression
(value
(boolean)))))
(item
(statement
(expression
(identifier))))
2023-09-29 13:53:53 +00:00
(item
(statement
2023-10-01 05:13:29 +00:00
(expression
2023-10-06 02:05:18 +00:00
(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
2023-10-01 10:09:29 +00:00
(expression
2023-10-06 02:05:18 +00:00
(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))))))))