101 |
/* Preprocessor statement: SET_CONDITION(name) */ |
/* Preprocessor statement: SET_CONDITION(name) */ |
102 |
|
|
103 |
<*>"SET_CONDITION"[ \t]*"(" { |
<*>"SET_CONDITION"[ \t]*"(" { |
104 |
printf("SET_CONDITION\n"); |
//printf("SET_CONDITION\n"); |
105 |
yy_push_state(PREPROC_SET_COND, yyscanner); |
yy_push_state(PREPROC_SET_COND, yyscanner); |
106 |
} |
} |
107 |
<PREPROC_SET_COND>{ID} { |
<PREPROC_SET_COND>{ID} { |
108 |
printf("preproc set condition '%s'\n", yytext); |
//printf("preproc set condition '%s'\n", yytext); |
109 |
bool success = yyextra->setPreprocessorCondition(yytext); |
bool success = yyextra->setPreprocessorCondition(yytext); |
110 |
if (!success) { |
if (!success) { |
111 |
SCANNER_WRN((String("Preprocessor: Condition '") + |
SCANNER_WRN((String("Preprocessor: Condition '") + |
113 |
} |
} |
114 |
} |
} |
115 |
<PREPROC_SET_COND>[ \t]*")" { |
<PREPROC_SET_COND>[ \t]*")" { |
116 |
printf("End of PREPROC_SET_COND\n"); |
//printf("End of PREPROC_SET_COND\n"); |
117 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
118 |
} |
} |
119 |
|
|
121 |
/* Preprocessor statement: RESET_CONDITION(name) */ |
/* Preprocessor statement: RESET_CONDITION(name) */ |
122 |
|
|
123 |
<*>"RESET_CONDITION"[ \t]*"(" { |
<*>"RESET_CONDITION"[ \t]*"(" { |
124 |
printf("RESET_CONDITION\n"); |
//printf("RESET_CONDITION\n"); |
125 |
yy_push_state(PREPROC_RESET_COND, yyscanner); |
yy_push_state(PREPROC_RESET_COND, yyscanner); |
126 |
} |
} |
127 |
<PREPROC_RESET_COND>{ID} { |
<PREPROC_RESET_COND>{ID} { |
128 |
printf("preproc reset condition '%s'\n", yytext); |
//printf("preproc reset condition '%s'\n", yytext); |
129 |
bool success = yyextra->resetPreprocessorCondition(yytext); |
bool success = yyextra->resetPreprocessorCondition(yytext); |
130 |
if (!success) { |
if (!success) { |
131 |
SCANNER_ERR((String("Preprocessor: could not reset condition '") + |
SCANNER_ERR((String("Preprocessor: could not reset condition '") + |
133 |
} |
} |
134 |
} |
} |
135 |
<PREPROC_RESET_COND>[ \t]*")" { |
<PREPROC_RESET_COND>[ \t]*")" { |
136 |
printf("End of RESET_CONDITION\n"); |
//printf("End of RESET_CONDITION\n"); |
137 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
138 |
} |
} |
139 |
|
|
152 |
*/ |
*/ |
153 |
|
|
154 |
<*>"USE_CODE_IF"[ \t]*"(" { |
<*>"USE_CODE_IF"[ \t]*"(" { |
155 |
printf("USE_CODE_IF\n"); |
//printf("USE_CODE_IF\n"); |
156 |
yy_push_state(PREPROC_IF, yyscanner); |
yy_push_state(PREPROC_IF, yyscanner); |
157 |
} |
} |
158 |
<*>"USE_CODE_IF_NOT"[ \t]*"(" { |
<*>"USE_CODE_IF_NOT"[ \t]*"(" { |
159 |
printf("USE_CODE_IF_NOT\n"); |
//printf("USE_CODE_IF_NOT\n"); |
160 |
yy_push_state(PREPROC_IF_NOT, yyscanner); |
yy_push_state(PREPROC_IF_NOT, yyscanner); |
161 |
} |
} |
162 |
<PREPROC_IF>{ID} { |
<PREPROC_IF>{ID} { |
163 |
printf("preproc use code if '%s'\n", yytext); |
//printf("preproc use code if '%s'\n", yytext); |
164 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
165 |
if (yyextra->isPreprocessorConditionSet(yytext)) |
if (yyextra->isPreprocessorConditionSet(yytext)) |
166 |
yy_push_state(PREPROC_PRE_BODY_USE, yyscanner); |
yy_push_state(PREPROC_PRE_BODY_USE, yyscanner); |
168 |
yy_push_state(PREPROC_PRE_BODY_EAT, yyscanner); |
yy_push_state(PREPROC_PRE_BODY_EAT, yyscanner); |
169 |
} |
} |
170 |
<PREPROC_IF_NOT>{ID} { |
<PREPROC_IF_NOT>{ID} { |
171 |
printf("preproc use code if not '%s'\n", yytext); |
//printf("preproc use code if not '%s'\n", yytext); |
172 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
173 |
if (!yyextra->isPreprocessorConditionSet(yytext)) |
if (!yyextra->isPreprocessorConditionSet(yytext)) |
174 |
yy_push_state(PREPROC_PRE_BODY_USE, yyscanner); |
yy_push_state(PREPROC_PRE_BODY_USE, yyscanner); |
180 |
yy_push_state(PREPROC_BODY_USE, yyscanner); |
yy_push_state(PREPROC_BODY_USE, yyscanner); |
181 |
} |
} |
182 |
<PREPROC_PRE_BODY_EAT>[ \t]*")" { |
<PREPROC_PRE_BODY_EAT>[ \t]*")" { |
183 |
|
//printf("PREPROCESSOR EAT : \n"); |
184 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
185 |
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
yy_push_state(PREPROC_BODY_EAT, yyscanner); |
186 |
} |
} |
187 |
<*>.*"END_USE_CODE" { |
<*>.*"END_USE_CODE" { |
188 |
printf("END_USE_CODE\n"); |
//printf("-->END_USE_CODE\n"); |
189 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
190 |
} |
} |
191 |
|
<PREPROC_BODY_EAT>[ \t\r\n]* /* eat up code block filtered out by preprocessor */ |
192 |
|
<PREPROC_BODY_EAT>.* /* eat up code block filtered out by preprocessor */ |
193 |
|
|
194 |
|
|
195 |
/* Language keywords */ |
/* Language keywords */ |