|
@@ -1074,7 +1074,10 @@ and block acc s =
|
|
block acc s
|
|
block acc s
|
|
|
|
|
|
and parse_block_elt = parser
|
|
and parse_block_elt = parser
|
|
- | [< '(Kwd Var,p1); vl = psep Comma parse_var_decl; p2 = semicolon >] -> (EVars vl,punion p1 p2)
|
|
|
|
|
|
+ | [< '(Kwd Var,p1); vl = psep Comma parse_var_decl; p2 = semicolon >] ->
|
|
|
|
+ (match vl with
|
|
|
|
+ | [] -> error (Custom "Missing variable identifier") p1
|
|
|
|
+ | _ -> (EVars vl,punion p1 p2))
|
|
| [< e = expr; _ = semicolon >] -> e
|
|
| [< e = expr; _ = semicolon >] -> e
|
|
|
|
|
|
and parse_obj_decl = parser
|
|
and parse_obj_decl = parser
|
|
@@ -1218,7 +1221,10 @@ and expr = parser
|
|
Display e -> display (EWhile (cond,e,NormalWhile),punion p1 (pos e)))
|
|
Display e -> display (EWhile (cond,e,NormalWhile),punion p1 (pos e)))
|
|
| [< '(Kwd Do,p1); e = expr; '(Kwd While,_); '(POpen,_); cond = expr; '(PClose,_); s >] -> (EWhile (cond,e,DoWhile),punion p1 (pos e))
|
|
| [< '(Kwd Do,p1); e = expr; '(Kwd While,_); '(POpen,_); cond = expr; '(PClose,_); s >] -> (EWhile (cond,e,DoWhile),punion p1 (pos e))
|
|
| [< '(Kwd Switch,p1); e = expr; '(BrOpen,_); cases , def = parse_switch_cases e []; '(BrClose,p2); s >] -> (ESwitch (e,cases,def),punion p1 p2)
|
|
| [< '(Kwd Switch,p1); e = expr; '(BrOpen,_); cases , def = parse_switch_cases e []; '(BrClose,p2); s >] -> (ESwitch (e,cases,def),punion p1 p2)
|
|
- | [< '(Kwd Try,p1); e = expr; cl = plist (parse_catch e); s >] -> (ETry (e,cl),p1)
|
|
|
|
|
|
+ | [< '(Kwd Try,p1); e = expr; cl = plist (parse_catch e); >] ->
|
|
|
|
+ (match cl with
|
|
|
|
+ | [] -> error (Custom "Expected catch after try") p1
|
|
|
|
+ | _ -> (ETry (e,cl),p1))
|
|
| [< '(IntInterval i,p1); e2 = expr >] -> make_binop OpInterval (EConst (Int i),p1) e2
|
|
| [< '(IntInterval i,p1); e2 = expr >] -> make_binop OpInterval (EConst (Int i),p1) e2
|
|
| [< '(Kwd Untyped,p1); e = expr >] -> (EUntyped e,punion p1 (pos e))
|
|
| [< '(Kwd Untyped,p1); e = expr >] -> (EUntyped e,punion p1 (pos e))
|
|
| [< '(Dollar v,p); s >] -> expr_next (EConst (Ident ("$"^v)),p) s
|
|
| [< '(Dollar v,p); s >] -> expr_next (EConst (Ident ("$"^v)),p) s
|