From 12da73e84897fa17a6ab00e251022339ae36a806 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Tue, 19 Feb 2019 15:04:30 +0100 Subject: Gramlib: Fixes #9358 (ensuring that the loc function has something to compute). --- gramlib/grammar.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gramlib') 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)) -- cgit v1.2.3