Replace '_typed_field' by more specific grammar

Instead of re-using a common rule, inline its definition and use
'_field_identifier' where appropriate.

This is useful for more accurate high-lighting.
This commit is contained in:
Bruno BELANYI 2022-06-03 10:40:14 +02:00
parent 5d37bf7bd1
commit da494122ea
5 changed files with 1715 additions and 1573 deletions

View file

@ -32,10 +32,10 @@ type record = { a: int, b: str }
(type_declaration
name: (identifier)
value: (record_type
name: (identifier)
type: (identifier)
name: (identifier)
type: (identifier))))
name: (field_identifier)
type: (type_identifier)
name: (field_identifier)
type: (type_identifier))))
================================================================================
Record type declaration single field
@ -49,8 +49,8 @@ type record = { a: int }
(type_declaration
name: (identifier)
value: (record_type
name: (identifier)
type: (identifier))))
name: (field_identifier)
type: (type_identifier))))
================================================================================
Record type declaration no fields
@ -77,8 +77,8 @@ type record = { a: int, }
(type_declaration
name: (identifier)
value: (record_type
name: (identifier)
type: (identifier)
name: (field_identifier)
type: (type_identifier)
(ERROR))))
================================================================================
@ -125,9 +125,9 @@ function func(a: int, b: int) = "string"
name: (identifier)
parameters: (parameters
name: (identifier)
type: (identifier)
type: (type_identifier)
name: (identifier)
type: (identifier))
type: (type_identifier))
body: (string_literal)))
================================================================================
@ -143,9 +143,9 @@ function func(a: int, b: int) : string = "string"
name: (identifier)
parameters: (parameters
name: (identifier)
type: (identifier)
type: (type_identifier)
name: (identifier)
type: (identifier))
type: (type_identifier))
return_type: (type_identifier)
body: (string_literal)))
@ -162,7 +162,7 @@ function func(a: int) = "string"
name: (identifier)
parameters: (parameters
name: (identifier)
type: (identifier))
type: (type_identifier))
body: (string_literal)))
================================================================================