+ exp = psi_plist_init(NULL);
+ while (psi_plist_get(tokens, i++, &tok)) {
+ struct psi_token *new_tok;
+
+ if (tok->type == PSI_T_EOL) {
+ continue;
+ }
+ if (tok->type == PSI_T_HASH) {
+ stringify = true;
+ continue;
+ }
+ if (tok->type == PSI_T_CPP_PASTE) {
+ paste = true;
+ continue;
+ }
+
+ if (paste && psi_plist_count(exp)) {
+ struct psi_token *old_tok;
+ struct psi_parser_input *toscan;
+
+ psi_plist_pop(exp, &old_tok);
+ new_tok = psi_token_cat(NULL, 2, old_tok, tok);
+
+ /* reclassify token(s) */
+ if ((toscan = psi_parser_open_string(cpp->parser, new_tok->text->val, new_tok->text->len))) {
+ struct psi_plist *scanned;
+
+ scanned = psi_parser_scan(cpp->parser, toscan);
+ if (psi_plist_count(scanned)) {
+ size_t i = 0;
+ struct psi_token *tmp_tok;
+
+ exp = psi_plist_add_r(exp, psi_plist_count(scanned), psi_plist_eles(scanned));
+
+ /* fix meta info */
+ while (psi_plist_get(scanned, i++, &tmp_tok)) {
+ zend_string_release(tmp_tok->file);
+ tmp_tok->file = zend_string_copy(new_tok->file);
+ tmp_tok->line = new_tok->line;
+ tmp_tok->col = new_tok->col;
+ }
+
+ psi_token_free(&new_tok);
+ psi_plist_top(scanned, &new_tok);
+ } else {
+ exp = psi_plist_add(exp, &new_tok);
+ }
+ if (scanned) {
+ free(scanned);
+ }
+ psi_parser_input_free(&toscan);
+ } else {
+ exp = psi_plist_add(exp, &new_tok);
+ }
+
+ psi_token_free(&old_tok);
+ } else {
+ new_tok = psi_token_init(stringify ? PSI_T_QUOTED_STRING : tok->type,
+ tok->text->val, tok->text->len, target->col, target->line,
+ target->file ?: zend_empty_string);
+
+ exp = psi_plist_add(exp, &new_tok);
+ }