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

70 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-10-31 05:09:29 +00:00
==================
2023-10-31 07:17:58 +00:00
Simple Reduce Loop
2023-10-31 05:09:29 +00:00
==================
reduce i to acc in [1, 2, 3] {
acc += i
}
---
(root
2023-10-31 07:17:58 +00:00
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
(expression
(value
(integer)))
(expression
(value
(integer)))
(expression
(value
(integer))))))
(statement
(assignment
(identifier)
(assignment_operator)
2023-10-31 05:09:29 +00:00
(statement
2023-10-31 07:17:58 +00:00
(expression
(identifier))))))))
2023-10-31 05:09:29 +00:00
==================
2023-10-31 07:17:58 +00:00
Nested Reduce Loop
2023-10-31 05:09:29 +00:00
==================
2023-10-31 07:17:58 +00:00
reduce i to acc in ["one", "two", "three"] {
2023-10-31 05:09:29 +00:00
acc += i
}
---
(root
2023-10-31 07:17:58 +00:00
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
2023-10-31 05:09:29 +00:00
(expression
(value
2023-10-31 07:17:58 +00:00
(string)))
(expression
(value
(string)))
(expression
(value
(string))))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(identifier))))))))