1
0
dust/tree-sitter-dust/corpus/functions.txt
2023-11-03 21:16:55 -04:00

144 lines
3.6 KiB
Plaintext

================================================================================
Simple Function
================================================================================
=> "Hiya"
--------------------------------------------------------------------------------
(root
(block
(statement
(expression
(value
(function
(block
(statement
(expression
(value
(string)))))))))))
================================================================================
Function Assignment
================================================================================
x = => "Hiya"
--------------------------------------------------------------------------------
(root
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(function
(block
(statement
(expression
(value
(string)))))))))))))
================================================================================
Function Call
================================================================================
(foobar "Hiya")
--------------------------------------------------------------------------------
(root
(block
(statement
(expression
(function_call
(identifier)
(expression
(value
(string))))))))
================================================================================
Complex Function
================================================================================
|message number| => {
(output message)
(output number)
}
--------------------------------------------------------------------------------
(root
(block
(statement
(expression
(value
(function
(identifier_list
(identifier)
(identifier))
(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
map {
x = 1
y = 2
}
)
--------------------------------------------------------------------------------
(root
(block
(statement
(expression
(function_call
(identifier)
(expression
(value
(string)))
(expression
(value
(integer)))
(expression
(value
(map
(block
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer)))))))))))))))