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

140 lines
3.3 KiB
Plaintext
Raw Normal View History

2023-10-31 15:21:13 -04:00
================================================================================
Simple Function
2023-10-31 15:21:13 -04:00
================================================================================
2023-11-29 19:23:42 -05:00
|| { "Hiya" }
2023-10-31 15:21:13 -04:00
--------------------------------------------------------------------------------
(root
2023-11-10 20:44:03 -05:00
(statement
(expression
(value
(function
(block
(statement
(expression
(value
(string))))))))))
2023-10-31 15:21:13 -04:00
2023-10-31 18:18:39 -04:00
================================================================================
Function Assignment
================================================================================
2023-11-29 19:23:42 -05:00
x <fn num -> str> = |number| { "Hiya" }
2023-10-31 18:18:39 -04:00
--------------------------------------------------------------------------------
(root
2023-11-10 20:44:03 -05:00
(statement
(assignment
(identifier)
2023-11-29 19:23:42 -05:00
(type_definition
(type
(type)
(type)))
2023-11-10 20:44:03 -05:00
(assignment_operator)
(statement
(expression
(value
(function
2023-11-29 19:23:42 -05:00
(identifier)
2023-11-10 20:44:03 -05:00
(block
(statement
(expression
(value
(string))))))))))))
2023-10-31 18:18:39 -04:00
2023-10-31 15:21:13 -04:00
================================================================================
Function Call
2023-10-31 15:21:13 -04:00
================================================================================
(foobar "Hiya")
2023-10-31 15:21:13 -04:00
--------------------------------------------------------------------------------
(root
2023-11-10 20:44:03 -05:00
(statement
(expression
(function_call
(expression
(identifier))
2023-11-10 20:44:03 -05:00
(expression
(value
(string)))))))
2023-10-31 15:21:13 -04:00
================================================================================
Complex Function
2023-10-31 15:21:13 -04:00
================================================================================
2023-11-29 19:23:42 -05:00
|message number| {
(output message)
(output number)
}
2023-10-31 15:21:13 -04:00
--------------------------------------------------------------------------------
(root
2023-11-10 20:44:03 -05:00
(statement
(expression
(value
(function
2023-11-29 19:23:42 -05:00
(identifier)
(identifier)
2023-11-10 20:44:03 -05:00
(block
(statement
(expression
(function_call
2023-11-29 19:23:42 -05:00
(expression
(identifier))
(expression
(identifier)))))
2023-11-10 20:44:03 -05:00
(statement
(expression
(function_call
2023-11-29 19:23:42 -05:00
(expression
(identifier))
(expression
(identifier)))))))))))
2023-10-31 15:21:13 -04:00
================================================================================
Complex Function Call
2023-10-31 15:21:13 -04:00
================================================================================
(foobar
"hi"
42
2023-11-28 11:01:38 -05:00
{
x = 1
y = 2
2023-11-28 11:01:38 -05:00
}
)
2023-10-31 15:21:13 -04:00
--------------------------------------------------------------------------------
(root
2023-11-10 20:44:03 -05:00
(statement
(expression
(function_call
(expression
(identifier))
2023-11-10 20:44:03 -05:00
(expression
(value
(string)))
(expression
(value
(integer)))
(expression
(value
(map
(identifier)
(statement
(expression
(value
(integer))))
(identifier)
(statement
(expression
(value
(integer)))))))))))