Removed dependency of ParserLog upon EvalOpt.

This commit is contained in:
Christian Rinderknecht 2019-04-13 20:20:06 +02:00
parent c7503e3285
commit cc4138fc2c
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
3 changed files with 13 additions and 2 deletions

View File

@ -6,8 +6,12 @@ open! Region
let printf = Printf.printf let printf = Printf.printf
let offsets = ref true
let mode = ref `Point
let compact (region: Region.t) = let compact (region: Region.t) =
region#compact ~offsets:EvalOpt.offsets EvalOpt.mode region#compact ~offsets:!offsets !mode
let print_nsepseq : let print_nsepseq :
string -> ('a -> unit) -> ('a, Region.t) nsepseq -> unit = string -> ('a -> unit) -> ('a, Region.t) nsepseq -> unit =

View File

@ -1,5 +1,8 @@
(* Printing the AST *) (* Printing the AST *)
val offsets : bool ref
val mode : [`Byte | `Point] ref
val print_tokens : AST.t -> unit val print_tokens : AST.t -> unit
val print_path : AST.path -> unit val print_path : AST.path -> unit

View File

@ -91,7 +91,11 @@ let () =
try try
let ast = Parser.contract tokeniser buffer in let ast = Parser.contract tokeniser buffer in
if Utils.String.Set.mem "ast" EvalOpt.verbose if Utils.String.Set.mem "ast" EvalOpt.verbose
then ParserLog.print_tokens ast then begin
ParserLog.offsets := EvalOpt.offsets;
ParserLog.mode := EvalOpt.mode;
ParserLog.print_tokens ast
end
with with
Lexer.Error err -> Lexer.Error err ->
close_all (); close_all ();