Skip to content

Commit

Permalink
WIP: surface syntax for parentheticals
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Jul 10, 2024
1 parent 7feb398 commit d4811e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/md/examples/grammar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
'break' <id> <exp_nullary>?
'continue' <id>
'debug' <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
6 changes: 6 additions & 0 deletions src/mo_frontend/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,12 @@ 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 *)
{ match e.it with
| CallE _
| AsyncE (Type.Fut, _, _) -> e
| _ -> { e with it = ObjE(Option.to_list base, fs) }
}
| IF b=exp_nullary(ob) e1=exp_nest %prec IF_NO_ELSE
{ IfE(b, e1, TupE([]) @? at $sloc) @? at $sloc }
| IF b=exp_nullary(ob) e1=exp_nest ELSE e2=exp_nest
Expand Down

0 comments on commit d4811e2

Please sign in to comment.