Define YYERROR_VERBOSE for bison and rename COMMENT -> '\n'

This results in better error messages when there is a parse error
This commit is contained in:
Todd C. Miller
2020-08-10 13:59:31 -06:00
parent 6702f4ac4e
commit 8a97150f56
5 changed files with 409 additions and 403 deletions

View File

@@ -9,7 +9,7 @@
#define YY_INT_ALIGNED short int
/* $OpenBSD: flex.skl,v 1.16 2017/05/02 19:16:19 millert Exp $ */
/* $OpenBSD: flex.skl,v 1.17 2020/08/06 17:23:29 deraadt Exp $ */
/* A lexical scanner generated by flex */
@@ -2458,11 +2458,13 @@ YY_DECL
if ( ! (yy_start) )
(yy_start) = 1; /* first start state */
if ( ! sudoersin )
if ( ! sudoersin ) {
sudoersin = stdin;
}
if ( ! sudoersout )
if ( ! sudoersout ) {
sudoersout = stdout;
}
if ( ! YY_CURRENT_BUFFER ) {
sudoersensure_buffer_stack ();
@@ -2471,12 +2473,12 @@ YY_DECL
}
sudoers_load_buffer_state( );
}
}
{
#line 119 "toke.l"
#line 2474 "toke.c"
#line 2476 "toke.c"
while ( 1 ) /* loops until end-of-file is reached */
{
@@ -3392,7 +3394,7 @@ YY_RULE_SETUP
sudolineno++;
continued = false;
LEXTRACE("\n");
LEXRETURN(COMMENT);
LEXRETURN('\n');
} /* return newline */
YY_BREAK
case 74:
@@ -3428,7 +3430,7 @@ YY_RULE_SETUP
LEXRETURN(ERROR);
}
LEXTRACE("#\n");
LEXRETURN(COMMENT);
LEXRETURN('\n');
} /* comment, not uid/gid */
YY_BREAK
case 77:
@@ -3463,7 +3465,7 @@ YY_RULE_SETUP
#line 796 "toke.l"
ECHO;
YY_BREAK
#line 3461 "toke.c"
#line 3463 "toke.c"
case YY_END_OF_BUFFER:
{