1
0
dust/tree-sitter-dust/corpus/statements.txt
2023-11-10 20:44:03 -05:00

133 lines
3.1 KiB
Plaintext

================================================================================
Simple Statements
================================================================================
1
"one";
x
--------------------------------------------------------------------------------
(root
(statement
(expression
(value
(integer))))
(statement
(expression
(value
(string))))
(statement
(expression
(identifier))))
================================================================================
Simple Assignment
================================================================================
x = 1;
y = "one"
--------------------------------------------------------------------------------
(root
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(string)))))))
================================================================================
Complex Assignment
================================================================================
x = if 1 + 1 == 2 {
'yo'
} else {
'no'
}
--------------------------------------------------------------------------------
(root
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(if_else
(if
(expression
(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
================================================================================
x = 3 == 1 + 2 + 2
--------------------------------------------------------------------------------
(root
(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)))))))))))