X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.c;h=cf576d59a9b8aa42d1c184ac9ac0e156dd5443dd;hp=e747ed269babd32eb53b8da7d949b30700c76f40;hb=b1c7c64ca1d1d9dc79a59c0f612bd07e7a997a60;hpb=a7ac1c0a3c855321f21682c127a4b707de33a303 diff --git a/src/parser.c b/src/parser.c index e747ed2..cf576d5 100644 --- a/src/parser.c +++ b/src/parser.c @@ -145,16 +145,11 @@ static inline zend_string *macro_to_constant(struct psi_parser *parser, size_t i = 0; struct psi_token *tok; - smart_str_append_printf(&str, "\nconst psi\\%s = ", name->val); + smart_str_append_printf(&str, "const psi\\%s = ", name->val); if (scope->macro->exp) { - impl_val res = {0}; - token_t typ = psi_num_exp_exec(scope->macro->exp, &res, NULL, scope->cpp); + struct psi_dump dump = {{.hn = &str}, .fun = (psi_dump_cb) smart_str_append_printf}; - switch (typ) { - CASE_IMPLVAL_NUM_PRINTF(smart_str_append_printf, &str, res); - default: - assert(0); - } + psi_num_exp_dump(&dump, scope->macro->exp); } else while (psi_plist_get(scope->macro->tokens, i++, &tok)) { if (tok->type == PSI_T_QUOTED_STRING) { smart_str_appendc(&str, '"'); @@ -179,7 +174,7 @@ void psi_parser_postprocess(struct psi_parser *P) scope.cpp = P->preproc; flags = P->flags; - //P->flags |= PSI_SILENT; + P->flags |= PSI_SILENT; ZEND_HASH_FOREACH_STR_KEY_PTR(&P->preproc->defs, name, scope.macro) {