tree-sitter-tiger/test/corpus/expressions.txt

162 lines
4.6 KiB
Plaintext

================================================================================
Array expression
================================================================================
array_of_int[42] of 0
--------------------------------------------------------------------------------
(source_file
(array_expression
type: (type_identifier)
size: (integer_literal)
init: (integer_literal)))
================================================================================
Array associativity
================================================================================
array_of_array_of_int[12] of array_of_int[27] of 0
--------------------------------------------------------------------------------
(source_file
(array_expression
type: (type_identifier)
size: (integer_literal)
init: (array_expression
type: (type_identifier)
size: (integer_literal)
init: (integer_literal))))
================================================================================
Record expression
================================================================================
record_type { a = 12, b = "27" }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (type_identifier)
field: (field_identifier)
init: (integer_literal)
field: (field_identifier)
init: (string_literal)))
================================================================================
Record expression single field
================================================================================
record_type { a = 12 }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (type_identifier)
field: (field_identifier)
init: (integer_literal)))
================================================================================
Record expression no fields
================================================================================
record_type {}
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (type_identifier)))
================================================================================
Record expression trailing comma
================================================================================
record_type { a = 12, }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (type_identifier)
field: (field_identifier)
init: (integer_literal)
(ERROR)))
================================================================================
Function call
================================================================================
f(12, "27")
--------------------------------------------------------------------------------
(source_file
(function_call
function: (identifier)
arguments: (integer_literal)
arguments: (string_literal)))
================================================================================
Function call single argument
================================================================================
f(12)
--------------------------------------------------------------------------------
(source_file
(function_call
function: (identifier)
arguments: (integer_literal)))
================================================================================
Function call no arguments
================================================================================
f()
--------------------------------------------------------------------------------
(source_file
(function_call
function: (identifier)))
================================================================================
Function call trailing comma
================================================================================
f(12,)
--------------------------------------------------------------------------------
(source_file
(function_call
function: (identifier)
arguments: (integer_literal)
(ERROR)))
================================================================================
Assignments
================================================================================
a := array[12] := record.field
--------------------------------------------------------------------------------
(source_file
(assignment_expression
left: (identifier)
(operator)
right: (assignment_expression
left: (array_value
array: (identifier)
index: (integer_literal))
(operator)
right: (record_value
record: (identifier)
field: (field_identifier)))))