diff --git a/src/ligo/ligo_parser/ParserLog.ml b/src/ligo/ligo_parser/ParserLog.ml index 0f61abc13..ad7085e20 100644 --- a/src/ligo/ligo_parser/ParserLog.ml +++ b/src/ligo/ligo_parser/ParserLog.ml @@ -6,8 +6,12 @@ open! Region let printf = Printf.printf +let offsets = ref true + +let mode = ref `Point + let compact (region: Region.t) = - region#compact ~offsets:EvalOpt.offsets EvalOpt.mode + region#compact ~offsets:!offsets !mode let print_nsepseq : string -> ('a -> unit) -> ('a, Region.t) nsepseq -> unit = diff --git a/src/ligo/ligo_parser/ParserLog.mli b/src/ligo/ligo_parser/ParserLog.mli index 788be425f..9211b081a 100644 --- a/src/ligo/ligo_parser/ParserLog.mli +++ b/src/ligo/ligo_parser/ParserLog.mli @@ -1,5 +1,8 @@ (* Printing the AST *) +val offsets : bool ref +val mode : [`Byte | `Point] ref + val print_tokens : AST.t -> unit val print_path : AST.path -> unit diff --git a/src/ligo/ligo_parser/ParserMain.ml b/src/ligo/ligo_parser/ParserMain.ml index 9d685691e..6259c0a86 100644 --- a/src/ligo/ligo_parser/ParserMain.ml +++ b/src/ligo/ligo_parser/ParserMain.ml @@ -91,7 +91,11 @@ let () = try let ast = Parser.contract tokeniser buffer in 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 Lexer.Error err -> close_all ();