Blame lwt-fix-ocaml-camlp4-19.patch
|
|
cc9d336 |
From d3226b70359cb8618d95d1105c908aa591f1b144 Mon Sep 17 00:00:00 2001
|
|
|
cc9d336 |
From: Jeremie Dimino <jdimino@janestreet.com>
|
|
|
cc9d336 |
Date: Thu, 17 Apr 2014 10:55:43 +0100
|
|
|
cc9d336 |
Subject: [PATCH] Fix ocaml/camlp4#19
|
|
|
cc9d336 |
|
|
|
cc9d336 |
---
|
|
|
cc9d336 |
syntax/pa_optcomp.ml | 10 ++++++++--
|
|
|
cc9d336 |
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
cc9d336 |
|
|
|
cc9d336 |
diff --git a/syntax/pa_optcomp.ml b/syntax/pa_optcomp.ml
|
|
|
cc9d336 |
index 583248f..4b112d2 100644
|
|
|
cc9d336 |
--- a/syntax/pa_optcomp.ml
|
|
|
cc9d336 |
+++ b/syntax/pa_optcomp.ml
|
|
|
cc9d336 |
@@ -334,13 +334,19 @@ let parse_ident stream =
|
|
|
cc9d336 |
let parse_expr stream =
|
|
|
cc9d336 |
(* Lists of opened brackets *)
|
|
|
cc9d336 |
let opened_brackets = ref [] in
|
|
|
cc9d336 |
+ let eoi = ref None in
|
|
|
cc9d336 |
|
|
|
cc9d336 |
(* Return the next token of [stream] until all opened parentheses
|
|
|
cc9d336 |
have been closed and a newline is reached *)
|
|
|
cc9d336 |
let rec next_token _ =
|
|
|
cc9d336 |
- Some(match Stream.next stream, !opened_brackets with
|
|
|
cc9d336 |
+ match !eoi with
|
|
|
cc9d336 |
+ | Some _ as x -> x
|
|
|
cc9d336 |
+ | None ->
|
|
|
cc9d336 |
+ Some(match Stream.next stream, !opened_brackets with
|
|
|
cc9d336 |
| (NEWLINE, loc), [] ->
|
|
|
cc9d336 |
- EOI, loc
|
|
|
cc9d336 |
+ let x = EOI, loc in
|
|
|
cc9d336 |
+ eoi := Some x;
|
|
|
cc9d336 |
+ x
|
|
|
cc9d336 |
|
|
|
cc9d336 |
| (KEYWORD("(" | "[" | "{" as b), _) as x, l ->
|
|
|
cc9d336 |
opened_brackets := b :: l;
|
|
|
cc9d336 |
--
|
|
|
cc9d336 |
1.9.3
|
|
|
cc9d336 |
|