aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parsing/lexer.ml44
-rw-r--r--parsing/lexer.mli1
2 files changed, 5 insertions, 0 deletions
diff --git a/parsing/lexer.ml4 b/parsing/lexer.ml4
index 61f28469c9..95bd57ce67 100644
--- a/parsing/lexer.ml4
+++ b/parsing/lexer.ml4
@@ -487,6 +487,9 @@ let loct_add loct i loc =
end;
!loct.(i) <- Some loc
+let current_location_function =
+ ref (fun _ -> failwith "No location function is set")
+
let func cs =
let loct = loct_create () in
let ts =
@@ -495,6 +498,7 @@ let func cs =
let (tok, loc) = next_token cs in
loct_add loct i loc; Some tok)
in
+ current_location_function := loct_func loct;
(ts, loct_func loct)
(* Names of tokens, for this lexer, used in Grammar error messages *)
diff --git a/parsing/lexer.mli b/parsing/lexer.mli
index a32ca355d4..f1a97a163e 100644
--- a/parsing/lexer.mli
+++ b/parsing/lexer.mli
@@ -23,6 +23,7 @@ val add_keyword : string -> unit
val is_keyword : string -> bool
val func : char Stream.t -> (string * string) Stream.t * (int -> int * int)
+val current_location_function : (int -> int * int) ref
val check_ident : string -> unit
val check_special_token : string -> unit