{
pptoken *token = (pptoken*)mem_a(sizeof(pptoken));
token->token = ftepp->token;
+#if 0
if (token->token == TOKEN_WHITE)
token->value = util_strdup(" ");
else
+#else
token->value = util_strdup(ftepp_tokval(ftepp));
+#endif
memcpy(&token->constval, &ftepp->lex->tok.constval, sizeof(token->constval));
return token;
}
case TOKEN_TYPENAME:
case TOKEN_KEYWORD:
macro = ftepp_macro_find(ftepp, ftepp_tokval(ftepp));
- if (macro) {
+ if (macro && ftepp->output_on) {
if (ftepp_warn(ftepp, WARN_PREPROCESSOR, "redefining `%s`", ftepp_tokval(ftepp)))
return false;
ftepp_macro_delete(ftepp, ftepp_tokval(ftepp));
if (!ftepp_define_body(ftepp, macro))
return false;
- vec_push(ftepp->macros, macro);
+ if (ftepp->output_on)
+ vec_push(ftepp->macros, macro);
+ else {
+ ppmacro_delete(macro);
+ }
return true;
}
if (!ftepp_skipspace(ftepp))
return false;
- switch (ftepp->token) {
- case TOKEN_IDENT:
- case TOKEN_TYPENAME:
- case TOKEN_KEYWORD:
- ftepp_macro_delete(ftepp, ftepp_tokval(ftepp));
- break;
- default:
- ftepp_error(ftepp, "expected macro name");
- return false;
+ if (ftepp->output_on) {
+ switch (ftepp->token) {
+ case TOKEN_IDENT:
+ case TOKEN_TYPENAME:
+ case TOKEN_KEYWORD:
+ ftepp_macro_delete(ftepp, ftepp_tokval(ftepp));
+ break;
+ default:
+ ftepp_error(ftepp, "expected macro name");
+ return false;
+ }
}
(void)ftepp_next(ftepp);
if (lex->flags.preprocessing) {
haswhite = true;
+ /*
lex_tokench(lex, '/');
lex_tokench(lex, '/');
+ */
+ lex_tokench(lex, ' ');
+ lex_tokench(lex, ' ');
}
while (ch != EOF && ch != '\n') {
if (lex->flags.preprocessing)
- lex_tokench(lex, ch);
+ lex_tokench(lex, ' '); /* ch); */
ch = lex_getch(lex);
}
if (lex->flags.preprocessing) {
/* multiline comment */
if (lex->flags.preprocessing) {
haswhite = true;
+ /*
lex_tokench(lex, '/');
lex_tokench(lex, '*');
+ */
+ lex_tokench(lex, ' ');
+ lex_tokench(lex, ' ');
}
while (ch != EOF)
ch = lex_getch(lex);
if (ch == '/') {
if (lex->flags.preprocessing) {
+ /*
lex_tokench(lex, '*');
lex_tokench(lex, '/');
+ */
+ lex_tokench(lex, ' ');
+ lex_tokench(lex, ' ');
}
break;
}
}
if (lex->flags.preprocessing) {
- lex_tokench(lex, ch);
+ lex_tokench(lex, ' '); /* ch); */
}
}
ch = ' '; /* cause TRUE in the isspace check */
break;
}
/* we reached a linemerge */
+ lex_tokench(lex, '\n');
continue;
}