Browse Source

[lexer] add debug printer for lexer_file

Simon Krajewski 2 years ago
parent
commit
f9ac6ae9e7
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/syntax/lexer.ml

+ 4 - 0
src/syntax/lexer.ml

@@ -73,6 +73,10 @@ let make_file file =
 		llastindex = 0;
 	}
 
+let print_file file =
+	let sllines = String.concat ";" (List.map (fun (i1,i2) -> Printf.sprintf "(%i,%i)" i1 i2) file.llines) in
+	let slalines = String.concat ";" (Array.to_list (Array.map (fun (i1,i2) -> Printf.sprintf "(%i,%i)" i1 i2) file.lalines)) in
+	Printf.sprintf "lfile: %s\nlline: %i\nlmaxline: %i\nllines: [%s]\nlalines: [%s]\nllast: %i\nllastindex: %i" file.lfile file.lline file.lmaxline sllines slalines file.llast file.llastindex
 
 let cur = ref (make_file "")