Skip to content
Snippets Groups Projects
Commit ad1ef0d8 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

macroprocessor: fix unhandled case of nested ifdef/ifndef statements. closes #1587

parent b94ff64c
No related branches found
No related tags found
No related merge requests found
...@@ -305,6 +305,16 @@ CONT \\\\ ...@@ -305,6 +305,16 @@ CONT \\\\
then_body_tmp.append(yytext); then_body_tmp.append(yytext);
yylloc->step(); yylloc->step();
} }
<THEN_BODY>^{SPC}*@#{SPC}*ifdef({SPC}|{CONT}) {
nested_if_nb++;
then_body_tmp.append(yytext);
yylloc->step();
}
<THEN_BODY>^{SPC}*@#{SPC}*ifndef({SPC}|{CONT}) {
nested_if_nb++;
then_body_tmp.append(yytext);
yylloc->step();
}
<THEN_BODY>. { then_body_tmp.append(yytext); yylloc->step(); } <THEN_BODY>. { then_body_tmp.append(yytext); yylloc->step(); }
<THEN_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif or file does not end with a new line (unexpected end of file)"); } <THEN_BODY><<EOF>> { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif or file does not end with a new line (unexpected end of file)"); }
<THEN_BODY>^{SPC}*@#{SPC}*else{SPC}*(\/\/.*)?{EOL} { <THEN_BODY>^{SPC}*@#{SPC}*else{SPC}*(\/\/.*)?{EOL} {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment