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

139 lines
3.3 KiB
Plaintext

================================================================================
Simple Function
================================================================================
|| <str> { "Hiya" }
--------------------------------------------------------------------------------
(root
(statement
(expression
(value
(function
(type)
(block
(statement
(expression
(value
(string))))))))))
================================================================================
Function Assignment
================================================================================
x = || <str> { "Hiya" }
--------------------------------------------------------------------------------
(root
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(function
(type)
(block
(statement
(expression
(value
(string))))))))))))
================================================================================
Function Call
================================================================================
(foobar "Hiya")
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(expression
(identifier))
(expression
(value
(string)))))))
================================================================================
Complex Function
================================================================================
|message <str> number <int>| {
(output message)
(output number)
}
--------------------------------------------------------------------------------
(root
(statement
(expression
(value
(function
(parameter
(identifier)
(type))
(parameter
(identifier)
(type))
(block
(statement
(expression
(function_call
(built_in_function
(expression
(identifier))))))
(statement
(expression
(function_call
(built_in_function
(expression
(identifier))))))))))))
================================================================================
Complex Function Call
================================================================================
(foobar
"hi"
42
(
x = 1
y = 2
)
)
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(expression
(identifier))
(expression
(value
(string)))
(expression
(value
(integer)))
(expression
(value
(map
(identifier)
(statement
(expression
(value
(integer))))
(identifier)
(statement
(expression
(value
(integer)))))))))))