Fix the "line counting" on parser errors

This commit is contained in:
Felipe Zimmerle
2015-09-29 12:22:23 -03:00
parent 70e2a4b379
commit d084ab5f2d
3 changed files with 10 additions and 9 deletions

View File

@@ -340,12 +340,12 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
}
[\n]+ { driver.loc.back()->lines(yyleng); driver.loc.back()->step(); }
#[ \t]*SecRule[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
#[ \t]*SecAction[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
#.* { /* comment, just ignore. */ }
. { driver.error (*driver.loc.back(), "invalid character", yytext); }
#[ \t]*SecRule[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
#[ \t]*SecAction[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
#.* { driver.loc.back()->step(); /* comment, just ignore. */ }
. { driver.error (*driver.loc.back(), "invalid character", yytext); throw yy::seclang_parser::syntax_error(*driver.loc.back(), yytext); }
<<EOF>> {
if (driver.ref.size() > 0) {
driver.ref.pop_back();