+ psi_plist_free(tokens);
+ ++cpp->expanded;
+ }
+
+ psi_cpp_tokiter_del_cur(cpp, true);
+ return true;
+}
+
+static inline int psi_cpp_tokiter_expand_cmp(struct psi_token *t,
+ struct psi_cpp_macro_decl *m)
+{
+ if (psi_plist_count(m->tokens) == 1) {
+ struct psi_token *r;
+
+ if (psi_plist_get(m->tokens, 0, &r) && r->text) {
+ return !zend_string_equals(r->text, t->text);
+ }
+ }
+ return -1;
+}
+
+static inline bool psi_cpp_tokiter_expand_decl(struct psi_cpp *cpp,
+ struct psi_token *target, struct psi_cpp_macro_decl *macro)
+{
+ if (!macro) {
+ return false;
+ }
+
+ if (macro->sig) {
+ return psi_cpp_tokiter_expand_call(cpp, target, macro);
+ } else if (psi_cpp_tokiter_expand_cmp(target, macro)) {
+ return psi_cpp_tokiter_expand_def(cpp, target, macro);
+ } else {
+ return false;
+ }
+}
+
+bool psi_cpp_tokiter_expand(struct psi_cpp *cpp)
+{
+ struct psi_token *current;
+
+ if (!psi_cpp_tokiter_valid(cpp)) {
+ return false;
+ }
+
+ current = psi_cpp_tokiter_current(cpp);
+ if (!current) {
+ return false;
+ }
+#if PSI_CPP_DEBUG
+ PSI_DEBUG_PRINT(cpp->parser, "PSI: CPP expand < ");
+ PSI_DEBUG_DUMP(cpp->parser, psi_token_dump, current);
+#endif
+
+ if (psi_builtin_exists(current->text)) {
+ return psi_cpp_tokiter_expand_builtin(cpp, current,
+ psi_builtin_get(current->text));
+ } else {
+ return psi_cpp_tokiter_expand_decl(cpp, current,
+ zend_hash_find_ptr(&cpp->defs, current->text));