tree-sitter-dust/corpus/control_flow.txt

179 lines
3.1 KiB
Plaintext
Raw Normal View History

2023-09-29 07:52:21 +00:00
==================
2023-10-06 10:18:02 +00:00
If
2023-09-29 07:52:21 +00:00
==================
2023-10-09 18:39:47 +00:00
if true { "True" }
2023-09-29 07:52:21 +00:00
---
2023-09-29 13:53:53 +00:00
(root
(item
(statement
2023-10-06 10:18:02 +00:00
(if_else
2023-10-09 18:39:47 +00:00
(if
2023-10-01 05:13:29 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(boolean)))
(statement
(expression
(value
(string)))))))))
2023-09-29 07:52:21 +00:00
==================
2023-10-06 10:18:02 +00:00
If Assignment
2023-09-29 07:52:21 +00:00
==================
2023-10-09 18:39:47 +00:00
x = if true { 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)
2023-10-09 18:39:47 +00:00
(assignment_operator)
2023-10-06 10:18:02 +00:00
(statement
(if_else
2023-10-09 18:39:47 +00:00
(if
2023-10-06 10:18:02 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(boolean)))
(statement
(expression
(value
(integer)))))))))))
2023-10-06 02:05:18 +00:00
==================
2023-10-06 10:18:02 +00:00
If Else
2023-10-06 02:05:18 +00:00
==================
2023-10-09 18:39:47 +00:00
if false { "True" } else { "False" }
2023-10-06 02:05:18 +00:00
---
(root
(item
(statement
2023-10-06 10:18:02 +00:00
(if_else
2023-10-09 18:39:47 +00:00
(if
2023-10-06 02:05:18 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(boolean)))
(statement
(expression
(value
(string)))))
(else
(statement
(expression
(value
(string)))))))))
2023-10-06 02:05:18 +00:00
==================
2023-10-06 10:18:02 +00:00
If Else If
2023-10-06 02:05:18 +00:00
==================
2023-10-09 18:39:47 +00:00
if 1 == 1 {
"math is fun"
} else if 4 == 9 {
"math is broken"
}
2023-10-06 02:05:18 +00:00
---
2023-10-06 11:55:04 +00:00
2023-10-06 02:05:18 +00:00
(root
(item
(statement
2023-10-06 10:18:02 +00:00
(if_else
2023-10-09 18:39:47 +00:00
(if
(expression
(logic
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))
(statement
2023-10-06 02:05:18 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(string)))))
(else_if
2023-10-06 02:05:18 +00:00
(expression
2023-10-09 18:39:47 +00:00
(logic
(expression
(value
(integer)))
(logic_operator)
2023-10-06 11:55:04 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(integer)))))
(statement
(expression
(value
(string)))))))))
2023-10-06 10:18:02 +00:00
==================
If Else Else If Else
==================
2023-10-09 18:39:47 +00:00
if false {
"no"
} else if false {
"no"
} else if 1 + 1 == 9 {
"not the answer"
} else {
"42"
}
2023-10-06 10:18:02 +00:00
---
(root
(item
(statement
(if_else
2023-10-09 18:39:47 +00:00
(if
2023-10-06 10:18:02 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(boolean)))
(statement
2023-10-06 10:18:02 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(string)))))
(else_if
(expression
(value
(boolean)))
(statement
(expression
(value
(string)))))
(else_if
(expression
(logic
2023-10-06 11:55:04 +00:00
(expression
2023-10-09 18:39:47 +00:00
(math
2023-10-06 11:55:04 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(integer)))
(math_operator)
2023-10-06 11:55:04 +00:00
(expression
(value
2023-10-09 18:39:47 +00:00
(integer)))))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(value
(string)))))
(else
(statement
(expression
(value
(string)))))))))