From: Stefano Zacchiroli Date: Mon, 26 Nov 2007 15:30:52 +0000 (+0000) Subject: add dump of position information in the lexed file X-Git-Tag: make_still_working~5775 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=c540548108057140163c63c50710fda2e5c6ea8f;p=helm.git add dump of position information in the lexed file --- diff --git a/helm/software/components/content_pres/test_lexer.ml b/helm/software/components/content_pres/test_lexer.ml index b032d7f61..393017a44 100644 --- a/helm/software/components/content_pres/test_lexer.ml +++ b/helm/software/components/content_pres/test_lexer.ml @@ -44,14 +44,17 @@ let _ = prerr_endline (Printf.sprintf "Unsupported level %s" l); exit 2 in - let token_stream = - fst (lexer.Token.tok_func (Obj.magic (Ulexing.from_utf8_channel !ic))) - in + let token_stream, loc_func = + lexer.Token.tok_func (Obj.magic (Ulexing.from_utf8_channel !ic)) in Printf.printf "Lexing notation level %s\n" !level; flush stdout; + let tok_count = ref 0 in let rec dump () = let (a,b) = Stream.next token_stream in if a = "EOI" then raise Stream.Failure; - print_endline (Printf.sprintf "%s '%s'" a b); + let pos = loc_func !tok_count in + print_endline (Printf.sprintf "%s '%s' (@ %d-%d)" a b + (Ploc.first_pos pos) (Ploc.last_pos pos)); + incr tok_count; dump () in try