From 6e154a0a8ba95126f105d1532e3ba4fb7666f1f9 Mon Sep 17 00:00:00 2001 From: liweijian Date: Fri, 20 Oct 2023 14:30:05 +0800 Subject: [PATCH] update syntax --- parser.mly | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parser.mly b/parser.mly index aff6c762..974c3d81 100644 --- a/parser.mly +++ b/parser.mly @@ -138,7 +138,7 @@ fun_binder: | type_name=qual_ident_ty "::" func_name=LIDENT {} | binder {} fun_header: - pub=ioption("pub") "func" + pub=ioption("pub") toplevel_fn fun_binder=fun_binder /* TODO: move the quants before self */ quants=optional_type_parameters @@ -146,7 +146,8 @@ fun_header: ts=option("->" t=type_{}) {} - +%inline toplevel_fn: "func" + | "fn" {} %inline block_expr: "{" ls=list_semis_rev(statement_expr) "}" {} val_header : pub=ioption("pub") "let" binder=binder t=opt_annot {}