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

72 lines
1.7 KiB
Plaintext

================================================================================
Simple Reduce Loop
================================================================================
reduce i to acc in [1, 2, 3] {
acc += i
}
--------------------------------------------------------------------------------
(root
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
(expression
(value
(integer)))
(expression
(value
(integer)))
(expression
(value
(integer))))))
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(identifier)))))))))
================================================================================
Nested Reduce Loop
================================================================================
reduce i to acc in ["one", "two", "three"] {
acc += i
}
--------------------------------------------------------------------------------
(root
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
(expression
(value
(string)))
(expression
(value
(string)))
(expression
(value
(string))))))
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(identifier)))))))))