+ 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;
+ }
+
+ /* don't expand itself */
+// if (zend_string_equals(macro->token->text, target->text)) {
+// PSI_DEBUG_PRINT(cpp->parser, "PSI: CPP expand ~ skipping self token\n");
+// 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));
+ }