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

119 lines
2.8 KiB
Plaintext

================================================================================
Simple Function
================================================================================
foo <fn -> str> || { "Hiya" }
--------------------------------------------------------------------------------
(root
(statement
(function_declaration
(identifier)
(type_definition
(type
(type)))
(function
(block
(statement
(expression
(value
(string)))))))))
================================================================================
Function Call
================================================================================
(foobar "Hiya")
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(expression
(identifier))
(expression
(value
(string)))))))
================================================================================
Complex Function
================================================================================
foobar <fn str num> |message number| {
(output message)
(output number)
}
--------------------------------------------------------------------------------
(root
(statement
(function_declaration
(identifier)
(type_definition
(type
(type)
(type)))
(function
(identifier)
(identifier)
(block
(statement
(expression
(function_call
(expression
(identifier))
(expression
(identifier)))))
(statement
(expression
(function_call
(expression
(identifier))
(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)))))))))))