|
@@ -1287,7 +1287,14 @@ and expr = parser
|
|
|
end
|
|
|
| [< '(Kwd Switch,p1); e = secure_expr; s >] ->
|
|
|
begin match s with parser
|
|
|
- | [< '(BrOpen,_); cases , def = parse_switch_cases e []; '(BrClose,p2); s >] -> (ESwitch (e,cases,def),punion p1 p2)
|
|
|
+ | [< '(BrOpen,_); cases , def = parse_switch_cases e [] >] ->
|
|
|
+ let p2 = match s with parser
|
|
|
+ | [< '(BrClose,p2) >] -> p2
|
|
|
+ | [< >] ->
|
|
|
+ (* Ignore missing } if we are resuming and "guess" the last position. *)
|
|
|
+ syntax_error (Expected ["}"]) s (pos (next_token s))
|
|
|
+ in
|
|
|
+ (ESwitch (e,cases,def),punion p1 p2)
|
|
|
| [< >] ->
|
|
|
syntax_error (Expected ["{"]) s (ESwitch(e,[],None),punion p1 (pos e))
|
|
|
end
|