From 8b0bd300b9af0b5e4d0ff195b0622da2aa8fe129 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 28 Nov 2024 17:42:02 +0100 Subject: [PATCH] review feedback: use comma as separator --- doc/md/examples/grammar.txt | 2 +- src/mo_frontend/parser.mly | 2 +- src/mo_frontend/printers.ml | 2 ++ test/fail/ok/syntax5.tc.ok | 1 + test/run-drun/par.mo | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/md/examples/grammar.txt b/doc/md/examples/grammar.txt index d8d695f8bea..f4d3cd95f6c 100644 --- a/doc/md/examples/grammar.txt +++ b/doc/md/examples/grammar.txt @@ -214,7 +214,7 @@ 'break' ? 'continue' 'debug' - '(' ? 'with' , ';')> ')' + '(' ? 'with' , ',')> ')' 'if' 'if' 'else' 'try' diff --git a/src/mo_frontend/parser.mly b/src/mo_frontend/parser.mly index 1853ff5d23d..c55a82c9514 100644 --- a/src/mo_frontend/parser.mly +++ b/src/mo_frontend/parser.mly @@ -703,7 +703,7 @@ exp_un(B) : BreakE(x', TupE([]) @? no_region) @? at $sloc } | DEBUG e=exp_nest { DebugE(e) @? at $sloc } - | LPAR base=exp_post(ob)? WITH fs=seplist(exp_field, semicolon) RPAR e=exp_nest (* parentheticals to qualify message sends *) + | LPAR base=exp_post(ob)? WITH fs=seplist(exp_field, COMMA) RPAR e=exp_nest (* parentheticals to qualify message sends *) { match e.it with | CallE (base0_opt, f, is, args) -> { e with it = CallE (Some (ObjE (Option.(to_list base0_opt @ to_list base), fs) @? e.at), f, is, args) } diff --git a/src/mo_frontend/printers.ml b/src/mo_frontend/printers.ml index 7105e3e7cc7..f62f6617d4e 100644 --- a/src/mo_frontend/printers.ml +++ b/src/mo_frontend/printers.ml @@ -167,6 +167,7 @@ let string_of_symbol = function | X (N N_exp_plain) -> "" | X (N N_exp_post_bl_) -> "" | X (N N_exp_post_ob_) -> "" + | X (N N_option_exp_post_ob__) -> "?" | X (N N_exp_un_bl_) -> "" | X (N N_exp_un_ob_) -> "" | X (N N_func_body) -> "" @@ -199,6 +200,7 @@ let string_of_symbol = function | X (N N_seplist_dec_field_semicolon_) -> "seplist(,)" | X (N N_seplist_exp_ob__COMMA_) -> "seplist(,,)" | X (N N_seplist_exp_field_semicolon_) -> "seplist(,)" + | X (N N_seplist_exp_field_COMMA_) -> "seplist(,,)" | X (N N_seplist1_exp_field_semicolon_) -> "seplist1(,)" | X (N N_separated_nonempty_list_AND_exp_post_ob__) -> "seplist+(,and)" | X (N N_seplist_exp_nonvar_ob__COMMA_) -> "seplist(,,)" diff --git a/test/fail/ok/syntax5.tc.ok b/test/fail/ok/syntax5.tc.ok index a882586ced3..727c77d6936 100644 --- a/test/fail/ok/syntax5.tc.ok +++ b/test/fail/ok/syntax5.tc.ok @@ -18,3 +18,4 @@ syntax5.mo:3.1: syntax error [M0001], unexpected end of input, expected one of t [ ] + with seplist(,,) ) diff --git a/test/run-drun/par.mo b/test/run-drun/par.mo index 6338980062b..4b0425d0940 100644 --- a/test/run-drun/par.mo +++ b/test/run-drun/par.mo @@ -49,7 +49,7 @@ actor A { assert 3 == (await (with cycles = 101) closA()); assert 3 == (await (with cycles = 102) closB()); - await (with yeah = 8; timeout = 55; cycles = 1000) + await (with yeah = 8, timeout = 55, cycles = 1000) foo(func() : async () = async { assert message == "Hi!" }); await (with cycles = 5000) bar(func() : async () = async { assert message == "Hi!" });