1
0
dust/tree-sitter-dust/corpus/statements.txt

137 lines
2.6 KiB
Plaintext
Raw Normal View History

==================
Simple Statements
==================
1
"one"
x
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(expression
(value
(integer))))
(statement
(expression
(value
(string))))
(statement
(expression
(identifier)))))
==================
Simple Assignment
==================
x = 1
y = "one"
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(string))))))))
==================
Complex Assignment
==================
2023-10-31 09:51:37 +00:00
x = if 1 + 1 == 2 {
'yo'
} else {
'no'
}
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(if_else
(if
(expression
2023-10-31 13:31:10 +00:00
(logic
(expression
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
(expression
(value
(integer)))))
(block
(statement
(expression
(value
(string))))))
(else
(block
(statement
(expression
(value
(string))))))))))))
==================
Expression Precedence
==================
2023-10-31 09:51:37 +00:00
x = 3 == 1 + 2 + 2
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(logic
(expression
(value
(integer)))
(logic_operator)
(expression
(math
(expression
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(math_operator)
(expression
(value
(integer))))))))))))