From d50b0bc437f5ffd0d2c9f843217f8ed098c8d675 Mon Sep 17 00:00:00 2001 From: Jan Maria Matejka Date: Tue, 11 Sep 2018 16:55:41 +0200 Subject: Conf: Show the line:char position where the syntax error happens --- conf/cf-lex.l | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'conf/cf-lex.l') diff --git a/conf/cf-lex.l b/conf/cf-lex.l index c3154b36..9bbb3660 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -100,6 +100,7 @@ static struct include_file_stack *ifs_head; #define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->fd); #define YY_NO_UNPUT #define YY_FATAL_ERROR(msg) cf_error(msg) +#define YY_USER_ACTION ifs->chno += yyleng; ifs->toklen = yyleng; static void cf_include(char *arg, int alen); static int check_eof(void); @@ -313,7 +314,7 @@ else: { {WHITE}+ -\n ifs->lino++; +\n ifs->lino++; ifs->chno = 0; # BEGIN(COMMENT); @@ -323,13 +324,14 @@ else: { \n { ifs->lino++; + ifs->chno = 0; BEGIN(INITIAL); } . \*\/ BEGIN(INITIAL); -\n ifs->lino++; +\n ifs->lino++; ifs->chno = 0; \/\* cf_error("Comment nesting not supported"); <> cf_error("Unterminated comment"); . -- cgit v1.2.3