aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/qsp_parser.ml23
1 files changed, 7 insertions, 16 deletions
diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml
index 1d846e0..3980ad5 100644
--- a/bin/qsp_parser.ml
+++ b/bin/qsp_parser.ml
@@ -41,12 +41,9 @@ let filter_report : filters -> Report.t list -> Report.t -> Report.t list =
(** Read the source file until getting a report (the whole location has been
read properly), or until the first syntax error.
*)
-let parse_location :
- (module Qparser.Lexer.Encoding) -> Sedlexing.lexbuf -> filters -> unit =
- fun encoding lexbuf filters ->
- let result =
- Qparser.Analyzer.parse (module Qsp_syntax.Type_of) encoding lexbuf
- in
+let parse_location : Sedlexing.lexbuf -> filters -> unit =
+ fun lexbuf filters ->
+ let result = Qparser.Analyzer.parse (module Qsp_syntax.Type_of) lexbuf in
let result =
Result.map
@@ -78,23 +75,17 @@ let () =
let ic = Stdlib.open_in file_name in
(*let lexer = Lexing.from_channel ~with_positions:true ic in*)
- let lexer, mod_ =
+ let lexer =
match Filename.extension file_name with
- | ".qsrc" ->
- ( Sedlexing.Utf8.from_channel ic,
- (module Sedlexing.Utf8 : Qparser.Lexer.Encoding) )
- | ".txt" ->
- ( Sedlexing.Utf16.from_channel ic (Some Little_endian),
- (module struct
- let lexeme lexbuf = Sedlexing.Utf8.lexeme lexbuf
- end : Qparser.Lexer.Encoding) )
+ | ".qsrc" -> Sedlexing.Utf8.from_channel ic
+ | ".txt" -> Sedlexing.Utf16.from_channel ic (Some Little_endian)
| _ -> raise (Failure "unknown extension")
in
let () =
try
while true do
- parse_location mod_ lexer filters
+ parse_location lexer filters
done
with Qparser.Lexer.EOF -> ()
in