Add 'type_identifier' alias

This is more appropriate, and actually closer to the specified grammar.
This commit is contained in:
Bruno BELANYI 2022-06-03 10:15:37 +02:00
parent 6e40691a35
commit 2be5056793
6 changed files with 140 additions and 86 deletions

View file

@ -18,7 +18,7 @@ type alias = int
(type_declaration
name: (identifier)
value: (type_alias
(identifier))))
(type_identifier))))
================================================================================
Record type declaration
@ -146,7 +146,7 @@ function func(a: int, b: int) : string = "string"
type: (identifier)
name: (identifier)
type: (identifier))
return_type: (identifier)
return_type: (type_identifier)
body: (string_literal)))
================================================================================
@ -204,7 +204,7 @@ primitive prim() : int
(primitive_declaration
name: (identifier)
parameters: (parameters)
return_type: (identifier)))
return_type: (type_identifier)))
================================================================================
Variable declaration
@ -230,7 +230,7 @@ var a : int := 27
(source_file
(variable_declaration
name: (identifier)
type: (identifier)
type: (type_identifier)
value: (integer_literal)))
================================================================================

View file

@ -8,7 +8,7 @@ array_of_int[42] of 0
(source_file
(array_expression
type: (identifier)
type: (type_identifier)
size: (integer_literal)
init: (integer_literal)))
@ -22,10 +22,10 @@ array_of_array_of_int[12] of array_of_int[27] of 0
(source_file
(array_expression
type: (identifier)
type: (type_identifier)
size: (integer_literal)
init: (array_expression
type: (identifier)
type: (type_identifier)
size: (integer_literal)
init: (integer_literal))))
@ -39,7 +39,7 @@ record_type { a = 12, b = "27" }
(source_file
(record_expression
type: (identifier)
type: (type_identifier)
field: (identifier)
init: (integer_literal)
field: (identifier)
@ -55,7 +55,7 @@ record_type { a = 12 }
(source_file
(record_expression
type: (identifier)
type: (type_identifier)
field: (identifier)
init: (integer_literal)))
@ -69,7 +69,7 @@ record_type {}
(source_file
(record_expression
type: (identifier)))
type: (type_identifier)))
================================================================================
Record expression trailing comma
@ -81,7 +81,7 @@ record_type { a = 12, }
(source_file
(record_expression
type: (identifier)
type: (type_identifier)
field: (identifier)
init: (integer_literal)
(ERROR)))