aboutsummaryrefslogtreecommitdiff
path: root/lib/qparser/lexer.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/qparser/lexer.ml')
-rw-r--r--lib/qparser/lexer.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/qparser/lexer.ml b/lib/qparser/lexer.ml
index 30d151b..4e9aa27 100644
--- a/lib/qparser/lexer.ml
+++ b/lib/qparser/lexer.ml
@@ -188,16 +188,20 @@ let rec parse_token : Lexbuf.t -> token =
| '#', Star space, location ->
(* Extract the location name *)
let ident = Lexbuf.content buffer in
- let () =
+ let ident_name =
match Str.string_match location_name ident 0 with
- | false -> ()
- | true -> Sedlexing.set_filename lexbuf (Str.matched_group 1 ident)
+ | false -> ident
+ | true -> Str.matched_group 1 ident
in
(* Restart the line number (new location here) *)
Lexbuf.start buffer;
- LOCATION_START ident
+ LOCATION_START
+ (fun () ->
+ Sedlexing.set_filename lexbuf ident_name;
+ (* Restart the line number (new location here) *)
+ ident_name)
| '_', Star space, eol, Star space ->
(* The _ character can be used to break lines *)
parse_token buffer