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

160 lines
4.5 KiB
Plaintext

================================================================================
Array expression
================================================================================
array_of_int[42] of 0
--------------------------------------------------------------------------------
(source_file
(array_expression
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: (identifier)
size: (integer_literal)
init: (array_expression
type: (identifier)
size: (integer_literal)
init: (integer_literal))))
================================================================================
Record expression
================================================================================
record_type { a = 12, b = "27" }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (identifier)
field: (identifier)
init: (integer_literal)
field: (identifier)
init: (string_literal)))
================================================================================
Record expression single field
================================================================================
record_type { a = 12 }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (identifier)
field: (identifier)
init: (integer_literal)))
================================================================================
Record expression no fields
================================================================================
record_type {}
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (identifier)))
================================================================================
Record expression trailing comma
================================================================================
record_type { a = 12, }
--------------------------------------------------------------------------------
(source_file
(record_expression
type: (identifier)
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)
right: (assignment_expression
left: (array_value
array: (identifier)
index: (integer_literal))
right: (record_value
record: (identifier)
field: (identifier)))))