cpp
[m6w6/ext-psi] / src / types / cpp_exp.c
index ee7a30b255fef8bfa27cccb76e584455e778c003..2371ae25f1047fabd6f260b97de3e522688ebc49 100644 (file)
@@ -54,6 +54,7 @@ struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data)
                break;
        case PSI_T_ENDIF:
        case PSI_T_ELSE:
+       case PSI_T_ONCE:
                break;
        default:
                assert(0);
@@ -94,6 +95,7 @@ void psi_cpp_exp_free(struct psi_cpp_exp **exp_ptr)
                        break;
                case PSI_T_ENDIF:
                case PSI_T_ELSE:
+               case PSI_T_ONCE:
                        break;
                default:
                        assert(0);
@@ -133,6 +135,7 @@ void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp)
                break;
        case PSI_T_ENDIF:
        case PSI_T_ELSE:
+       case PSI_T_ONCE:
                break;
        default:
                assert(0);
@@ -305,6 +308,17 @@ void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_d
                        }
                }
                break;
+       case PSI_T_IMPORT:
+               if (!cpp->skip) {
+                       if (!psi_cpp_include(cpp, exp->data.tok->text, PSI_CPP_INCLUDE_ONCE)) {
+                               D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text);
+                       }
+               }
+       case PSI_T_ONCE:
+               if (!cpp->skip) {
+                       zend_hash_str_add_empty_element(&cpp->once, exp->token->file, strlen(exp->token->file));
+               }
+               break;
        default:
                assert(0);
                break;