settings: Properly match } and # in include statements
Found due to %option nodefault. A match for } was actually missing and # was not properly matched if it was part of an include statement on the last line of a file that did not end with a newline.
This commit is contained in:
@@ -82,12 +82,22 @@ static void include_files(parser_helper_t *ctx);
|
|||||||
<inc>{
|
<inc>{
|
||||||
/* we allow all characters except #, } and spaces, they can be escaped */
|
/* we allow all characters except #, } and spaces, they can be escaped */
|
||||||
<<EOF>> |
|
<<EOF>> |
|
||||||
\n|#.*\n |
|
[#}\n\t ] {
|
||||||
[\t ] {
|
if (*yytext)
|
||||||
if (*yytext && yytext[strlen(yytext) - 1] == '\n')
|
{
|
||||||
{ /* put the newline back to fix the line numbers */
|
switch (yytext[0])
|
||||||
unput('\n');
|
{
|
||||||
yy_set_bol(0);
|
case '\n':
|
||||||
|
/* put the newline back to fix the line numbers */
|
||||||
|
unput('\n');
|
||||||
|
yy_set_bol(0);
|
||||||
|
break;
|
||||||
|
case '#':
|
||||||
|
case '}':
|
||||||
|
/* these are parsed outside of this start condition */
|
||||||
|
unput(yytext[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
include_files(yyextra);
|
include_files(yyextra);
|
||||||
yy_pop_state(yyscanner);
|
yy_pop_state(yyscanner);
|
||||||
|
|||||||
Reference in New Issue
Block a user