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

118 lines
2.8 KiB
Plaintext
Raw Normal View History

2023-10-31 19:21:13 +00:00
================================================================================
2023-10-31 09:51:37 +00:00
Simple Find Loop
2023-10-31 19:21:13 +00:00
================================================================================
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
}
2023-10-31 19:21:13 +00:00
--------------------------------------------------------------------------------
2023-10-18 22:18:41 +00:00
(root
2023-11-11 01:44:03 +00:00
(statement
(find
(identifier)
(expression
(value
(list
(expression
(value
(integer)))
(expression
(value
(integer)))
(expression
(value
(integer))))))
(block
(statement
(expression
(logic
2023-10-31 13:31:10 +00:00
(expression
2023-11-11 01:44:03 +00:00
(identifier))
(logic_operator)
2023-10-31 13:31:10 +00:00
(expression
(value
2023-11-11 01:44:03 +00:00
(integer))))))))))
2023-10-18 22:18:41 +00:00
2023-10-31 19:21:13 +00:00
================================================================================
2023-10-31 09:51:37 +00:00
Nested Find Loop
2023-10-31 19:21:13 +00:00
================================================================================
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-31 19:21:13 +00:00
--------------------------------------------------------------------------------
2023-10-18 22:18:41 +00:00
(root
2023-11-11 01:44:03 +00:00
(statement
(find
(identifier)
(expression
(value
(list
(expression
(value
(string)))
(expression
(value
(string)))
(expression
(value
(string))))))
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(find
(identifier)
2023-10-18 22:18:41 +00:00
(expression
2023-11-11 01:44:03 +00:00
(identifier))
2023-10-31 13:31:10 +00:00
(block
(statement
(expression
2023-11-11 01:44:03 +00:00
(logic
(expression
(identifier))
(logic_operator)
(expression
(value
(string)))))))))))
(statement
(if_else
(if
(expression
(logic
(expression
(function_call
(built_in_function
(expression
(identifier)))))
(logic_operator)
(expression
(value
(string)))))
(block
(statement
(expression
(value
(boolean))))))
(else
(block
(statement
(expression
(value
(boolean))))))))))))