minor fixes

This commit is contained in:
ProgramSnail 2023-07-22 19:50:12 +03:00
parent df305457c8
commit 4a553f24fb
2 changed files with 5 additions and 5 deletions

View file

@ -12,7 +12,7 @@ statement: import
;
import: ('::' | 'import') (SIMPLE_NAME_IDENTIFIER | '_') ('=' SIMPLE_NAME_IDENTIFIER)?
(':' (SIMPLE_TYPE_IDENTIFIER | SIMPLE_NAME_IDENTIFIER | TYPECLASS_IDENTIFIER | ('(' OPERATOR ')'))*)? ';'
(':' (SIMPLE_TYPE_IDENTIFIER | SIMPLE_NAME_IDENTIFIER | TYPECLASS_IDENTIFIER | ('(' OPERATOR ')'))+)? ';'
;
constraint: '?' expression ;
@ -30,7 +30,7 @@ function_definition: (definietion_info)? (ANNOTATION_INFO)* (constraint ';')*
;
typeclass_definition: (DEFINITION_INFO)? (ANNOTATION_INFO)*
TYPECLASS_IDENTIFIER (seq(':', (TYPECLASS_IDENTIFIER)*))?
TYPECLASS_IDENTIFIER (seq(':', (TYPECLASS_IDENTIFIER)+))?
(('{' (function_definition)* '}') | ';')
;

View file

@ -27,7 +27,7 @@ module.exports = grammar({
choice('::', 'import'),
field('name', choice($.simple_name_identifier, '_')),
optional(seq('=', field('module', $.simple_name_identifier))),
optional(seq(':', repeat(choice(
optional(seq(':', repeat1(choice(
$.simple_type_identifier,
$.simple_name_identifier,
$.typeclass_identifier,
@ -72,8 +72,8 @@ module.exports = grammar({
typeclass_definition: $ => seq(
optional($.definition_info),
repeat($.annotation_info),
$.typeclass_identifier,
optional(seq(':', repeat($.typeclass_identifier))),
field('name', $.typeclass_identifier),
optional(seq(':', repeat1($.typeclass_identifier))),
choice(seq('{', repeat($.function_definition), '}'), ';'),
),