* token. */
if (parser->first_non_space_token_this_line) {
BEGIN HASH;
+ yyextra->in_define = false;
}
RETURN_TOKEN_NEVER_SKIP (HASH_TOKEN);
/* For the pre-processor directives, we return these tokens
* even when we are otherwise skipping. */
<HASH>ifdef {
- BEGIN INITIAL;
- yyextra->lexing_directive = 1;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (IFDEF);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->lexing_directive = 1;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (IFDEF);
+ }
}
<HASH>ifndef {
- BEGIN INITIAL;
- yyextra->lexing_directive = 1;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (IFNDEF);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->lexing_directive = 1;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (IFNDEF);
+ }
}
<HASH>if/[^_a-zA-Z0-9] {
- BEGIN INITIAL;
- yyextra->lexing_directive = 1;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (IF);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->lexing_directive = 1;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (IF);
+ }
}
<HASH>elif/[^_a-zA-Z0-9] {
- BEGIN INITIAL;
- yyextra->lexing_directive = 1;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (ELIF);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->lexing_directive = 1;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (ELIF);
+ }
}
<HASH>else {
- BEGIN INITIAL;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (ELSE);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (ELSE);
+ }
}
<HASH>endif {
- BEGIN INITIAL;
- yyextra->space_tokens = 0;
- RETURN_TOKEN_NEVER_SKIP (ENDIF);
+ if (!yyextra->in_define) {
+ BEGIN INITIAL;
+ yyextra->space_tokens = 0;
+ RETURN_TOKEN_NEVER_SKIP (ENDIF);
+ }
}
<HASH>error[^\r\n]* {
* and not whitespace). This will generate an error.
*/
<HASH>define{HSPACE}* {
- if (! parser->skipping) {
+ yyextra->in_define = true;
+ if (!parser->skipping) {
BEGIN DEFINE;
yyextra->space_tokens = 0;
RETURN_TOKEN (DEFINE_TOKEN);