From cb1557bd32ad84b0af278ed040aa207547e0df5d Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 2 Aug 2019 16:46:51 +0200 Subject: [lexer]: improve error message on loct_func misuse --- parsing/cLexer.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'parsing/cLexer.ml') diff --git a/parsing/cLexer.ml b/parsing/cLexer.ml index a27d6450b7..de23f05a9e 100644 --- a/parsing/cLexer.ml +++ b/parsing/cLexer.ml @@ -785,12 +785,14 @@ let next_token ~diff_mode loc s = (* Location table system for creating tables associating a token count to its location in a char stream (the source) *) -let locerr () = invalid_arg "Lexer: location function" +let locerr i = + let m = "Lexer: location function called on token "^string_of_int i in + invalid_arg m let loct_create () = Hashtbl.create 207 let loct_func loct i = - try Hashtbl.find loct i with Not_found -> locerr () + try Hashtbl.find loct i with Not_found -> locerr i let loct_add loct i loc = Hashtbl.add loct i loc -- cgit v1.2.3