From 44c6391361b29c652c7b4c2a1831ce5e20a4f0c8 Mon Sep 17 00:00:00 2001 From: liweijian Date: Wed, 18 Oct 2023 14:50:05 +0800 Subject: [PATCH] update syntax --- parser.mly | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/parser.mly b/parser.mly index 8cbd0e92..aff6c762 100644 --- a/parser.mly +++ b/parser.mly @@ -41,8 +41,7 @@ open Parser_util %token DOT_IDENT %token DOT_INT -%token COLONCOLON_UIDENT -%token COLONCOLON_LIDENT +%token COLONCOLON "::" %token COLON ":" %token COLONEQUAL ":=" %token SEMI @@ -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" @@ -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: @@ -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_ ")" {}