Skip to content

Commit

Permalink
make it 'import' <pat_nullary> '='? <text>
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Jan 27, 2022
1 parent 91c3708 commit 8d7fb3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 1 addition & 2 deletions doc/modules/language-guide/examples/grammar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@
<obj_body>

<imp> ::=
'import' <id>? '='? <text>
'import' '{' <list(<pat_field>, ';')> '}' '=' <text>
'import' <pat_nullary> '='? <text>

<prog> ::=
<list(<imp>, ';')> <list(<dec>, ';')>
Expand Down
7 changes: 2 additions & 5 deletions src/mo_frontend/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,8 @@ class_body :
(* Programs *)

imp :
| IMPORT xf=id_opt EQ? f=TEXT
{ let _, x = xf "import" $sloc in
let_or_exp true x (ImportE (f, ref Unresolved)) (at $sloc) }
| IMPORT LCURLY fps=seplist(pat_field, semicolon) RCURLY EQ f=TEXT
{ LetD(ObjP(fps) @! at $sloc, ImportE (f, ref Unresolved) @? at $sloc) @? at $sloc }
| IMPORT p=pat_nullary EQ? f=TEXT
{ LetD(p, ImportE(f, ref Unresolved) @? at $sloc) @? at $sloc }

start : (* dummy non-terminal to satisfy ErrorReporting.ml, that requires a non-empty parse stack *)
| (* empty *) { () }
Expand Down

0 comments on commit 8d7fb3c

Please sign in to comment.