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

120 lines
2.6 KiB
Plaintext
Raw Normal View History

2023-10-18 22:18:41 +00:00
==================
2023-10-31 09:51:37 +00:00
Simple Find Loop
2023-10-18 22:18:41 +00:00
==================
find i in [1, 2, 3] {
2023-10-31 09:51:37 +00:00
i <= 3
2023-10-18 22:18:41 +00:00
}
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(find
(identifier)
2023-10-18 22:18:41 +00:00
(expression
2023-10-31 13:31:10 +00:00
(value
(list
(expression
(value
(integer)))
(expression
(value
(integer)))
(expression
(value
(integer))))))
(block
(statement
2023-10-31 09:51:37 +00:00
(expression
2023-10-31 13:31:10 +00:00
(logic
(expression
(identifier))
(logic_operator)
(expression
(value
(integer)))))))))))
2023-10-18 22:18:41 +00:00
==================
2023-10-31 09:51:37 +00:00
Nested Find Loop
2023-10-18 22:18:41 +00:00
==================
2023-10-31 09:51:37 +00:00
find i in ["one", "two", "three"] {
found = find j in i {
i == "e"
}
if (type found) != 'empty' {
true
} else {
false
}
2023-10-18 22:18:41 +00:00
}
2023-10-31 09:51:37 +00:00
2023-10-18 22:18:41 +00:00
---
(root
2023-10-31 13:31:10 +00:00
(block
(statement
(find
(identifier)
(expression
(value
(list
(expression
(value
(string)))
(expression
(value
(string)))
(expression
(value
(string))))))
(block
2023-10-31 09:51:37 +00:00
(statement
2023-10-31 13:31:10 +00:00
(assignment
2023-10-31 09:51:37 +00:00
(identifier)
2023-10-31 13:31:10 +00:00
(assignment_operator)
2023-10-18 22:18:41 +00:00
(statement
2023-10-31 13:31:10 +00:00
(find
(identifier)
(expression
(identifier))
(block
(statement
(expression
(logic
(expression
(identifier))
(logic_operator)
(expression
(value
(string)))))))))))
(statement
(if_else
(if
2023-10-18 22:18:41 +00:00
(expression
(logic
(expression
2023-10-31 17:04:22 +00:00
(function_call
(built_in_function)
2023-10-31 13:31:10 +00:00
(expression
(identifier))))
2023-10-18 22:18:41 +00:00
(logic_operator)
(expression
(value
2023-10-31 13:31:10 +00:00
(string)))))
(block
(statement
2023-10-31 09:51:37 +00:00
(expression
2023-10-31 13:31:10 +00:00
(value
(boolean))))))
(else
(block
(statement
(expression
(value
(boolean)))))))))))))