Skip to content

Commit

Permalink
update syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijian committed Oct 18, 2023
1 parent be19947 commit 44c6391
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ open Parser_util

%token <string>DOT_IDENT
%token <int>DOT_INT
%token <string>COLONCOLON_UIDENT
%token <string>COLONCOLON_LIDENT
%token COLONCOLON "::"
%token COLON ":"
%token COLONEQUAL ":="
%token SEMI
Expand Down Expand Up @@ -136,7 +135,7 @@ optional_type_parameters:
optional_type_arguments:
| params = option(delimited("[" ,non_empty_list_commas(type_), "]")) {}
fun_binder:
| type_name=qual_ident_ty func_name=COLONCOLON_LIDENT {}
| type_name=qual_ident_ty "::" func_name=LIDENT {}
| binder {}
fun_header:
pub=ioption("pub") "func"
Expand Down Expand Up @@ -249,7 +248,7 @@ infix_expr:
%inline constr:
| name = UIDENT {}
/* TODO: two tokens or one token here? */
| type_name=qual_ident_ty constr_name=COLONCOLON_UIDENT
| type_name=qual_ident_ty "::" constr_name=UIDENT
{}

simple_expr:
Expand All @@ -268,7 +267,7 @@ simple_expr:
| obj=simple_expr "[" index=expr "]" {}
| self=simple_expr meth=DOT_IDENT "(" args=list_commas(expr) ")" {}
| record=simple_expr accessor=accessor %prec prec_field {}
| type_name=qual_ident_ty method_name=COLONCOLON_LIDENT {}
| type_name=qual_ident_ty "::" method_name=LIDENT {}
| "(" bs=list_commas(expr) ")" {}
| "(" expr ":" type_ ")"
{}
Expand Down

0 comments on commit 44c6391

Please sign in to comment.