From 40f7b4c7398db2b832b71e3dfb8afb53116fad51 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Wed, 27 Sep 2023 13:31:14 +0200 Subject: Switched to sedlex instead of ocamllex --- test/qsp_parser_test.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/qsp_parser_test.ml') diff --git a/test/qsp_parser_test.ml b/test/qsp_parser_test.ml index b833fe5..6bf249d 100644 --- a/test/qsp_parser_test.ml +++ b/test/qsp_parser_test.ml @@ -7,10 +7,16 @@ let _position = (Lexing.dummy_pos, Lexing.dummy_pos) type 'a location = 'a * 'a Ast.statement list [@@deriving eq, show] +(** Run the parser with the given expression and return the result *) let parse : string -> T.pos location = fun content -> - let lexing = Lexing.from_string content in - Parser.main Qparser.Lexer.token lexing + let lexing = Sedlexing.Latin1.from_string content in + + match Qparser.Analyzer.parse (module Qsp_syntax.Tree) lexing with + | Ok e -> e + | Error e -> + let msg = Format.asprintf "%a" Qparser.Analyzer.format_error e in + raise (Failure msg) let location : T.pos location Alcotest.testable = let equal = equal_location (fun _ _ -> true) in -- cgit v1.2.3