Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: comma parentheticals #4782

Draft
wants to merge 1 commit into
base: gabor/parentheticals
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/md/examples/grammar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
'break' <id> <exp_nullary>?
'continue' <id>
'debug' <exp_nest>
'(' <exp_post>? 'with' <list(<exp_field>, ';')> ')' <exp_nest>
'(' <exp_post>? 'with' <list(<exp_field>, ',')> ')' <exp_nest>
'if' <exp_nullary> <exp_nest>
'if' <exp_nullary> <exp_nest> 'else' <exp_nest>
'try' <exp_nest> <catch>
Expand Down
2 changes: 1 addition & 1 deletion src/mo_frontend/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 2 additions & 0 deletions src/mo_frontend/printers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ let string_of_symbol = function
| X (N N_exp_plain) -> "<exp_plain>"
| X (N N_exp_post_bl_) -> "<exp_post(bl)>"
| X (N N_exp_post_ob_) -> "<exp_post(ob)>"
| X (N N_option_exp_post_ob__) -> "<exp_post(ob)>?"
| X (N N_exp_un_bl_) -> "<exp_un(bl)>"
| X (N N_exp_un_ob_) -> "<exp_un(ob)>"
| X (N N_func_body) -> "<func_body>"
Expand Down Expand Up @@ -199,6 +200,7 @@ let string_of_symbol = function
| X (N N_seplist_dec_field_semicolon_) -> "seplist(<dec_field>,<semicolon>)"
| X (N N_seplist_exp_ob__COMMA_) -> "seplist(<exp(ob)>,,)"
| X (N N_seplist_exp_field_semicolon_) -> "seplist(<exp_field>,<semicolon>)"
| X (N N_seplist_exp_field_COMMA_) -> "seplist(<exp_field>,,)"
| X (N N_seplist1_exp_field_semicolon_) -> "seplist1(<exp_field>,<semicolon>)"
| X (N N_separated_nonempty_list_AND_exp_post_ob__) -> "seplist+(<exp_post(ob)>,and)"
| X (N N_seplist_exp_nonvar_ob__COMMA_) -> "seplist(<exp_nonvar(ob)>,,)"
Expand Down
1 change: 1 addition & 0 deletions test/fail/ok/syntax5.tc.ok
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ syntax5.mo:3.1: syntax error [M0001], unexpected end of input, expected one of t
<unop> <exp_bin(ob)>
<inst> <exp_nullary(ob)>
[ <exp(ob)> ]
with seplist(<exp_field>,,) ) <exp_nest>
2 changes: 1 addition & 1 deletion test/run-drun/par.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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!" });
Expand Down
Loading