aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-02-19 18:06:10 +0100
committerEmilio Jesus Gallego Arias2019-02-19 18:06:10 +0100
commit6e3850ce5092d5cb432ef917ae6ee79225089f6a (patch)
treeb3a007d270b5824ed4a3c98e16acbc675b60aa35
parent5f26707db8b78e580801aa7565539fc2a8f0a76a (diff)
parent12da73e84897fa17a6ab00e251022339ae36a806 (diff)
Merge PR #9604: Gramlib: Fixes #9358 (ensuring that requested locations are effectively computed at lexing time)
Reviewed-by: ejgallego
-rw-r--r--gramlib/grammar.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/gramlib/grammar.ml b/gramlib/grammar.ml
index e313f2e648..f46ddffd6e 100644
--- a/gramlib/grammar.ml
+++ b/gramlib/grammar.ml
@@ -1368,6 +1368,9 @@ let parse_parsable entry p =
let get_loc () =
try
let cnt = Stream.count ts in
+ (* Ensure that the token at location cnt has been peeked so that
+ the location function knows about it *)
+ let _ = Stream.peek ts in
let loc = fun_loc cnt in
if !token_count - 1 <= cnt then loc
else Loc.merge loc (fun_loc (!token_count - 1))