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

133 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

2023-11-11 01:44:03 +00:00
================================================================================
Simple Statements
2023-11-11 01:44:03 +00:00
================================================================================
1
2023-10-31 20:25:13 +00:00
"one";
x
2023-11-11 01:44:03 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
(expression
(value
(integer))))
(statement
(expression
(value
(string))))
(statement
(expression
(identifier))))
2023-11-11 01:44:03 +00:00
================================================================================
Simple Assignment
2023-11-11 01:44:03 +00:00
================================================================================
2023-10-31 20:25:13 +00:00
x = 1;
y = "one"
2023-11-11 01:44:03 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(string)))))))
2023-11-11 01:44:03 +00:00
================================================================================
Complex Assignment
2023-11-11 01:44:03 +00:00
================================================================================
2023-10-31 09:51:37 +00:00
x = if 1 + 1 == 2 {
'yo'
} else {
'no'
}
2023-11-11 01:44:03 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(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)))))))))))
2023-11-11 01:44:03 +00:00
================================================================================
Expression Precedence
2023-11-11 01:44:03 +00:00
================================================================================
2023-10-31 09:51:37 +00:00
x = 3 == 1 + 2 + 2
2023-11-11 01:44:03 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(math
2023-11-11 01:44:03 +00:00
(expression
(math
(expression
(logic
2023-11-11 01:44:03 +00:00
(expression
(value
(integer)))
(logic_operator)
2023-11-11 01:44:03 +00:00
(expression
(value
(integer)))))
(math_operator)
(expression
(value
(integer)))))
(math_operator)
(expression
(value
(integer)))))))))