76 |
if (nl) yycolumn = countCharsPastLastNewLine(yytext); \ |
if (nl) yycolumn = countCharsPastLastNewLine(yytext); \ |
77 |
} |
} |
78 |
|
|
79 |
|
// if compiled for debugging, throw an exception instead of exiting on fatal |
80 |
|
// lexer errors (so the debugger may pause with the appropriate back trace) |
81 |
|
#if DEBUG |
82 |
|
# include <stdexcept> |
83 |
|
# define YY_FATAL_ERROR(msg) throw std::runtime_error(msg) |
84 |
|
#endif |
85 |
|
|
86 |
%} |
%} |
87 |
|
|
88 |
/* use Flex's built-in support for line numbers |
/* use Flex's built-in support for line numbers |
183 |
*/ |
*/ |
184 |
|
|
185 |
<*>"USE_CODE_IF"[ \t]*"(" { |
<*>"USE_CODE_IF"[ \t]*"(" { |
186 |
//printf("USE_CODE_IF\n"); |
//printf("{%s}\n", yytext); |
187 |
yy_push_state(PREPROC_IF, yyscanner); |
yy_push_state(PREPROC_IF, yyscanner); |
188 |
} |
} |
189 |
|
<PREPROC_BODY_EAT>"USE_CODE_IF"[ \t]*"("{ID}")" { |
190 |
|
//printf("[EAT{%s}\n", yytext); |
191 |
|
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
192 |
|
} |
193 |
<*>"USE_CODE_IF_NOT"[ \t]*"(" { |
<*>"USE_CODE_IF_NOT"[ \t]*"(" { |
194 |
//printf("USE_CODE_IF_NOT\n"); |
//printf("USE_CODE_IF_NOT\n"); |
195 |
yy_push_state(PREPROC_IF_NOT, yyscanner); |
yy_push_state(PREPROC_IF_NOT, yyscanner); |
196 |
} |
} |
197 |
|
<PREPROC_BODY_EAT>"USE_CODE_IF_NOT"[ \t]*"("{ID}")" { |
198 |
|
//printf("[EAT{%s}\n", yytext); |
199 |
|
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
200 |
|
} |
201 |
<PREPROC_IF>{ID} { |
<PREPROC_IF>{ID} { |
202 |
//printf("preproc use code if '%s'\n", yytext); |
//printf("preproc use code if '%s'\n", yytext); |
203 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
219 |
yy_push_state(PREPROC_BODY_USE, yyscanner); |
yy_push_state(PREPROC_BODY_USE, yyscanner); |
220 |
} |
} |
221 |
<PREPROC_PRE_BODY_EAT>[ \t]*")" { |
<PREPROC_PRE_BODY_EAT>[ \t]*")" { |
222 |
//printf("PREPROCESSOR EAT : \n"); |
//printf("PREPROCESSOR EAT : {%s}\n", yytext); |
223 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
224 |
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
225 |
} |
} |
226 |
<*>.*"END_USE_CODE" { |
<PREPROC_BODY_EAT,PREPROC_BODY_USE>"END_USE_CODE" { |
227 |
//printf("-->END_USE_CODE\n"); |
//printf("-->END_USE_CODE\n"); |
228 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
229 |
} |
} |
230 |
<PREPROC_BODY_EAT>[ \t\r\n]* { /* eat up code block filtered out by preprocessor */ |
<PREPROC_BODY_EAT>[ \t\r\n]* { /* eat up code block filtered out by preprocessor */ |
231 |
|
//printf("PREPROCESSOR EAT2 : {%s}\n", yytext); |
232 |
processLocation(); |
processLocation(); |
233 |
} |
} |
234 |
<PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */ |
<PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */ |
235 |
|
//printf("PREPROCESSOR EAT3 : {%s}\n", yytext); |
236 |
yyextra->addPreprocessorComment(yylloc->first_line, yylloc->last_line, |
yyextra->addPreprocessorComment(yylloc->first_line, yylloc->last_line, |
237 |
yylloc->first_column+1, yylloc->last_column+1); |
yylloc->first_column+1, yylloc->last_column+1); |
238 |
} |
} |