diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/settings/settings_lexer.l | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/libstrongswan/settings/settings_lexer.l b/src/libstrongswan/settings/settings_lexer.l index d9af1531d..c6546f464 100644 --- a/src/libstrongswan/settings/settings_lexer.l +++ b/src/libstrongswan/settings/settings_lexer.l @@ -82,12 +82,22 @@ static void include_files(parser_helper_t *ctx); <inc>{ /* we allow all characters except #, } and spaces, they can be escaped */ <<EOF>> | - \n|#.*\n | - [\t ] { - if (*yytext && yytext[strlen(yytext) - 1] == '\n') - { /* put the newline back to fix the line numbers */ - unput('\n'); - yy_set_bol(0); + [#}\n\t ] { + if (*yytext) + { + switch (yytext[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); yy_pop_state(yyscanner); |