diff options
author | Jan Maria Matejka <mq@ucw.cz> | 2018-09-11 16:55:41 +0200 |
---|---|---|
committer | Jan Maria Matejka <mq@ucw.cz> | 2018-09-11 17:35:13 +0200 |
commit | d50b0bc437f5ffd0d2c9f843217f8ed098c8d675 (patch) | |
tree | ececf183d0de0293c59b4db8b2cdaeb48a71085f /conf/cf-lex.l | |
parent | 89b0af3978caf15e1478922a8d9d4f7e38145a61 (diff) |
Conf: Show the line:char position where the syntax error happens
Diffstat (limited to 'conf/cf-lex.l')
-rw-r--r-- | conf/cf-lex.l | 6 |
1 files changed, 4 insertions, 2 deletions
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: { <COMMENT>\n { ifs->lino++; + ifs->chno = 0; BEGIN(INITIAL); } <COMMENT>. <CCOMM>\*\/ BEGIN(INITIAL); -<CCOMM>\n ifs->lino++; +<CCOMM>\n ifs->lino++; ifs->chno = 0; <CCOMM>\/\* cf_error("Comment nesting not supported"); <CCOMM><<EOF>> cf_error("Unterminated comment"); <CCOMM>. |