operator definitions

This commit is contained in:
ProgramSnail 2023-07-19 10:25:24 +03:00
parent 3b4be40ef7
commit 2e0dfdf3fa
3 changed files with 15 additions and 4 deletions

View file

@ -53,7 +53,7 @@ module.exports = grammar({
repeat($.annotation_info),
repeat(seq($.constraint, ';')),
/*optional(seq(*/optional(choice(choice('%', 'let'), choice('$', 'var')))/*, '.'))*/,
field('name', $.simple_name_identifier),
choice(field('name', $.simple_name_identifier), seq('(', field('name', $.operator), ')')),
repeat(seq(
optional($.annotation_identifier),
$.argument_name_identifier,
@ -248,9 +248,7 @@ module.exports = grammar({
_type_identifier: $ => choice($.argument_type_identifier, $.simple_type_identifier),
placeholder: $ => '_',
simple_name_identifier: $ => token(seq(repeat(seq(/[a-z_][a-z0-9_]*/, '.')), /[a-z_][a-z0-9_]*/)),
simple_type_identifier: $ => /([a-z_][a-z0-9_]*\.)*[A-Z][a-zA-Z0-9]*/,
typeclass_identifier: $ => /([a-z_][a-z0-9_]*\.)*#[A-Z][a-zA-Z0-9]*/,
argument_name_identifier: $ => /'[a-z_][a-z0-9_]*/,