summaryrefslogtreecommitdiff
path: root/src/parser.mly
diff options
context:
space:
mode:
authorBrian Campbell2017-12-06 17:10:30 +0000
committerBrian Campbell2017-12-06 17:36:59 +0000
commit87a8f3f491c5c5bb65cb7490e10da2c5c9676f17 (patch)
tree75008cb1201e26c374c26993c30852781edeb4dd /src/parser.mly
parent98ddcaf12bd2ff2c42f2c20fcb145af806a7e6d8 (diff)
Add parsing for guards in function clauses
Breaks parsing ambiguities by removing = as an identifier in the old parser and requiring parentheses for some expressions in the new parser
Diffstat (limited to 'src/parser.mly')
-rw-r--r--src/parser.mly14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/parser.mly b/src/parser.mly
index 58f5f1e1..755c2cc7 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -869,8 +869,6 @@ eq_exp:
| at_exp
{ $1 }
/* XXX check for consistency */
- | eq_exp Eq at_exp
- { eloc (E_app_infix($1,Id_aux(Id($2), locn 2 2), $3)) }
| eq_exp EqEq at_exp
{ eloc (E_app_infix($1,Id_aux(Id($2), locn 2 2), $3)) }
| eq_exp ExclEq at_exp
@@ -907,8 +905,6 @@ eq_exp:
eq_right_atomic_exp:
| at_right_atomic_exp
{ $1 }
- | eq_exp Eq at_right_atomic_exp
- { eloc (E_app_infix($1,Id_aux(Id($2), locn 2 2), $3)) }
| eq_exp EqEq at_right_atomic_exp
{ eloc (E_app_infix($1,Id_aux(Id($2), locn 2 2), $3)) }
| eq_exp ExclEq at_right_atomic_exp
@@ -1018,9 +1014,15 @@ letbind:
| Let_ atomic_pat Eq exp
{ lbloc (LB_val($2,$4)) }
+patsexp_funcl:
+ | atomic_pat Eq exp
+ { peloc (Pat_exp($1,$3)) }
+ | atomic_pat When exp Eq exp
+ { peloc (Pat_when ($1, $3, $5)) }
+
funcl:
- | id atomic_pat Eq exp
- { funclloc (FCL_Funcl($1,$2,$4)) }
+ | id patsexp_funcl
+ { funclloc (FCL_Funcl($1,$2)) }
funcl_ands:
| funcl