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

146 lines
3.7 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
2024-02-16 15:55:15 +00:00
(statement_kind
(expression
(value
(integer)))))
2023-11-11 01:44:03 +00:00
(statement
2024-02-16 15:55:15 +00:00
(statement_kind
(expression
(value
(string)))))
2023-11-11 01:44:03 +00:00
(statement
2024-02-16 15:55:15 +00:00
(statement_kind
(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
2024-02-16 15:55:15 +00:00
(statement_kind
(assignment
(identifier)
(assignment_operator)
(statement
(statement_kind
(expression
(value
(integer))))))))
2023-11-11 01:44:03 +00:00
(statement
2024-02-16 15:55:15 +00:00
(statement_kind
(assignment
(identifier)
(assignment_operator)
(statement
(statement_kind
(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
2024-02-16 15:55:15 +00:00
(statement_kind
(assignment
(identifier)
(assignment_operator)
(statement
(statement_kind
(if_else
(if
2023-11-11 01:44:03 +00:00
(expression
2024-02-16 15:55:15 +00:00
(logic
2023-11-11 01:44:03 +00:00
(expression
2024-02-16 15:55:15 +00:00
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
2023-11-11 01:44:03 +00:00
(expression
(value
(integer)))))
2024-02-16 15:55:15 +00:00
(block
(statement
(statement_kind
(expression
(value
(string)))))))
(else
(block
(statement
(statement_kind
(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
2024-02-16 15:55:15 +00:00
(statement_kind
(assignment
(identifier)
(assignment_operator)
(statement
(statement_kind
2023-11-11 01:44:03 +00:00
(expression
(math
(expression
2024-02-16 15:55:15 +00:00
(math
2023-11-11 01:44:03 +00:00
(expression
2024-02-16 15:55:15 +00:00
(logic
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))
(math_operator)
2023-11-11 01:44:03 +00:00
(expression
(value
(integer)))))
(math_operator)
(expression
(value
2024-02-16 15:55:15 +00:00
(integer)))))))))))