diff --git a/build/php5/32bits/phalcon.zep.c b/build/php5/32bits/phalcon.zep.c index 14cec92404d..44c18c7b78e 100644 --- a/build/php5/32bits/phalcon.zep.c +++ b/build/php5/32bits/phalcon.zep.c @@ -17463,947 +17463,74 @@ static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); #endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ +/* jsmin.c + 2013-03-29 -/* This file was generated automatically by Zephir do not modify it! */ - -#ifdef HAVE_CONFIG_H -#endif - - -#if PHP_VERSION_ID < 50500 -#endif - - - - - - -zend_class_entry *phalcon_di_injectionawareinterface_ce; -zend_class_entry *phalcon_events_eventsawareinterface_ce; -zend_class_entry *phalcon_validation_validatorinterface_ce; -zend_class_entry *phalcon_forms_elementinterface_ce; -zend_class_entry *phalcon_mvc_model_validatorinterface_ce; -zend_class_entry *phalcon_cache_backendinterface_ce; -zend_class_entry *phalcon_cache_frontendinterface_ce; -zend_class_entry *phalcon_mvc_model_metadatainterface_ce; -zend_class_entry *phalcon_dispatcherinterface_ce; -zend_class_entry *phalcon_annotations_adapterinterface_ce; -zend_class_entry *phalcon_db_adapterinterface_ce; -zend_class_entry *phalcon_logger_adapterinterface_ce; -zend_class_entry *phalcon_logger_formatterinterface_ce; -zend_class_entry *phalcon_session_adapterinterface_ce; -zend_class_entry *phalcon_db_dialectinterface_ce; -zend_class_entry *phalcon_mvc_entityinterface_ce; -zend_class_entry *phalcon_mvc_model_resultsetinterface_ce; -zend_class_entry *phalcon_paginator_adapterinterface_ce; -zend_class_entry *phalcon_translate_adapterinterface_ce; -zend_class_entry *phalcon_assets_filterinterface_ce; -zend_class_entry *phalcon_diinterface_ce; -zend_class_entry *phalcon_flashinterface_ce; -zend_class_entry *phalcon_image_adapterinterface_ce; -zend_class_entry *phalcon_mvc_collection_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_model_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_view_engineinterface_ce; -zend_class_entry *phalcon_mvc_viewbaseinterface_ce; -zend_class_entry *phalcon_acl_adapterinterface_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategyinterface_ce; -zend_class_entry *phalcon_mvc_model_resultinterface_ce; -zend_class_entry *phalcon_mvc_routerinterface_ce; -zend_class_entry *phalcon_translate_interpolatorinterface_ce; -zend_class_entry *phalcon_acl_resourceinterface_ce; -zend_class_entry *phalcon_acl_roleinterface_ce; -zend_class_entry *phalcon_annotations_readerinterface_ce; -zend_class_entry *phalcon_cli_dispatcherinterface_ce; -zend_class_entry *phalcon_cli_taskinterface_ce; -zend_class_entry *phalcon_cryptinterface_ce; -zend_class_entry *phalcon_db_columninterface_ce; -zend_class_entry *phalcon_db_indexinterface_ce; -zend_class_entry *phalcon_db_referenceinterface_ce; -zend_class_entry *phalcon_db_resultinterface_ce; -zend_class_entry *phalcon_di_serviceinterface_ce; -zend_class_entry *phalcon_escaperinterface_ce; -zend_class_entry *phalcon_events_eventinterface_ce; -zend_class_entry *phalcon_events_managerinterface_ce; -zend_class_entry *phalcon_filterinterface_ce; -zend_class_entry *phalcon_http_cookieinterface_ce; -zend_class_entry *phalcon_http_request_fileinterface_ce; -zend_class_entry *phalcon_http_requestinterface_ce; -zend_class_entry *phalcon_http_response_cookiesinterface_ce; -zend_class_entry *phalcon_http_response_headersinterface_ce; -zend_class_entry *phalcon_http_responseinterface_ce; -zend_class_entry *phalcon_mvc_collectioninterface_ce; -zend_class_entry *phalcon_mvc_controllerinterface_ce; -zend_class_entry *phalcon_mvc_dispatcherinterface_ce; -zend_class_entry *phalcon_mvc_micro_collectioninterface_ce; -zend_class_entry *phalcon_mvc_model_criteriainterface_ce; -zend_class_entry *phalcon_mvc_model_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_messageinterface_ce; -zend_class_entry *phalcon_mvc_model_query_builderinterface_ce; -zend_class_entry *phalcon_mvc_model_query_statusinterface_ce; -zend_class_entry *phalcon_mvc_model_queryinterface_ce; -zend_class_entry *phalcon_mvc_model_relationinterface_ce; -zend_class_entry *phalcon_mvc_model_transaction_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_transactioninterface_ce; -zend_class_entry *phalcon_mvc_modelinterface_ce; -zend_class_entry *phalcon_mvc_router_groupinterface_ce; -zend_class_entry *phalcon_mvc_router_routeinterface_ce; -zend_class_entry *phalcon_mvc_urlinterface_ce; -zend_class_entry *phalcon_mvc_viewinterface_ce; -zend_class_entry *phalcon_session_baginterface_ce; -zend_class_entry *phalcon_validation_messageinterface_ce; -zend_class_entry *phalcon_validationinterface_ce; -zend_class_entry *phalcon_acl_resourceaware_ce; -zend_class_entry *phalcon_acl_roleaware_ce; -zend_class_entry *phalcon_cli_router_routeinterface_ce; -zend_class_entry *phalcon_cli_routerinterface_ce; -zend_class_entry *phalcon_filter_userfilterinterface_ce; -zend_class_entry *phalcon_mvc_collection_managerinterface_ce; -zend_class_entry *phalcon_mvc_controller_bindmodelinterface_ce; -zend_class_entry *phalcon_mvc_micro_middlewareinterface_ce; -zend_class_entry *phalcon_mvc_moduledefinitioninterface_ce; -zend_class_entry *phalcon_exception_ce; -zend_class_entry *phalcon_validation_validator_ce; -zend_class_entry *phalcon_di_injectable_ce; -zend_class_entry *phalcon_forms_element_ce; -zend_class_entry *phalcon_mvc_model_validator_ce; -zend_class_entry *phalcon_cache_backend_ce; -zend_class_entry *phalcon_mvc_model_metadata_ce; -zend_class_entry *phalcon_annotations_adapter_ce; -zend_class_entry *phalcon_config_ce; -zend_class_entry *phalcon_db_adapter_ce; -zend_class_entry *phalcon_logger_adapter_ce; -zend_class_entry *phalcon_logger_formatter_ce; -zend_class_entry *phalcon_session_adapter_ce; -zend_class_entry *phalcon_db_adapter_pdo_ce; -zend_class_entry *phalcon_db_dialect_ce; -zend_class_entry *phalcon_mvc_model_exception_ce; -zend_class_entry *phalcon_paginator_adapter_ce; -zend_class_entry *phalcon_translate_adapter_ce; -zend_class_entry *phalcon_application_ce; -zend_class_entry *phalcon_application_exception_ce; -zend_class_entry *phalcon_assets_inline_ce; -zend_class_entry *phalcon_assets_resource_ce; -zend_class_entry *phalcon_cache_frontend_data_ce; -zend_class_entry *phalcon_di_ce; -zend_class_entry *phalcon_dispatcher_ce; -zend_class_entry *phalcon_flash_ce; -zend_class_entry *phalcon_image_adapter_ce; -zend_class_entry *phalcon_mvc_collection_behavior_ce; -zend_class_entry *phalcon_mvc_model_behavior_ce; -zend_class_entry *phalcon_mvc_model_resultset_ce; -zend_class_entry *phalcon_mvc_view_engine_ce; -zend_class_entry *phalcon_acl_adapter_ce; -zend_class_entry *phalcon_di_factorydefault_ce; -zend_class_entry *phalcon_mvc_model_transaction_exception_ce; -zend_class_entry *phalcon_mvc_router_ce; -zend_class_entry *phalcon_mvc_view_exception_ce; -zend_class_entry *phalcon_validation_combinedfieldsvalidator_ce; -zend_class_entry *phalcon_0__closure_ce; -zend_class_entry *phalcon_1__closure_ce; -zend_class_entry *phalcon_acl_adapter_memory_ce; -zend_class_entry *phalcon_acl_ce; -zend_class_entry *phalcon_acl_exception_ce; -zend_class_entry *phalcon_acl_resource_ce; -zend_class_entry *phalcon_acl_role_ce; -zend_class_entry *phalcon_annotations_adapter_apc_ce; -zend_class_entry *phalcon_annotations_adapter_files_ce; -zend_class_entry *phalcon_annotations_adapter_memory_ce; -zend_class_entry *phalcon_annotations_adapter_xcache_ce; -zend_class_entry *phalcon_annotations_annotation_ce; -zend_class_entry *phalcon_annotations_collection_ce; -zend_class_entry *phalcon_annotations_exception_ce; -zend_class_entry *phalcon_annotations_reader_ce; -zend_class_entry *phalcon_annotations_reflection_ce; -zend_class_entry *phalcon_assets_collection_ce; -zend_class_entry *phalcon_assets_exception_ce; -zend_class_entry *phalcon_assets_filters_cssmin_ce; -zend_class_entry *phalcon_assets_filters_jsmin_ce; -zend_class_entry *phalcon_assets_filters_none_ce; -zend_class_entry *phalcon_assets_inline_css_ce; -zend_class_entry *phalcon_assets_inline_js_ce; -zend_class_entry *phalcon_assets_manager_ce; -zend_class_entry *phalcon_assets_resource_css_ce; -zend_class_entry *phalcon_assets_resource_js_ce; -zend_class_entry *phalcon_cache_backend_apc_ce; -zend_class_entry *phalcon_cache_backend_file_ce; -zend_class_entry *phalcon_cache_backend_libmemcached_ce; -zend_class_entry *phalcon_cache_backend_memcache_ce; -zend_class_entry *phalcon_cache_backend_memory_ce; -zend_class_entry *phalcon_cache_backend_mongo_ce; -zend_class_entry *phalcon_cache_backend_redis_ce; -zend_class_entry *phalcon_cache_backend_xcache_ce; -zend_class_entry *phalcon_cache_exception_ce; -zend_class_entry *phalcon_cache_frontend_base64_ce; -zend_class_entry *phalcon_cache_frontend_igbinary_ce; -zend_class_entry *phalcon_cache_frontend_json_ce; -zend_class_entry *phalcon_cache_frontend_msgpack_ce; -zend_class_entry *phalcon_cache_frontend_none_ce; -zend_class_entry *phalcon_cache_frontend_output_ce; -zend_class_entry *phalcon_cache_multiple_ce; -zend_class_entry *phalcon_cli_console_ce; -zend_class_entry *phalcon_cli_console_exception_ce; -zend_class_entry *phalcon_cli_dispatcher_ce; -zend_class_entry *phalcon_cli_dispatcher_exception_ce; -zend_class_entry *phalcon_cli_router_ce; -zend_class_entry *phalcon_cli_router_exception_ce; -zend_class_entry *phalcon_cli_router_route_ce; -zend_class_entry *phalcon_cli_task_ce; -zend_class_entry *phalcon_config_adapter_ini_ce; -zend_class_entry *phalcon_config_adapter_json_ce; -zend_class_entry *phalcon_config_adapter_php_ce; -zend_class_entry *phalcon_config_adapter_yaml_ce; -zend_class_entry *phalcon_config_exception_ce; -zend_class_entry *phalcon_crypt_ce; -zend_class_entry *phalcon_crypt_exception_ce; -zend_class_entry *phalcon_db_adapter_pdo_mysql_ce; -zend_class_entry *phalcon_db_adapter_pdo_postgresql_ce; -zend_class_entry *phalcon_db_adapter_pdo_sqlite_ce; -zend_class_entry *phalcon_db_ce; -zend_class_entry *phalcon_db_column_ce; -zend_class_entry *phalcon_db_dialect_mysql_ce; -zend_class_entry *phalcon_db_dialect_postgresql_ce; -zend_class_entry *phalcon_db_dialect_sqlite_ce; -zend_class_entry *phalcon_db_exception_ce; -zend_class_entry *phalcon_db_index_ce; -zend_class_entry *phalcon_db_profiler_ce; -zend_class_entry *phalcon_db_profiler_item_ce; -zend_class_entry *phalcon_db_rawvalue_ce; -zend_class_entry *phalcon_db_reference_ce; -zend_class_entry *phalcon_db_result_pdo_ce; -zend_class_entry *phalcon_debug_ce; -zend_class_entry *phalcon_debug_dump_ce; -zend_class_entry *phalcon_debug_exception_ce; -zend_class_entry *phalcon_di_exception_ce; -zend_class_entry *phalcon_di_factorydefault_cli_ce; -zend_class_entry *phalcon_di_service_builder_ce; -zend_class_entry *phalcon_di_service_ce; -zend_class_entry *phalcon_escaper_ce; -zend_class_entry *phalcon_escaper_exception_ce; -zend_class_entry *phalcon_events_event_ce; -zend_class_entry *phalcon_events_exception_ce; -zend_class_entry *phalcon_events_manager_ce; -zend_class_entry *phalcon_filter_ce; -zend_class_entry *phalcon_filter_exception_ce; -zend_class_entry *phalcon_flash_direct_ce; -zend_class_entry *phalcon_flash_exception_ce; -zend_class_entry *phalcon_flash_session_ce; -zend_class_entry *phalcon_forms_element_check_ce; -zend_class_entry *phalcon_forms_element_date_ce; -zend_class_entry *phalcon_forms_element_email_ce; -zend_class_entry *phalcon_forms_element_file_ce; -zend_class_entry *phalcon_forms_element_hidden_ce; -zend_class_entry *phalcon_forms_element_numeric_ce; -zend_class_entry *phalcon_forms_element_password_ce; -zend_class_entry *phalcon_forms_element_radio_ce; -zend_class_entry *phalcon_forms_element_select_ce; -zend_class_entry *phalcon_forms_element_submit_ce; -zend_class_entry *phalcon_forms_element_text_ce; -zend_class_entry *phalcon_forms_element_textarea_ce; -zend_class_entry *phalcon_forms_exception_ce; -zend_class_entry *phalcon_forms_form_ce; -zend_class_entry *phalcon_forms_manager_ce; -zend_class_entry *phalcon_http_cookie_ce; -zend_class_entry *phalcon_http_cookie_exception_ce; -zend_class_entry *phalcon_http_request_ce; -zend_class_entry *phalcon_http_request_exception_ce; -zend_class_entry *phalcon_http_request_file_ce; -zend_class_entry *phalcon_http_response_ce; -zend_class_entry *phalcon_http_response_cookies_ce; -zend_class_entry *phalcon_http_response_exception_ce; -zend_class_entry *phalcon_http_response_headers_ce; -zend_class_entry *phalcon_image_adapter_gd_ce; -zend_class_entry *phalcon_image_adapter_imagick_ce; -zend_class_entry *phalcon_image_ce; -zend_class_entry *phalcon_image_exception_ce; -zend_class_entry *phalcon_kernel_ce; -zend_class_entry *phalcon_loader_ce; -zend_class_entry *phalcon_loader_exception_ce; -zend_class_entry *phalcon_logger_adapter_file_ce; -zend_class_entry *phalcon_logger_adapter_firephp_ce; -zend_class_entry *phalcon_logger_adapter_stream_ce; -zend_class_entry *phalcon_logger_adapter_syslog_ce; -zend_class_entry *phalcon_logger_ce; -zend_class_entry *phalcon_logger_exception_ce; -zend_class_entry *phalcon_logger_formatter_firephp_ce; -zend_class_entry *phalcon_logger_formatter_json_ce; -zend_class_entry *phalcon_logger_formatter_line_ce; -zend_class_entry *phalcon_logger_formatter_syslog_ce; -zend_class_entry *phalcon_logger_item_ce; -zend_class_entry *phalcon_logger_multiple_ce; -zend_class_entry *phalcon_mvc_application_ce; -zend_class_entry *phalcon_mvc_application_exception_ce; -zend_class_entry *phalcon_mvc_collection_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_collection_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_collection_ce; -zend_class_entry *phalcon_mvc_collection_document_ce; -zend_class_entry *phalcon_mvc_collection_exception_ce; -zend_class_entry *phalcon_mvc_collection_manager_ce; -zend_class_entry *phalcon_mvc_controller_ce; -zend_class_entry *phalcon_mvc_dispatcher_ce; -zend_class_entry *phalcon_mvc_dispatcher_exception_ce; -zend_class_entry *phalcon_mvc_micro_ce; -zend_class_entry *phalcon_mvc_micro_collection_ce; -zend_class_entry *phalcon_mvc_micro_exception_ce; -zend_class_entry *phalcon_mvc_micro_lazyloader_ce; -zend_class_entry *phalcon_mvc_model_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_model_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_model_ce; -zend_class_entry *phalcon_mvc_model_criteria_ce; -zend_class_entry *phalcon_mvc_model_manager_ce; -zend_class_entry *phalcon_mvc_model_message_ce; -zend_class_entry *phalcon_mvc_model_metadata_apc_ce; -zend_class_entry *phalcon_mvc_model_metadata_files_ce; -zend_class_entry *phalcon_mvc_model_metadata_libmemcached_ce; -zend_class_entry *phalcon_mvc_model_metadata_memcache_ce; -zend_class_entry *phalcon_mvc_model_metadata_memory_ce; -zend_class_entry *phalcon_mvc_model_metadata_redis_ce; -zend_class_entry *phalcon_mvc_model_metadata_session_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_annotations_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_introspection_ce; -zend_class_entry *phalcon_mvc_model_metadata_xcache_ce; -zend_class_entry *phalcon_mvc_model_query_builder_ce; -zend_class_entry *phalcon_mvc_model_query_ce; -zend_class_entry *phalcon_mvc_model_query_lang_ce; -zend_class_entry *phalcon_mvc_model_query_status_ce; -zend_class_entry *phalcon_mvc_model_relation_ce; -zend_class_entry *phalcon_mvc_model_resultset_complex_ce; -zend_class_entry *phalcon_mvc_model_resultset_simple_ce; -zend_class_entry *phalcon_mvc_model_row_ce; -zend_class_entry *phalcon_mvc_model_transaction_ce; -zend_class_entry *phalcon_mvc_model_transaction_failed_ce; -zend_class_entry *phalcon_mvc_model_transaction_manager_ce; -zend_class_entry *phalcon_mvc_model_validationfailed_ce; -zend_class_entry *phalcon_mvc_model_validator_email_ce; -zend_class_entry *phalcon_mvc_model_validator_exclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_inclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_ip_ce; -zend_class_entry *phalcon_mvc_model_validator_numericality_ce; -zend_class_entry *phalcon_mvc_model_validator_presenceof_ce; -zend_class_entry *phalcon_mvc_model_validator_regex_ce; -zend_class_entry *phalcon_mvc_model_validator_stringlength_ce; -zend_class_entry *phalcon_mvc_model_validator_uniqueness_ce; -zend_class_entry *phalcon_mvc_model_validator_url_ce; -zend_class_entry *phalcon_mvc_router_annotations_ce; -zend_class_entry *phalcon_mvc_router_exception_ce; -zend_class_entry *phalcon_mvc_router_group_ce; -zend_class_entry *phalcon_mvc_router_route_ce; -zend_class_entry *phalcon_mvc_url_ce; -zend_class_entry *phalcon_mvc_url_exception_ce; -zend_class_entry *phalcon_mvc_user_component_ce; -zend_class_entry *phalcon_mvc_user_module_ce; -zend_class_entry *phalcon_mvc_user_plugin_ce; -zend_class_entry *phalcon_mvc_view_ce; -zend_class_entry *phalcon_mvc_view_engine_php_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_compiler_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_exception_ce; -zend_class_entry *phalcon_mvc_view_simple_ce; -zend_class_entry *phalcon_paginator_adapter_model_ce; -zend_class_entry *phalcon_paginator_adapter_nativearray_ce; -zend_class_entry *phalcon_paginator_adapter_querybuilder_ce; -zend_class_entry *phalcon_paginator_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_ce; -zend_class_entry *phalcon_queue_beanstalk_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_job_ce; -zend_class_entry *phalcon_registry_ce; -zend_class_entry *phalcon_security_ce; -zend_class_entry *phalcon_security_exception_ce; -zend_class_entry *phalcon_security_random_ce; -zend_class_entry *phalcon_session_adapter_files_ce; -zend_class_entry *phalcon_session_adapter_libmemcached_ce; -zend_class_entry *phalcon_session_adapter_memcache_ce; -zend_class_entry *phalcon_session_adapter_redis_ce; -zend_class_entry *phalcon_session_bag_ce; -zend_class_entry *phalcon_session_exception_ce; -zend_class_entry *phalcon_tag_ce; -zend_class_entry *phalcon_tag_exception_ce; -zend_class_entry *phalcon_tag_select_ce; -zend_class_entry *phalcon_text_ce; -zend_class_entry *phalcon_translate_adapter_csv_ce; -zend_class_entry *phalcon_translate_adapter_gettext_ce; -zend_class_entry *phalcon_translate_adapter_nativearray_ce; -zend_class_entry *phalcon_translate_ce; -zend_class_entry *phalcon_translate_exception_ce; -zend_class_entry *phalcon_translate_interpolator_associativearray_ce; -zend_class_entry *phalcon_translate_interpolator_indexedarray_ce; -zend_class_entry *phalcon_validation_ce; -zend_class_entry *phalcon_validation_exception_ce; -zend_class_entry *phalcon_validation_message_ce; -zend_class_entry *phalcon_validation_message_group_ce; -zend_class_entry *phalcon_validation_validator_alnum_ce; -zend_class_entry *phalcon_validation_validator_alpha_ce; -zend_class_entry *phalcon_validation_validator_between_ce; -zend_class_entry *phalcon_validation_validator_confirmation_ce; -zend_class_entry *phalcon_validation_validator_creditcard_ce; -zend_class_entry *phalcon_validation_validator_date_ce; -zend_class_entry *phalcon_validation_validator_digit_ce; -zend_class_entry *phalcon_validation_validator_email_ce; -zend_class_entry *phalcon_validation_validator_exclusionin_ce; -zend_class_entry *phalcon_validation_validator_file_ce; -zend_class_entry *phalcon_validation_validator_identical_ce; -zend_class_entry *phalcon_validation_validator_inclusionin_ce; -zend_class_entry *phalcon_validation_validator_numericality_ce; -zend_class_entry *phalcon_validation_validator_presenceof_ce; -zend_class_entry *phalcon_validation_validator_regex_ce; -zend_class_entry *phalcon_validation_validator_stringlength_ce; -zend_class_entry *phalcon_validation_validator_uniqueness_ce; -zend_class_entry *phalcon_validation_validator_url_ce; -zend_class_entry *phalcon_version_ce; - -ZEND_DECLARE_MODULE_GLOBALS(phalcon) - -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("phalcon.db.escape_identifiers", "1", PHP_INI_ALL, OnUpdateBool, db.escape_identifiers, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.db.force_casting", "0", PHP_INI_ALL, OnUpdateBool, db.force_casting, zend_phalcon_globals, phalcon_globals) - - - - - STD_PHP_INI_BOOLEAN("phalcon.orm.events", "1", PHP_INI_ALL, OnUpdateBool, orm.events, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.virtual_foreign_keys", "1", PHP_INI_ALL, OnUpdateBool, orm.virtual_foreign_keys, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.column_renaming", "1", PHP_INI_ALL, OnUpdateBool, orm.column_renaming, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.not_null_validations", "1", PHP_INI_ALL, OnUpdateBool, orm.not_null_validations, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.exception_on_failed_save", "0", PHP_INI_ALL, OnUpdateBool, orm.exception_on_failed_save, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_literals", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_literals, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.late_state_binding", "0", PHP_INI_ALL, OnUpdateBool, orm.late_state_binding, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_implicit_joins", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_implicit_joins, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.cast_on_hydrate", "0", PHP_INI_ALL, OnUpdateBool, orm.cast_on_hydrate, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.ignore_unknown_columns", "0", PHP_INI_ALL, OnUpdateBool, orm.ignore_unknown_columns, zend_phalcon_globals, phalcon_globals) -PHP_INI_END() - -static PHP_MINIT_FUNCTION(phalcon) -{ -#if PHP_VERSION_ID < 50500 - char* old_lc_all = setlocale(LC_ALL, NULL); - if (old_lc_all) { - size_t len = strlen(old_lc_all); - char *tmp = calloc(len+1, 1); - if (UNEXPECTED(!tmp)) { - return FAILURE; - } - - memcpy(tmp, old_lc_all, len); - old_lc_all = tmp; - } - - setlocale(LC_ALL, "C"); -#endif - REGISTER_INI_ENTRIES(); - ZEPHIR_INIT(Phalcon_Di_InjectionAwareInterface); - ZEPHIR_INIT(Phalcon_Events_EventsAwareInterface); - ZEPHIR_INIT(Phalcon_Validation_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Forms_ElementInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Cache_BackendInterface); - ZEPHIR_INIT(Phalcon_Cache_FrontendInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaDataInterface); - ZEPHIR_INIT(Phalcon_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Annotations_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_FormatterInterface); - ZEPHIR_INIT(Phalcon_Session_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_DialectInterface); - ZEPHIR_INIT(Phalcon_Mvc_EntityInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultsetInterface); - ZEPHIR_INIT(Phalcon_Paginator_AdapterInterface); - ZEPHIR_INIT(Phalcon_Translate_AdapterInterface); - ZEPHIR_INIT(Phalcon_Assets_FilterInterface); - ZEPHIR_INIT(Phalcon_DiInterface); - ZEPHIR_INIT(Phalcon_FlashInterface); - ZEPHIR_INIT(Phalcon_Image_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewBaseInterface); - ZEPHIR_INIT(Phalcon_Mvc_View_EngineInterface); - ZEPHIR_INIT(Phalcon_Acl_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_StrategyInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultInterface); - ZEPHIR_INIT(Phalcon_Mvc_RouterInterface); - ZEPHIR_INIT(Phalcon_Translate_InterpolatorInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceInterface); - ZEPHIR_INIT(Phalcon_Acl_RoleInterface); - ZEPHIR_INIT(Phalcon_Annotations_ReaderInterface); - ZEPHIR_INIT(Phalcon_Cli_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Cli_TaskInterface); - ZEPHIR_INIT(Phalcon_CryptInterface); - ZEPHIR_INIT(Phalcon_Db_ColumnInterface); - ZEPHIR_INIT(Phalcon_Db_IndexInterface); - ZEPHIR_INIT(Phalcon_Db_ReferenceInterface); - ZEPHIR_INIT(Phalcon_Db_ResultInterface); - ZEPHIR_INIT(Phalcon_Di_ServiceInterface); - ZEPHIR_INIT(Phalcon_EscaperInterface); - ZEPHIR_INIT(Phalcon_Events_EventInterface); - ZEPHIR_INIT(Phalcon_Events_ManagerInterface); - ZEPHIR_INIT(Phalcon_FilterInterface); - ZEPHIR_INIT(Phalcon_Http_CookieInterface); - ZEPHIR_INIT(Phalcon_Http_RequestInterface); - ZEPHIR_INIT(Phalcon_Http_Request_FileInterface); - ZEPHIR_INIT(Phalcon_Http_ResponseInterface); - ZEPHIR_INIT(Phalcon_Http_Response_CookiesInterface); - ZEPHIR_INIT(Phalcon_Http_Response_HeadersInterface); - ZEPHIR_INIT(Phalcon_Mvc_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ControllerInterface); - ZEPHIR_INIT(Phalcon_Mvc_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_CriteriaInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MessageInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_QueryInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_BuilderInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_StatusInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_RelationInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_TransactionInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_GroupInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Mvc_UrlInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewInterface); - ZEPHIR_INIT(Phalcon_Session_BagInterface); - ZEPHIR_INIT(Phalcon_ValidationInterface); - ZEPHIR_INIT(Phalcon_Validation_MessageInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceAware); - ZEPHIR_INIT(Phalcon_Acl_RoleAware); - ZEPHIR_INIT(Phalcon_Cli_RouterInterface); - ZEPHIR_INIT(Phalcon_Cli_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Filter_UserFilterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Controller_BindModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_MiddlewareInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModuleDefinitionInterface); - ZEPHIR_INIT(Phalcon_Exception); - ZEPHIR_INIT(Phalcon_Validation_Validator); - ZEPHIR_INIT(Phalcon_Di_Injectable); - ZEPHIR_INIT(Phalcon_Forms_Element); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator); - ZEPHIR_INIT(Phalcon_Cache_Backend); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData); - ZEPHIR_INIT(Phalcon_Annotations_Adapter); - ZEPHIR_INIT(Phalcon_Config); - ZEPHIR_INIT(Phalcon_Db_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Formatter); - ZEPHIR_INIT(Phalcon_Session_Adapter); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo); - ZEPHIR_INIT(Phalcon_Db_Dialect); - ZEPHIR_INIT(Phalcon_Mvc_Model_Exception); - ZEPHIR_INIT(Phalcon_Paginator_Adapter); - ZEPHIR_INIT(Phalcon_Translate_Adapter); - ZEPHIR_INIT(Phalcon_Application); - ZEPHIR_INIT(Phalcon_Application_Exception); - ZEPHIR_INIT(Phalcon_Assets_Inline); - ZEPHIR_INIT(Phalcon_Assets_Resource); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Data); - ZEPHIR_INIT(Phalcon_Di); - ZEPHIR_INIT(Phalcon_Dispatcher); - ZEPHIR_INIT(Phalcon_Flash); - ZEPHIR_INIT(Phalcon_Image_Adapter); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine); - ZEPHIR_INIT(Phalcon_Acl_Adapter); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router); - ZEPHIR_INIT(Phalcon_Mvc_View_Exception); - ZEPHIR_INIT(Phalcon_Validation_CombinedFieldsValidator); - ZEPHIR_INIT(Phalcon_Acl); - ZEPHIR_INIT(Phalcon_Acl_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Acl_Exception); - ZEPHIR_INIT(Phalcon_Acl_Resource); - ZEPHIR_INIT(Phalcon_Acl_Role); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Apc); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Files); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Xcache); - ZEPHIR_INIT(Phalcon_Annotations_Annotation); - ZEPHIR_INIT(Phalcon_Annotations_Collection); - ZEPHIR_INIT(Phalcon_Annotations_Exception); - ZEPHIR_INIT(Phalcon_Annotations_Reader); - ZEPHIR_INIT(Phalcon_Annotations_Reflection); - ZEPHIR_INIT(Phalcon_Assets_Collection); - ZEPHIR_INIT(Phalcon_Assets_Exception); - ZEPHIR_INIT(Phalcon_Assets_Filters_Cssmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_Jsmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_None); - ZEPHIR_INIT(Phalcon_Assets_Inline_Css); - ZEPHIR_INIT(Phalcon_Assets_Inline_Js); - ZEPHIR_INIT(Phalcon_Assets_Manager); - ZEPHIR_INIT(Phalcon_Assets_Resource_Css); - ZEPHIR_INIT(Phalcon_Assets_Resource_Js); - ZEPHIR_INIT(Phalcon_Cache_Backend_Apc); - ZEPHIR_INIT(Phalcon_Cache_Backend_File); - ZEPHIR_INIT(Phalcon_Cache_Backend_Libmemcached); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memcache); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memory); - ZEPHIR_INIT(Phalcon_Cache_Backend_Mongo); - ZEPHIR_INIT(Phalcon_Cache_Backend_Redis); - ZEPHIR_INIT(Phalcon_Cache_Backend_Xcache); - ZEPHIR_INIT(Phalcon_Cache_Exception); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Base64); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Igbinary); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Json); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Msgpack); - ZEPHIR_INIT(Phalcon_Cache_Frontend_None); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Output); - ZEPHIR_INIT(Phalcon_Cache_Multiple); - ZEPHIR_INIT(Phalcon_Cli_Console); - ZEPHIR_INIT(Phalcon_Cli_Console_Exception); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router); - ZEPHIR_INIT(Phalcon_Cli_Router_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router_Route); - ZEPHIR_INIT(Phalcon_Cli_Task); - ZEPHIR_INIT(Phalcon_Config_Adapter_Ini); - ZEPHIR_INIT(Phalcon_Config_Adapter_Json); - ZEPHIR_INIT(Phalcon_Config_Adapter_Php); - ZEPHIR_INIT(Phalcon_Config_Adapter_Yaml); - ZEPHIR_INIT(Phalcon_Config_Exception); - ZEPHIR_INIT(Phalcon_Crypt); - ZEPHIR_INIT(Phalcon_Crypt_Exception); - ZEPHIR_INIT(Phalcon_Db); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Mysql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Column); - ZEPHIR_INIT(Phalcon_Db_Dialect_Mysql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Exception); - ZEPHIR_INIT(Phalcon_Db_Index); - ZEPHIR_INIT(Phalcon_Db_Profiler); - ZEPHIR_INIT(Phalcon_Db_Profiler_Item); - ZEPHIR_INIT(Phalcon_Db_RawValue); - ZEPHIR_INIT(Phalcon_Db_Reference); - ZEPHIR_INIT(Phalcon_Db_Result_Pdo); - ZEPHIR_INIT(Phalcon_Debug); - ZEPHIR_INIT(Phalcon_Debug_Dump); - ZEPHIR_INIT(Phalcon_Debug_Exception); - ZEPHIR_INIT(Phalcon_Di_Exception); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault_Cli); - ZEPHIR_INIT(Phalcon_Di_Service); - ZEPHIR_INIT(Phalcon_Di_Service_Builder); - ZEPHIR_INIT(Phalcon_Escaper); - ZEPHIR_INIT(Phalcon_Escaper_Exception); - ZEPHIR_INIT(Phalcon_Events_Event); - ZEPHIR_INIT(Phalcon_Events_Exception); - ZEPHIR_INIT(Phalcon_Events_Manager); - ZEPHIR_INIT(Phalcon_Filter); - ZEPHIR_INIT(Phalcon_Filter_Exception); - ZEPHIR_INIT(Phalcon_Flash_Direct); - ZEPHIR_INIT(Phalcon_Flash_Exception); - ZEPHIR_INIT(Phalcon_Flash_Session); - ZEPHIR_INIT(Phalcon_Forms_Element_Check); - ZEPHIR_INIT(Phalcon_Forms_Element_Date); - ZEPHIR_INIT(Phalcon_Forms_Element_Email); - ZEPHIR_INIT(Phalcon_Forms_Element_File); - ZEPHIR_INIT(Phalcon_Forms_Element_Hidden); - ZEPHIR_INIT(Phalcon_Forms_Element_Numeric); - ZEPHIR_INIT(Phalcon_Forms_Element_Password); - ZEPHIR_INIT(Phalcon_Forms_Element_Radio); - ZEPHIR_INIT(Phalcon_Forms_Element_Select); - ZEPHIR_INIT(Phalcon_Forms_Element_Submit); - ZEPHIR_INIT(Phalcon_Forms_Element_Text); - ZEPHIR_INIT(Phalcon_Forms_Element_TextArea); - ZEPHIR_INIT(Phalcon_Forms_Exception); - ZEPHIR_INIT(Phalcon_Forms_Form); - ZEPHIR_INIT(Phalcon_Forms_Manager); - ZEPHIR_INIT(Phalcon_Http_Cookie); - ZEPHIR_INIT(Phalcon_Http_Cookie_Exception); - ZEPHIR_INIT(Phalcon_Http_Request); - ZEPHIR_INIT(Phalcon_Http_Request_Exception); - ZEPHIR_INIT(Phalcon_Http_Request_File); - ZEPHIR_INIT(Phalcon_Http_Response); - ZEPHIR_INIT(Phalcon_Http_Response_Cookies); - ZEPHIR_INIT(Phalcon_Http_Response_Exception); - ZEPHIR_INIT(Phalcon_Http_Response_Headers); - ZEPHIR_INIT(Phalcon_Image); - ZEPHIR_INIT(Phalcon_Image_Adapter_Gd); - ZEPHIR_INIT(Phalcon_Image_Adapter_Imagick); - ZEPHIR_INIT(Phalcon_Image_Exception); - ZEPHIR_INIT(Phalcon_Kernel); - ZEPHIR_INIT(Phalcon_Loader); - ZEPHIR_INIT(Phalcon_Loader_Exception); - ZEPHIR_INIT(Phalcon_Logger); - ZEPHIR_INIT(Phalcon_Logger_Adapter_File); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Stream); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Exception); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Json); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Line); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Item); - ZEPHIR_INIT(Phalcon_Logger_Multiple); - ZEPHIR_INIT(Phalcon_Mvc_Application); - ZEPHIR_INIT(Phalcon_Mvc_Application_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Document); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Controller); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro_LazyLoader); - ZEPHIR_INIT(Phalcon_Mvc_Model); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Model_Criteria); - ZEPHIR_INIT(Phalcon_Mvc_Model_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_Message); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Apc); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Files); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Libmemcached); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memory); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Redis); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Session); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Introspection); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Xcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Builder); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Lang); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Status); - ZEPHIR_INIT(Phalcon_Mvc_Model_Relation); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Complex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Simple); - ZEPHIR_INIT(Phalcon_Mvc_Model_Row); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Failed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidationFailed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Email); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Exclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Inclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Ip); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Regex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Url); - ZEPHIR_INIT(Phalcon_Mvc_Router_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Router_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router_Group); - ZEPHIR_INIT(Phalcon_Mvc_Router_Route); - ZEPHIR_INIT(Phalcon_Mvc_Url); - ZEPHIR_INIT(Phalcon_Mvc_Url_Exception); - ZEPHIR_INIT(Phalcon_Mvc_User_Component); - ZEPHIR_INIT(Phalcon_Mvc_User_Module); - ZEPHIR_INIT(Phalcon_Mvc_User_Plugin); - ZEPHIR_INIT(Phalcon_Mvc_View); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Php); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Compiler); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Exception); - ZEPHIR_INIT(Phalcon_Mvc_View_Simple); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_Model); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_QueryBuilder); - ZEPHIR_INIT(Phalcon_Paginator_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Job); - ZEPHIR_INIT(Phalcon_Registry); - ZEPHIR_INIT(Phalcon_Security); - ZEPHIR_INIT(Phalcon_Security_Exception); - ZEPHIR_INIT(Phalcon_Security_Random); - ZEPHIR_INIT(Phalcon_Session_Adapter_Files); - ZEPHIR_INIT(Phalcon_Session_Adapter_Libmemcached); - ZEPHIR_INIT(Phalcon_Session_Adapter_Memcache); - ZEPHIR_INIT(Phalcon_Session_Adapter_Redis); - ZEPHIR_INIT(Phalcon_Session_Bag); - ZEPHIR_INIT(Phalcon_Session_Exception); - ZEPHIR_INIT(Phalcon_Tag); - ZEPHIR_INIT(Phalcon_Tag_Exception); - ZEPHIR_INIT(Phalcon_Tag_Select); - ZEPHIR_INIT(Phalcon_Text); - ZEPHIR_INIT(Phalcon_Translate); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Csv); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Gettext); - ZEPHIR_INIT(Phalcon_Translate_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Translate_Exception); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_AssociativeArray); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_IndexedArray); - ZEPHIR_INIT(Phalcon_Validation); - ZEPHIR_INIT(Phalcon_Validation_Exception); - ZEPHIR_INIT(Phalcon_Validation_Message); - ZEPHIR_INIT(Phalcon_Validation_Message_Group); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alnum); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alpha); - ZEPHIR_INIT(Phalcon_Validation_Validator_Between); - ZEPHIR_INIT(Phalcon_Validation_Validator_Confirmation); - ZEPHIR_INIT(Phalcon_Validation_Validator_CreditCard); - ZEPHIR_INIT(Phalcon_Validation_Validator_Date); - ZEPHIR_INIT(Phalcon_Validation_Validator_Digit); - ZEPHIR_INIT(Phalcon_Validation_Validator_Email); - ZEPHIR_INIT(Phalcon_Validation_Validator_ExclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_File); - ZEPHIR_INIT(Phalcon_Validation_Validator_Identical); - ZEPHIR_INIT(Phalcon_Validation_Validator_InclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Validation_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Validation_Validator_Regex); - ZEPHIR_INIT(Phalcon_Validation_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Validation_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Validation_Validator_Url); - ZEPHIR_INIT(Phalcon_Version); - ZEPHIR_INIT(phalcon_0__closure); - ZEPHIR_INIT(phalcon_1__closure); - -#if PHP_VERSION_ID < 50500 - setlocale(LC_ALL, old_lc_all); - free(old_lc_all); -#endif - return SUCCESS; -} - -#ifndef ZEPHIR_RELEASE -static PHP_MSHUTDOWN_FUNCTION(phalcon) -{ - - zephir_deinitialize_memory(TSRMLS_C); - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -#endif - -static void php_zephir_init_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - phalcon_globals->initialized = 0; - - /* Memory options */ - phalcon_globals->active_memory = NULL; - - /* Virtual Symbol Tables */ - phalcon_globals->active_symbol_table = NULL; - - /* Cache Enabled */ - phalcon_globals->cache_enabled = 1; - - /* Recursive Lock */ - phalcon_globals->recursive_lock = 0; - - /* Static cache */ - memset(phalcon_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - - - - phalcon_globals->orm.parser_cache = NULL; - phalcon_globals->orm.ast_cache = NULL; - phalcon_globals->orm.cache_level = 3; - phalcon_globals->orm.unique_cache_id = 3; - - - - - - - - - - - -} - -static void php_zephir_init_module_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - -} - -static PHP_RINIT_FUNCTION(phalcon) -{ +Copyright (c) 2002 Douglas Crockford (www.crockford.com) - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: - php_zephir_init_globals(phalcon_globals_ptr TSRMLS_CC); - //zephir_init_interned_strings(TSRMLS_C); +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - zephir_initialize_memory(phalcon_globals_ptr TSRMLS_CC); +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ - return SUCCESS; -} +#ifndef PHALCON_ASSETS_FILTERS_CSSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_CSSMINIFIER_H -static PHP_RSHUTDOWN_FUNCTION(phalcon) -{ - phalcon_orm_destroy_cache(TSRMLS_C); +static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); - zephir_deinitialize_memory(TSRMLS_C); - return SUCCESS; -} +#endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ -static PHP_MINFO_FUNCTION(phalcon) -{ - php_info_print_box_start(0); - php_printf("%s", PHP_PHALCON_DESCRIPTION); - php_info_print_box_end(); - php_info_print_table_start(); - php_info_print_table_header(2, PHP_PHALCON_NAME, "enabled"); - php_info_print_table_row(2, "Author", PHP_PHALCON_AUTHOR); - php_info_print_table_row(2, "Version", PHP_PHALCON_VERSION); - php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); - php_info_print_table_row(2, "Powered by Zephir", "Version " PHP_PHALCON_ZEPVERSION); - php_info_print_table_end(); +/* jsmin.c + 2013-03-29 - DISPLAY_INI_ENTRIES(); -} +Copyright (c) 2002 Douglas Crockford (www.crockford.com) -static PHP_GINIT_FUNCTION(phalcon) -{ - php_zephir_init_globals(phalcon_globals TSRMLS_CC); - php_zephir_init_module_globals(phalcon_globals TSRMLS_CC); -} +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: -static PHP_GSHUTDOWN_FUNCTION(phalcon) -{ +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -} +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ -zend_function_entry php_phalcon_functions[] = { -ZEND_FE_END +#ifndef PHALCON_ASSETS_FILTERS_JSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_JSMINIFIER_H -}; -zend_module_entry phalcon_module_entry = { - STANDARD_MODULE_HEADER_EX, - NULL, - NULL, - PHP_PHALCON_EXTNAME, - php_phalcon_functions, - PHP_MINIT(phalcon), -#ifndef ZEPHIR_RELEASE - PHP_MSHUTDOWN(phalcon), -#else - NULL, -#endif - PHP_RINIT(phalcon), - PHP_RSHUTDOWN(phalcon), - PHP_MINFO(phalcon), - PHP_PHALCON_VERSION, - ZEND_MODULE_GLOBALS(phalcon), - PHP_GINIT(phalcon), - PHP_GSHUTDOWN(phalcon), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; +static int phalcon_jsmin(zval *return_value, zval *script TSRMLS_DC); -#ifdef COMPILE_DL_PHALCON -ZEND_GET_MODULE(phalcon) -#endif +#endif /* PHALCON_ASSETS_FILTERS_JSMINIFIER_H */ @@ -24217,7 +23344,7 @@ static PHP_METHOD(Phalcon_Loader, register) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 299, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 264, _1$$3); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24245,7 +23372,7 @@ static PHP_METHOD(Phalcon_Loader, unregister) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 300, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 265, _1$$3); zephir_check_call_status(); if (0) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24285,7 +23412,7 @@ static PHP_METHOD(Phalcon_Loader, loadFiles) { zephir_check_temp_parameter(_6$$4); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_7$$3)) { ZEPHIR_OBS_NVAR(_9$$5); @@ -24414,7 +23541,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_15$$11); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_17$$10)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24465,7 +23592,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_29$$16); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_31$$15)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24756,7 +23883,7 @@ static PHP_METHOD(Phalcon_Registry, next) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 417, _0); + ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 382, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24772,7 +23899,7 @@ static PHP_METHOD(Phalcon_Registry, key) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 418, _0); + ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24788,7 +23915,7 @@ static PHP_METHOD(Phalcon_Registry, rewind) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 419, _0); + ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 384, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24804,7 +23931,7 @@ static PHP_METHOD(Phalcon_Registry, valid) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 418, _0); + ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM_BOOL(Z_TYPE_P(_1) != IS_NULL); @@ -24820,7 +23947,7 @@ static PHP_METHOD(Phalcon_Registry, current) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 420, _0); + ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 385, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24848,7 +23975,7 @@ static PHP_METHOD(Phalcon_Registry, __set) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 421, key, value); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 386, key, value); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24875,7 +24002,7 @@ static PHP_METHOD(Phalcon_Registry, __get) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 422, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 387, key); zephir_check_call_status(); RETURN_MM(); @@ -24902,7 +24029,7 @@ static PHP_METHOD(Phalcon_Registry, __isset) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 423, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 388, key); zephir_check_call_status(); RETURN_MM(); @@ -24929,7 +24056,7 @@ static PHP_METHOD(Phalcon_Registry, __unset) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 424, key); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 389, key); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -25208,7 +24335,7 @@ static PHP_METHOD(Phalcon_Security, hash) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_security_exception_ce, "Unable to get random bytes for the salt", "phalcon/security.zep", 222); return; } - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, saltBytes); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, saltBytes); zephir_check_call_status(); RETURN_MM(); } @@ -25229,7 +24356,7 @@ static PHP_METHOD(Phalcon_Security, hash) { } ZEPHIR_INIT_VAR(_8$$15); ZEPHIR_CONCAT_SVSVS(_8$$15, "$", variant, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _8$$15); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _8$$15); zephir_check_call_status(); RETURN_MM(); } @@ -25256,7 +24383,7 @@ static PHP_METHOD(Phalcon_Security, hash) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_13$$17); ZEPHIR_CONCAT_SVSVSVS(_13$$17, "$2", variant, "$", _12$$17, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _13$$17); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _13$$17); zephir_check_call_status(); RETURN_MM(); } while(0); @@ -25296,7 +24423,7 @@ static PHP_METHOD(Phalcon_Security, checkHash) { RETURN_MM_BOOL(0); } } - ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 425, password, passwordHash); + ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 390, password, passwordHash); zephir_check_call_status(); zephir_get_strval(_2, _1); ZEPHIR_CPY_WRT(cryptedHash, _2); @@ -25551,7 +24678,7 @@ static PHP_METHOD(Phalcon_Security, computeHmac) { ZEPHIR_SINIT_VAR(_0); ZVAL_BOOL(&_0, (raw ? 1 : 0)); - ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 426, algo, data, key, &_0); + ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 391, algo, data, key, &_0); zephir_check_call_status(); if (!(zephir_is_true(hmac))) { ZEPHIR_INIT_VAR(_1$$3); @@ -27364,7 +26491,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_1)) { ZEPHIR_SINIT_VAR(_3$$3); - ZVAL_LONG(&_3$$3, 6); + ZVAL_LONG(&_3$$3, 0); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "en_US.UTF-8", 0); ZEPHIR_CALL_FUNCTION(&locale, "setlocale", &_5, 442, &_3$$3, &_4$$3); @@ -27435,7 +26562,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_19)) { ZEPHIR_SINIT_VAR(_20$$10); - ZVAL_LONG(&_20$$10, 6); + ZVAL_LONG(&_20$$10, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", &_5, 442, &_20$$10, locale); zephir_check_call_status(); } @@ -27804,13 +26931,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_STRING(&_0$$3, "a", 0); ZEPHIR_SINIT_VAR(_1$$3); ZVAL_STRING(&_1$$3, "z", 0); - ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$3); ZVAL_STRING(&_0$$3, "A", 0); ZEPHIR_SINIT_NVAR(_1$$3); ZVAL_STRING(&_1$$3, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(pool); zephir_fast_array_merge(pool, &(_2$$3), &(_4$$3) TSRMLS_CC); @@ -27821,13 +26948,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_5$$4, 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_LONG(&_6$$4, 9); - ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_5$$4); ZVAL_STRING(&_5$$4, "a", 0); ZEPHIR_SINIT_NVAR(_6$$4); ZVAL_STRING(&_6$$4, "f", 0); - ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(pool); zephir_fast_array_merge(pool, &(_7$$4), &(_8$$4) TSRMLS_CC); @@ -27838,7 +26965,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_9$$5, 0); ZEPHIR_SINIT_VAR(_10$$5); ZVAL_LONG(&_10$$5, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_9$$5, &_10$$5); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_9$$5, &_10$$5); zephir_check_call_status(); break; } @@ -27847,7 +26974,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_11$$6, 1); ZEPHIR_SINIT_VAR(_12$$6); ZVAL_LONG(&_12$$6, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_11$$6, &_12$$6); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_11$$6, &_12$$6); zephir_check_call_status(); break; } @@ -27855,21 +26982,21 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_13$$7, 0); ZEPHIR_SINIT_VAR(_14$$7); ZVAL_LONG(&_14$$7, 9); - ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "a", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "z", 0); - ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "A", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 447, _15$$7, _16$$7, _17$$7); + ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 412, _15$$7, _16$$7, _17$$7); zephir_check_call_status(); break; } while(0); @@ -28066,24 +27193,24 @@ static PHP_METHOD(Phalcon_Text, concat) { ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 449); + ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 414); zephir_check_call_status(); if (ZEPHIR_GT_LONG(_2, 3)) { ZEPHIR_CALL_FUNCTION(&_3$$3, "func_get_args", NULL, 176); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 396, _3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 361, _3$$3, &_4$$3); zephir_check_call_status(); zephir_is_iterable(_5$$3, &_7$$3, &_6$$3, 0, 0, "phalcon/text.zep", 256); for ( @@ -28179,24 +27306,24 @@ static PHP_METHOD(Phalcon_Text, dynamic) { } - ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 450, text, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 415, text, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 450, text, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 415, text, rightDelimiter); zephir_check_call_status(); if (!ZEPHIR_IS_IDENTICAL(_0, _2)) { ZEPHIR_INIT_VAR(_3$$3); object_init_ex(_3$$3, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(_4$$3); ZEPHIR_CONCAT_SVS(_4$$3, "Syntax error in string \"", text, "\""); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 451, _4$$3); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 416, _4$$3); zephir_check_call_status(); zephir_throw_exception_debug(_3$$3, "phalcon/text.zep", 283 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 452, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 417, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 452, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 417, rightDelimiter); zephir_check_call_status(); ZEPHIR_INIT_VAR(pattern); ZEPHIR_CONCAT_SVSVVSVS(pattern, "/", ldS, "([^", ldS, rdS, "]+)", rdS, "/"); @@ -28229,11 +27356,11 @@ static PHP_METHOD(Phalcon_Text, dynamic) { ZEPHIR_INIT_NVAR(words); zephir_fast_explode(words, separator, _12$$6, LONG_MAX TSRMLS_CC); ZEPHIR_OBS_NVAR(word); - ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 453, words); + ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 418, words); zephir_check_call_status(); zephir_array_fetch(&word, words, _13$$6, PH_NOISY, "phalcon/text.zep", 302 TSRMLS_CC); zephir_array_fetch_long(&_15$$6, match, 0, PH_NOISY | PH_READONLY, "phalcon/text.zep", 303 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 452, _15$$6, separator); + ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 417, _15$$6, separator); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_16$$6); ZEPHIR_CONCAT_SVS(_16$$6, "/", sub, "/"); @@ -28409,13 +27536,13 @@ static PHP_METHOD(Phalcon_Validation, __construct) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_INIT_NVAR(_0$$3); zephir_create_closure_ex(_0$$3, NULL, phalcon_0__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 463, validators, _0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 458, validators, _0$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_validators"), _1$$3 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_INIT_NVAR(_3$$3); zephir_create_closure_ex(_3$$3, NULL, phalcon_1__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 463, validators, _3$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 458, validators, _3$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_combinedFieldsValidators"), _4$$3 TSRMLS_CC); } @@ -28895,7 +28022,7 @@ static PHP_METHOD(Phalcon_Validation, appendMessage) { ZEPHIR_CALL_METHOD(NULL, messages, "__construct", NULL, 3); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 464, message); + ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 459, message); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); RETURN_THIS(); @@ -29319,7 +28446,7 @@ static PHP_METHOD(Phalcon_Version, get) { zephir_array_fetch_long(&specialNumber, version, 4, PH_NOISY, "phalcon/version.zep", 143 TSRMLS_CC); ZEPHIR_INIT_VAR(result); ZEPHIR_CONCAT_VSVSVS(result, major, ".", medium, ".", minor, " "); - ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 474, special); + ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 469, special); zephir_check_call_status(); if (!ZEPHIR_IS_STRING(suffix, "")) { ZEPHIR_INIT_VAR(_1$$3); @@ -29386,7 +28513,7 @@ static PHP_METHOD(Phalcon_Version, getPart) { } if (part == 3) { zephir_array_fetch_long(&_1$$4, version, 3, PH_NOISY | PH_READONLY, "phalcon/version.zep", 204 TSRMLS_CC); - ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 474, _1$$4); + ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 469, _1$$4); zephir_check_call_status(); break; } @@ -31276,428 +30403,6 @@ static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedParameter) { - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { - - smart_str_appendc(&processed_str, ch); - i++; - - open_parentheses = 0; - for (j = i; j < length; j++) { - - ch = comment[j]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (open_parentheses == 0) { - - if (isalnum(ch) || '_' == ch || '\\' == ch) { - smart_str_appendc(&processed_str, ch); - continue; - } - - if (ch == '(') { - smart_str_appendc(&processed_str, ch); - open_parentheses++; - continue; - } - - } else { - - smart_str_appendc(&processed_str, ch); - - if (ch == '(') { - open_parentheses++; - } else { - if (ch == ')') { - open_parentheses--; - } else { - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - } - - if (open_parentheses > 0) { - continue; - } - } - - i = j; - smart_str_appendc(&processed_str, ' '); - break; - } - } - - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - - smart_str_0(&processed_str); - -#if PHP_VERSION_ID < 70000 - if (processed_str.len) { - *ret = processed_str.c; - *ret_len = processed_str.len; - } else { - *ret = NULL; - *ret_len = 0; - } -#else - if (processed_str.s) { - *ret = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s)); - *ret_len = ZSTR_LEN(processed_str.s); - smart_str_free(&processed_str); - } else { - *ret = NULL; - *ret_len = 0; - } -#endif -} - -static int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg TSRMLS_DC) -{ - phannot_scanner_state *state; - phannot_scanner_token token; - int start_lines; - int scanner_status, status = SUCCESS; - phannot_parser_status *parser_status = NULL; - void* phannot_parser; - char *processed_comment; - int processed_comment_len; - - *error_msg = NULL; - - if (UNEXPECTED(!comment)) { - ZVAL_BOOL(*result, 0); - spprintf(error_msg, 0, "Empty annotation"); - return FAILURE; - } - - if (comment_len < 2) { - ZVAL_BOOL(*result, 0); - return SUCCESS; - } - - phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines); - - if (processed_comment_len < 2) { - ZVAL_BOOL(*result, 0); - if (processed_comment) { - efree(processed_comment); - } - - return SUCCESS; - } - - phannot_parser = phannot_Alloc(phannot_wrapper_alloc); - if (unlikely(!phannot_parser)) { - ZVAL_BOOL(*result, 0); - return FAILURE; - } - - parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state)); - state = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status)); - - parser_status->status = PHANNOT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - state->active_token = 0; - state->start = processed_comment; - state->start_length = 0; - state->mode = PHANNOT_MODE_RAW; - state->active_file = file_path; - - token.value = NULL; - token.len = 0; - - if (line) { - state->active_line = line - start_lines; - } else { - state->active_line = 1; - } - - state->end = state->start; - - while(0 <= (scanner_status = phannot_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = processed_comment + processed_comment_len - state->start; - - switch (token.opcode) { - - case PHANNOT_T_IGNORE: - break; - - case PHANNOT_T_AT: - phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status); - break; - case PHANNOT_T_COMMA: - phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status); - break; - case PHANNOT_T_EQUALS: - phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status); - break; - case PHANNOT_T_COLON: - phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status); - break; - - case PHANNOT_T_PARENTHESES_OPEN: - phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHANNOT_T_PARENTHESES_CLOSE: - phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_BRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_BRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_SBRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_SBRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_NULL: - phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status); - break; - case PHANNOT_T_TRUE: - phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status); - break; - case PHANNOT_T_FALSE: - phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status); - break; - - case PHANNOT_T_INTEGER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status); - break; - case PHANNOT_T_DOUBLE: - phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status); - break; - case PHANNOT_T_STRING: - phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status); - break; - case PHANNOT_T_IDENTIFIER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status); - break; - /*case PHANNOT_T_ARBITRARY_TEXT: - phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status); - break;*/ - - default: - parser_status->status = PHANNOT_PARSING_FAILED; - if (!*error_msg) { - spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line); - } - break; - } - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHANNOT_SCANNER_RETCODE_ERR: - case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phannot_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - status = FAILURE; - break; - - default: - phannot_(phannot_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { - if (!*error_msg) { - *error_msg = parser_status->syntax_error; - } else { - efree(parser_status->syntax_error); - } - } - } - - phannot_Free(phannot_parser, phannot_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHANNOT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - } - } - - efree(processed_comment); - efree(parser_status); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -31967,4374 +30672,968 @@ ZEPHIR_INIT_CLASS(Phalcon_Annotations_Exception) { +#if PHP_VERSION_ID < 70000 +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +// 28 "parser.php5.lemon" -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 +// 12 "parser.php5.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 #endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** AACODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** AANOCODE is a number of type AACODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** AAFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** AAACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** phannot_TOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** AAMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval* aa36; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < AANSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. +** +** N == AANSTATE+AANRULE A syntax error has occurred. +** +** N == AANSTATE+AANRULE+1 The parser accepts its input. +** +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. +** +** The action table is constructed as a single large table named aa_action[]. +** Given state S and lookahead X, the action is computed as +** +** aa_action[ aa_shift_ofst[S] + X ] +** +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for +** shifting terminals. +** aa_reduce_ofst[] For each state, the offset into aa_action for +** shifting non-terminals after a reduce. +** aa_default[] Default action for each state. +*/ +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ +static AACODETYPE aa_lookahead[] = { + /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, + /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, + /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, + /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, + /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, + /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, + /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, + /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, + /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, }; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ +#define AA_SHIFT_USE_DFLT (-3) +static signed char aa_shift_ofst[] = { + /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, + /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, + /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, + /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, }; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ +#define AA_REDUCE_USE_DFLT (-21) +static signed char aa_reduce_ofst[] = { + /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, + /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, + /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, + /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, }; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ +static AAACTIONTYPE aa_default[] = { + /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, + /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, + /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, + /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, }; +#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef AAFALLBACK +static const AACODETYPE aaFallback[] = { }; +#endif /* AAFALLBACK */ -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct aaStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + AAMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ }; +typedef struct aaStackEntry aaStackEntry; -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct aaParser { + int aaidx; /* Index of top element in stack */ + int aaerrcnt; /* Shifts left before out of the error */ + phannot_ARG_SDECL /* A place to hold %extra_argument */ + aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ }; +typedef struct aaParser aaParser; -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) +#ifndef NDEBUG +static FILE *aaTraceFILE = 0; +static char *aaTracePrompt = 0; +#endif /* NDEBUG */ -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); +#ifndef NDEBUG +static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ + aaTraceFILE = TraceFILE; + aaTracePrompt = zTracePrompt; + if( aaTraceFILE==0 ) aaTracePrompt = 0; + else if( aaTracePrompt==0 ) aaTraceFILE = 0; } +#endif /* NDEBUG */ -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *aaTokenName[] = { + "$", "COMMA", "AT", "IDENTIFIER", + "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", + "COLON", "INTEGER", "DOUBLE", "NULL", + "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", + "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", + "annotation_language", "annotation_list", "annotation", "argument_list", + "argument_item", "expr", "array", +}; +#endif /* NDEBUG */ -/* Add a new action to the current transaction set +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. */ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; +static const char *aaRuleName[] = { + /* 0 */ "program ::= annotation_language", + /* 1 */ "annotation_language ::= annotation_list", + /* 2 */ "annotation_list ::= annotation_list annotation", + /* 3 */ "annotation_list ::= annotation", + /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", + /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", + /* 6 */ "annotation ::= AT IDENTIFIER", + /* 7 */ "argument_list ::= argument_list COMMA argument_item", + /* 8 */ "argument_list ::= argument_item", + /* 9 */ "argument_item ::= expr", + /* 10 */ "argument_item ::= STRING EQUALS expr", + /* 11 */ "argument_item ::= STRING COLON expr", + /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", + /* 13 */ "argument_item ::= IDENTIFIER COLON expr", + /* 14 */ "expr ::= annotation", + /* 15 */ "expr ::= array", + /* 16 */ "expr ::= IDENTIFIER", + /* 17 */ "expr ::= INTEGER", + /* 18 */ "expr ::= STRING", + /* 19 */ "expr ::= DOUBLE", + /* 20 */ "expr ::= NULL", + /* 21 */ "expr ::= FALSE", + /* 22 */ "expr ::= TRUE", + /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", + /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", +}; +#endif /* NDEBUG */ + +const char *phannot_TokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ + return aaTokenName[tokenType]; }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } + return "Unknown"; } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; +#else + return ""; +#endif } -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; +void *phannot_Alloc(void *(*mallocProc)(size_t)){ + aaParser *pParser; + pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); + if( pParser ){ + pParser->aaidx = -1; } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); + return pParser; } -/********************** From the file "build.c" *****************************/ -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "aamajor" is the symbol code, and "aapminor" is a pointer to +** the value. */ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; +static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ + switch( aamajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: +// 77 "parser.php5.lemon" +{ + if ((aapminor->aa0)) { + if ((aapminor->aa0)->free_flag) { + efree((aapminor->aa0)->token); + } + efree((aapminor->aa0)); } - } - } - } - return; } - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; +// 378 "parser.php5.c" + break; + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: +// 90 "parser.php5.lemon" { - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; + zval_ptr_dtor(&(aapminor->aa36)); } - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); +// 390 "parser.php5.c" + break; + default: break; /* If no destructor action specified: do nothing */ } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; } -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ +static int aa_pop_parser_stack(aaParser *pParser){ + AACODETYPE aamajor; + aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + + if( pParser->aaidx<0 ) return 0; +#ifndef NDEBUG + if( aaTraceFILE && pParser->aaidx>=0 ){ + fprintf(aaTraceFILE,"%sPopping %s\n", + aaTracePrompt, + aaTokenName[aatos->major]); } - return stp; +#endif + aamajor = aatos->major; + aa_destructor( aamajor, &aatos->minor); + pParser->aaidx--; + return aamajor; } -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } +static void phannot_Free( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + aaParser *pParser = (aaParser*)p; + if( pParser==0 ) return; + while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); } -void FindLinks(lemp) -struct lemon *lemp; -{ +static int aa_find_shift_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ + i = aa_shift_ofst[stateno]; + if( i==AA_SHIFT_USE_DFLT ){ + return aa_default[stateno]; } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ +#ifdef AAFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead %s\n", + aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); } +#endif + return aa_find_shift_action(pParser, iFallback); } +#endif + return aa_default[stateno]; + }else{ + return aa_action[i]; } } -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ +static int aa_find_reduce_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + i = aa_reduce_ofst[stateno]; + if( i==AA_REDUCE_USE_DFLT ){ + return aa_default[stateno]; } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ + return aa_default[stateno]; }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; + return aa_action[i]; } } -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ +static void aa_shift( + aaParser *aapParser, /* The parser to be shifted */ + int aaNewState, /* The new state to shift in */ + int aaMajor, /* The major token to shift in */ + AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ +){ + aaStackEntry *aatos; + aapParser->aaidx++; + if( aapParser->aaidx>=AASTACKDEPTH ){ + phannot_ARG_FETCH; + aapParser->aaidx--; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); + } +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ + aatos = &aapParser->aastack[aapParser->aaidx]; + aatos->stateno = aaNewState; + aatos->major = aaMajor; + aatos->minor = *aapMinor; +#ifndef NDEBUG + if( aaTraceFILE && aapParser->aaidx>0 ){ int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; iaaidx; i++) + fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); + fprintf(aaTraceFILE,"\n"); } - new = freelist; - freelist = freelist->next; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; +#endif } -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static struct { + AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} aaRuleInfo[] = { + { 19, 1 }, + { 20, 1 }, + { 21, 2 }, + { 21, 1 }, + { 22, 5 }, + { 22, 4 }, + { 22, 2 }, + { 23, 3 }, + { 23, 1 }, + { 24, 1 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 26, 3 }, + { 26, 3 }, +}; -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} +static void aa_accept(aaParser*); /* Forward Declaration */ -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; iaastack[aapParser->aaidx]; +#ifndef NDEBUG + if( aaTraceFILE && aaruleno>=0 + && aaruleno + ** { ... } // User supplied code + ** // + ** break; + */ + case 0: +// 86 "parser.php5.lemon" { - int i; - int dashdash = 0; - if( argv!=0 && *argv!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ){ - if( n==0 ) return i; - n--; - } - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return -1; + status->ret = aamsp[0].minor.aa36; } - -static char emsg[] = "Command line syntax error: "; - -static int handleflags(i,err) -int i; -FILE *err; -{ - int v; - int errcnt = 0; - int j; - for(j=0; op[j].label; j++){ - if( strncmp(&argv[i][1],op[j].label,strlen(op[j].label))==0 ) break; - } - v = argv[i][0]=='-' ? 1 : 0; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,1,err); - } - errcnt++; - }else if( op[j].type==OPT_FLAG ){ - *((int*)op[j].arg) = v; - }else if( op[j].type==OPT_FFLAG ){ - (*(void(*)())(op[j].arg))(v); - }else if( op[j].type==OPT_FSTR ){ - (*(void(*)())(op[j].arg))(&argv[i][2]); - }else{ - if( err ){ - fprintf(err,"%smissing argument on switch.\n",emsg); - errline(i,1,err); - } - errcnt++; - } - return errcnt; -} - -static int handleswitch(i,err) -int i; -FILE *err; -{ - int lv = 0; - double dv = 0.0; - char *sv = 0, *end; - char *cp; - int j; - int errcnt = 0; - cp = strchr(argv[i],'='); - *cp = 0; - for(j=0; op[j].label; j++){ - if( strcmp(argv[i],op[j].label)==0 ) break; - } - *cp = '='; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,0,err); - } - errcnt++; - }else{ - cp++; - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - if( err ){ - fprintf(err,"%soption requires an argument.\n",emsg); - errline(i,0,err); - } - errcnt++; - break; - case OPT_DBL: - case OPT_FDBL: - dv = strtod(cp,&end); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in floating-point argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_INT: - case OPT_FINT: - lv = strtol(cp,&end,0); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in integer argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_STR: - case OPT_FSTR: - sv = cp; - break; - } - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_DBL: - *(double*)(op[j].arg) = dv; - break; - case OPT_FDBL: - (*(void(*)())(op[j].arg))(dv); - break; - case OPT_INT: - *(int*)(op[j].arg) = lv; - break; - case OPT_FINT: - (*(void(*)())(op[j].arg))((int)lv); - break; - case OPT_STR: - *(char**)(op[j].arg) = sv; - break; - case OPT_FSTR: - (*(void(*)())(op[j].arg))(sv); +// 632 "parser.php5.c" break; - } - } - return errcnt; -} - -int OptInit(a,o,err) -char **a; -struct s_options *o; -FILE *err; -{ - int errcnt = 0; - argv = a; - op = o; - errstream = err; - if( argv && *argv && op ){ - int i; - for(i=1; argv[i]; i++){ - if( argv[i][0]=='+' || argv[i][0]=='-' ){ - errcnt += handleflags(i,err); - }else if( strchr(argv[i],'=') ){ - errcnt += handleswitch(i,err); - } - } - } - if( errcnt>0 ){ - fprintf(err,"Valid command line options for \"%s\" are:\n",*a); - OptPrint(); - exit(1); - } - return 0; -} - -int OptNArgs(){ - int cnt = 0; - int dashdash = 0; - int i; - if( argv!=0 && argv[0]!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ) cnt++; - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return cnt; -} - -char *OptArg(n) -int n; + case 1: + case 14: + case 15: +// 94 "parser.php5.lemon" { - int i; - i = argindex(n); - return i>=0 ? argv[i] : 0; + aagotominor.aa36 = aamsp[0].minor.aa36; } - -void OptErr(n) -int n; +// 641 "parser.php5.c" + break; + case 2: +// 102 "parser.php5.lemon" { - int i; - i = argindex(n); - if( i>=0 ) errline(i,0,errstream); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); } - -void OptPrint(){ - int i; - int max, len; - max = 0; - for(i=0; op[i].label; i++){ - len = strlen(op[i].label) + 1; - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_INT: - case OPT_FINT: - len += 9; /* length of "" */ - break; - case OPT_DBL: - case OPT_FDBL: - len += 6; /* length of "" */ - break; - case OPT_STR: - case OPT_FSTR: - len += 8; /* length of "" */ - break; - } - if( len>max ) max = len; - } - for(i=0; op[i].label; i++){ - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - fprintf(errstream," -%-*s %s\n",max,op[i].label,op[i].message); - break; - case OPT_INT: - case OPT_FINT: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-9),"",op[i].message); - break; - case OPT_DBL: - case OPT_FDBL: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-6),"",op[i].message); - break; - case OPT_STR: - case OPT_FSTR: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-8),"",op[i].message); +// 648 "parser.php5.c" break; - } - } -} -/*********************** From the file "parse.c" ****************************/ - -/* The state of the parser */ -struct pstate { - char *filename; /* Name of the input file */ - int tokenlineno; /* Linenumber at which current token starts */ - int errorcnt; /* Number of errors so far */ - char *tokenstart; /* Text of current token */ - struct lemon *gp; /* Global state vector */ - enum e_state { - INITIALIZE, - WAITING_FOR_DECL_OR_RULE, - WAITING_FOR_DECL_KEYWORD, - WAITING_FOR_DECL_ARG, - WAITING_FOR_PRECEDENCE_SYMBOL, - WAITING_FOR_ARROW, - IN_RHS, - LHS_ALIAS_1, - LHS_ALIAS_2, - LHS_ALIAS_3, - RHS_ALIAS_1, - RHS_ALIAS_2, - PRECEDENCE_MARK_1, - PRECEDENCE_MARK_2, - RESYNC_AFTER_RULE_ERROR, - RESYNC_AFTER_DECL_ERROR, - WAITING_FOR_DESTRUCTOR_SYMBOL, - WAITING_FOR_DATATYPE_SYMBOL, - WAITING_FOR_FALLBACK_ID - } state; /* The state of the parser */ - struct symbol *fallback; /* The fallback token */ - struct symbol *lhs; /* Left-hand side of current rule */ - char *lhsalias; /* Alias for the LHS */ - int nrhs; /* Number of right-hand side symbols seen */ - struct symbol *rhs[MAXRHS]; /* RHS symbols */ - char *alias[MAXRHS]; /* Aliases for each RHS symbol (or NULL) */ - struct rule *prevrule; /* Previous rule parsed */ - char *declkeyword; /* Keyword of a declaration */ - char **declargslot; /* Where the declaration argument should be put */ - int *decllnslot; /* Where the declaration linenumber is put */ - enum e_assoc declassoc; /* Assign this association to decl arguments */ - int preccounter; /* Assign this precedence to decl arguments */ - struct rule *firstrule; /* Pointer to first rule in the grammar */ - struct rule *lastrule; /* Pointer to the most recently parsed rule */ -}; - -/* Parse a single token */ -static void parseonetoken(psp) -struct pstate *psp; + case 3: + case 8: +// 106 "parser.php5.lemon" { - char *x; - x = Strsafe(psp->tokenstart); /* Save the token permanently */ -#if 0 - printf("%s:%d: Token=[%s] state=%d\n",psp->filename,psp->tokenlineno, - x,psp->state); -#endif - switch( psp->state ){ - case INITIALIZE: - psp->prevrule = 0; - psp->preccounter = 0; - psp->firstrule = psp->lastrule = 0; - psp->gp->nrule = 0; - /* Fall thru to next case */ - case WAITING_FOR_DECL_OR_RULE: - if( x[0]=='%' ){ - psp->state = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } + aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); } - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; +// 656 "parser.php5.c" + break; + case 4: +// 114 "parser.php5.lemon" { - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + aa_destructor(2,&aamsp[-4].minor); + aa_destructor(4,&aamsp[-2].minor); + aa_destructor(5,&aamsp[0].minor); } -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; +// 666 "parser.php5.c" + break; + case 5: +// 118 "parser.php5.lemon" { - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-3].minor); + aa_destructor(4,&aamsp[-1].minor); + aa_destructor(5,&aamsp[0].minor); } - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; +// 676 "parser.php5.c" + break; + case 6: +// 122 "parser.php5.lemon" { - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-1].minor); } - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; +// 684 "parser.php5.c" + break; + case 7: +// 130 "parser.php5.lemon" { - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + aa_destructor(1,&aamsp[-1].minor); } - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; +// 692 "parser.php5.c" + break; + case 9: +// 142 "parser.php5.lemon" { - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; + aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); } - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; +// 699 "parser.php5.c" + break; + case 10: + case 12: +// 146 "parser.php5.lemon" { - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(7,&aamsp[-1].minor); } - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; +// 708 "parser.php5.c" + break; + case 11: + case 13: +// 150 "parser.php5.lemon" { - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(8,&aamsp[-1].minor); } - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; +// 717 "parser.php5.c" + break; + case 16: +// 174 "parser.php5.lemon" { - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; +// 724 "parser.php5.c" break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; + case 17: +// 178 "parser.php5.lemon" { - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; +// 731 "parser.php5.c" + break; + case 18: +// 182 "parser.php5.lemon" { - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); } - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; +// 738 "parser.php5.c" + break; + case 19: +// 186 "parser.php5.lemon" { - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } + aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + aa_destructor(16,&aamsp[-2].minor); + aa_destructor(17,&aamsp[0].minor); } -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; +// 787 "parser.php5.c" + break; + }; + aagoto = aaRuleInfo[aaruleno].lhs; + aasize = aaRuleInfo[aaruleno].nrhs; + aapParser->aaidx -= aasize; + aaact = aa_find_reduce_action(aapParser,aagoto); + if( aaact < AANSTATE ){ + aa_shift(aapParser,aaact,aagoto,&aagotominor); + }else if( aaact == AANSTATE + AANRULE + 1 ){ + aa_accept(aapParser); } - return np ? np->data : 0; } -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); +static void aa_parse_failed( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; +static void aa_syntax_error( + aaParser *aapParser, /* The parser */ + int aamajor, /* The major type of the error token */ + AAMINORTYPE aaminor /* The minor type of the error token */ +){ + phannot_ARG_FETCH; +#define ATOKEN (aaminor.aa0) +// 32 "parser.php5.lemon" -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} + if (status->scanner_state->start_length) { + char *token_name = NULL; + const phannot_token_names *tokens = phannot_tokens; + uint active_token = status->scanner_state->active_token; + uint near_length = status->scanner_state->start_length; -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} + if (active_token) { + do { + if (tokens->code == active_token) { + token_name = tokens->name; + break; + } + ++tokens; + } while (tokens[0].code != 0); + } -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} + if (!token_name) { + token_name = "UNKNOWN"; + } -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} + if (near_length > 0) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + if (active_token != PHANNOT_T_IGNORE) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); + } + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + } -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} + status->status = PHANNOT_PARSING_FAILED; -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; +// 874 "parser.php5.c" + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; +static void aa_accept( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x3". +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "phannot_Alloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. */ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; +static void phannot_( + void *aap, /* The parser */ + int aamajor, /* The major token code number */ + phannot_TOKENTYPE aaminor /* The value for the token */ + phannot_ARG_PDECL /* Optional %extra_argument parameter */ +){ + AAMINORTYPE aaminorunion; + int aaact; /* The parser action. */ + int aaendofinput; /* True if we are at the end of input */ + int aaerrorhit = 0; /* True if aamajor has invoked an error */ + aaParser *aapParser; /* The parser */ -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; + /* (re)initialize the parser, if necessary */ + aapParser = (aaParser*)aap; + if( aapParser->aaidx<0 ){ + if( aamajor==0 ) return; + aapParser->aaidx = 0; + aapParser->aaerrcnt = -1; + aapParser->aastack[0].stateno = 0; + aapParser->aastack[0].major = 0; } - return np ? np->data : 0; -} + aaminorunion.aa0 = aaminor; + aaendofinput = (aamajor==0); + phannot_ARG_STORE; -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; +#endif -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; + do{ + aaact = aa_find_shift_action(aapParser,aamajor); + if( aaactaaerrcnt--; + if( aaendofinput && aapParser->aaidx>=0 ){ + aamajor = 0; + }else{ + aamajor = AANOCODE; + } + }else if( aaact < AANSTATE + AANRULE ){ + aa_reduce(aapParser,aaact-AANSTATE); + }else if( aaact == AA_ERROR_ACTION ){ + int aamx; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); + } +#endif +#ifdef AAERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( aapParser->aaerrcnt<0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aamx = aapParser->aastack[aapParser->aaidx].major; + if( aamx==AAERRORSYMBOL || aaerrorhit ){ +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sDiscard input token %s\n", + aaTracePrompt,aaTokenName[aamajor]); + } +#endif + aa_destructor(aamajor,&aaminorunion); + aamajor = AANOCODE; + }else{ + while( + aapParser->aaidx >= 0 && + aamx != AAERRORSYMBOL && + (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE + ){ + aa_pop_parser_stack(aapParser); + } + if( aapParser->aaidx < 0 || aamajor==0 ){ + aa_destructor(aamajor,&aaminorunion); + aa_parse_failed(aapParser); + aamajor = AANOCODE; + }else if( aamx!=AAERRORSYMBOL ){ + AAMINORTYPE u2; + u2.AAERRSYMDT = 0; + aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); + } + } + aapParser->aaerrcnt = 3; + aaerrorhit = 1; +#else /* AAERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( aapParser->aaerrcnt<=0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aapParser->aaerrcnt = 3; + aa_destructor(aamajor,&aaminorunion); + if( aaendofinput ){ + aa_parse_failed(aapParser); + } + aamajor = AANOCODE; +#endif }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; + aa_accept(aapParser); + aamajor = AANOCODE; } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; + }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 28 "parser.php7.lemon" + + +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -36342,41 +31641,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** AACODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** AANOCODE is a number of type AACODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** AAFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** AAACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phannot_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** AAMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval aa8; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -36386,670 +31702,55 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < AANSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == AANSTATE+AANRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == AANSTATE+AANRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named aa_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** aa_action[ aa_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** aa_reduce_ofst[] For each state, the offset into aa_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. +** aa_default[] Default action for each state. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval* aa36; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; static AACODETYPE aa_lookahead[] = { /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, @@ -37245,7 +31946,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 15: case 16: case 17: -// 77 "parser.php5.lemon" +// 77 "parser.php7.lemon" { if ((aapminor->aa0)) { if ((aapminor->aa0)->free_flag) { @@ -37254,7 +31955,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ efree((aapminor->aa0)); } } -// 378 "parser.php5.c" +// 378 "parser.php7.c" break; case 20: case 21: @@ -37262,11 +31963,11 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 23: case 24: case 25: -// 90 "parser.php5.lemon" +// 90 "parser.php7.lemon" { - zval_ptr_dtor(&(aapminor->aa36)); + zval_ptr_dtor(&(aapminor->aa8)); } -// 390 "parser.php5.c" +// 390 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } @@ -37461,166 +32162,166 @@ static void aa_reduce( ** break; */ case 0: -// 86 "parser.php5.lemon" +// 86 "parser.php7.lemon" { - status->ret = aamsp[0].minor.aa36; + ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); } -// 632 "parser.php5.c" +// 632 "parser.php7.c" break; case 1: case 14: case 15: -// 94 "parser.php5.lemon" +// 94 "parser.php7.lemon" { - aagotominor.aa36 = aamsp[0].minor.aa36; + aagotominor.aa8 = aamsp[0].minor.aa8; } -// 641 "parser.php5.c" +// 641 "parser.php7.c" break; case 2: -// 102 "parser.php5.lemon" +// 102 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); } -// 648 "parser.php5.c" +// 648 "parser.php7.c" break; case 3: case 8: -// 106 "parser.php5.lemon" +// 106 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 656 "parser.php5.c" +// 656 "parser.php7.c" break; case 4: -// 114 "parser.php5.lemon" +// 114 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); aa_destructor(2,&aamsp[-4].minor); aa_destructor(4,&aamsp[-2].minor); aa_destructor(5,&aamsp[0].minor); } -// 666 "parser.php5.c" +// 666 "parser.php7.c" break; case 5: -// 118 "parser.php5.lemon" +// 118 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-3].minor); aa_destructor(4,&aamsp[-1].minor); aa_destructor(5,&aamsp[0].minor); } -// 676 "parser.php5.c" +// 676 "parser.php7.c" break; case 6: -// 122 "parser.php5.lemon" +// 122 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-1].minor); } -// 684 "parser.php5.c" +// 684 "parser.php7.c" break; case 7: -// 130 "parser.php5.lemon" +// 130 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); aa_destructor(1,&aamsp[-1].minor); } -// 692 "parser.php5.c" +// 692 "parser.php7.c" break; case 9: -// 142 "parser.php5.lemon" +// 142 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 699 "parser.php5.c" +// 699 "parser.php7.c" break; case 10: case 12: -// 146 "parser.php5.lemon" +// 146 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(7,&aamsp[-1].minor); } -// 708 "parser.php5.c" +// 708 "parser.php7.c" break; case 11: case 13: -// 150 "parser.php5.lemon" +// 150 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(8,&aamsp[-1].minor); } -// 717 "parser.php5.c" +// 717 "parser.php7.c" break; case 16: -// 174 "parser.php5.lemon" +// 174 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } -// 724 "parser.php5.c" +// 724 "parser.php7.c" break; case 17: -// 178 "parser.php5.lemon" +// 178 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } -// 731 "parser.php5.c" +// 731 "parser.php7.c" break; case 18: -// 182 "parser.php5.lemon" +// 182 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); } -// 738 "parser.php5.c" +// 738 "parser.php7.c" break; case 19: -// 186 "parser.php5.lemon" +// 186 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); } -// 745 "parser.php5.c" +// 745 "parser.php7.c" break; case 20: -// 190 "parser.php5.lemon" +// 190 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); aa_destructor(11,&aamsp[0].minor); } -// 753 "parser.php5.c" +// 753 "parser.php7.c" break; case 21: -// 194 "parser.php5.lemon" +// 194 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); aa_destructor(12,&aamsp[0].minor); } -// 761 "parser.php5.c" +// 761 "parser.php7.c" break; case 22: -// 198 "parser.php5.lemon" +// 198 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); aa_destructor(13,&aamsp[0].minor); } -// 769 "parser.php5.c" +// 769 "parser.php7.c" break; case 23: -// 202 "parser.php5.lemon" +// 202 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(14,&aamsp[-2].minor); aa_destructor(15,&aamsp[0].minor); } -// 778 "parser.php5.c" +// 778 "parser.php7.c" break; case 24: -// 206 "parser.php5.lemon" +// 206 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(16,&aamsp[-2].minor); aa_destructor(17,&aamsp[0].minor); } -// 787 "parser.php5.c" +// 787 "parser.php7.c" break; }; aagoto = aaRuleInfo[aaruleno].lhs; @@ -37656,7 +32357,7 @@ static void aa_syntax_error( ){ phannot_ARG_FETCH; #define ATOKEN (aaminor.aa0) -// 32 "parser.php5.lemon" +// 32 "parser.php7.lemon" if (status->scanner_state->start_length) { char *token_name = NULL; @@ -37701,7 +32402,7 @@ static void aa_syntax_error( status->status = PHANNOT_PARSING_FAILED; -// 874 "parser.php5.c" +// 874 "parser.php7.c" phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -37869,1082 +32570,133 @@ static void phannot_( }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php7.lemon" - - -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval aa8; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static AACODETYPE aa_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define AA_SHIFT_USE_DFLT (-3) -static signed char aa_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define AA_REDUCE_USE_DFLT (-21) -static signed char aa_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static AAACTIONTYPE aa_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef AAFALLBACK -static const AACODETYPE aaFallback[] = { +const phannot_token_names phannot_tokens[] = +{ + { "INTEGER", PHANNOT_T_INTEGER }, + { "DOUBLE", PHANNOT_T_DOUBLE }, + { "STRING", PHANNOT_T_STRING }, + { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, + { "@", PHANNOT_T_AT }, + { ",", PHANNOT_T_COMMA }, + { "=", PHANNOT_T_EQUALS }, + { ":", PHANNOT_T_COLON }, + { "(", PHANNOT_T_PARENTHESES_OPEN }, + { ")", PHANNOT_T_PARENTHESES_CLOSE }, + { "{", PHANNOT_T_BRACKET_OPEN }, + { "}", PHANNOT_T_BRACKET_CLOSE }, + { "[", PHANNOT_T_SBRACKET_OPEN }, + { "]", PHANNOT_T_SBRACKET_CLOSE }, + { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, + { NULL, 0 } }; -#endif /* AAFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct aaStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - AAMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct aaStackEntry aaStackEntry; +static void *phannot_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct aaParser { - int aaidx; /* Index of top element in stack */ - int aaerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ -}; -typedef struct aaParser aaParser; +static void phannot_wrapper_free(void *pointer){ + efree(pointer); +} -#ifndef NDEBUG -static FILE *aaTraceFILE = 0; -static char *aaTracePrompt = 0; -#endif /* NDEBUG */ +static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - aaTraceFILE = TraceFILE; - aaTracePrompt = zTracePrompt; - if( aaTraceFILE==0 ) aaTracePrompt = 0; - else if( aaTracePrompt==0 ) aaTraceFILE = 0; -} -#endif /* NDEBUG */ + phannot_parser_token *pToken; -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *aaTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ + pToken = emalloc(sizeof(phannot_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *aaRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + phannot_(phannot_parser, parsercode, pToken, parser_status); -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ - return aaTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif + token->value = NULL; + token->len = 0; } -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - aaParser *pParser; - pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); - if( pParser ){ - pParser->aaidx = -1; - } - return pParser; +static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ + + phannot_scanner_state *state = parser_status->scanner_state; + + if (state->start) { + if (state->start_length > 16) { + spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); + } else { + spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); + } + } else { + spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); + } } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "aamajor" is the symbol code, and "aapminor" is a pointer to -** the value. -*/ -static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ - switch( aamajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -// 77 "parser.php7.lemon" -{ - if ((aapminor->aa0)) { - if ((aapminor->aa0)->free_flag) { - efree((aapminor->aa0)->token); +static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { + + char *comment_str; + int comment_len; + char *file_path_str; + int line_num; + + char *error_msg = NULL; + + ZVAL_NULL(result); + + if (Z_TYPE_P(comment) == IS_STRING) { + comment_str = Z_STRVAL_P(comment); + comment_len = Z_STRLEN_P(comment); + } else { + comment_str = ""; + comment_len = 0; + } + + if (Z_TYPE_P(file_path) == IS_STRING) { + file_path_str = Z_STRVAL_P(file_path); + } else { + file_path_str = "eval"; + } + + if (Z_TYPE_P(line) == IS_LONG) { + line_num = Z_LVAL_P(line); + } else { + line_num = 0; + } + + if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { + if (likely(error_msg != NULL)) { + zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); + efree(error_msg); + } else { + zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); } - efree((aapminor->aa0)); + + return FAILURE; } + + return SUCCESS; } -// 378 "parser.php7.c" - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -// 90 "parser.php7.lemon" + +static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) { - zval_ptr_dtor(&(aapminor->aa8)); -} -// 390 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} + char ch; + int start_mode = 1, j, i, open_parentheses; + smart_str processed_str = {0}; -static int aa_pop_parser_stack(aaParser *pParser){ - AACODETYPE aamajor; - aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + (*start_lines) = 0; - if( pParser->aaidx<0 ) return 0; -#ifndef NDEBUG - if( aaTraceFILE && pParser->aaidx>=0 ){ - fprintf(aaTraceFILE,"%sPopping %s\n", - aaTracePrompt, - aaTokenName[aatos->major]); - } -#endif - aamajor = aatos->major; - aa_destructor( aamajor, &aatos->minor); - pParser->aaidx--; - return aamajor; -} + for (i = 0; i < length; i++) { -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - aaParser *pParser = (aaParser*)p; - if( pParser==0 ) return; - while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} + ch = comment[i]; -static int aa_find_shift_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ - i = aa_shift_ofst[stateno]; - if( i==AA_SHIFT_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ -#ifdef AAFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); - } -#endif - return aa_find_shift_action(pParser, iFallback); - } -#endif - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} + if (start_mode) { + if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { + continue; + } + start_mode = 0; + } -static int aa_find_reduce_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - i = aa_reduce_ofst[stateno]; - if( i==AA_REDUCE_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} - -static void aa_shift( - aaParser *aapParser, /* The parser to be shifted */ - int aaNewState, /* The new state to shift in */ - int aaMajor, /* The major token to shift in */ - AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ -){ - aaStackEntry *aatos; - aapParser->aaidx++; - if( aapParser->aaidx>=AASTACKDEPTH ){ - phannot_ARG_FETCH; - aapParser->aaidx--; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - aatos = &aapParser->aastack[aapParser->aaidx]; - aatos->stateno = aaNewState; - aatos->major = aaMajor; - aatos->minor = *aapMinor; -#ifndef NDEBUG - if( aaTraceFILE && aapParser->aaidx>0 ){ - int i; - fprintf(aaTraceFILE,"%sShift %d\n",aaTracePrompt,aaNewState); - fprintf(aaTraceFILE,"%sStack:",aaTracePrompt); - for(i=1; i<=aapParser->aaidx; i++) - fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); - fprintf(aaTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} aaRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; - -static void aa_accept(aaParser*); /* Forward Declaration */ - -static void aa_reduce( - aaParser *aapParser, /* The parser */ - int aaruleno /* Number of the rule by which to reduce */ -){ - int aagoto; /* The next state */ - int aaact; /* The next action */ - AAMINORTYPE aagotominor; /* The LHS of the rule reduced */ - aaStackEntry *aamsp; /* The top of the parser's stack */ - int aasize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - aamsp = &aapParser->aastack[aapParser->aaidx]; -#ifndef NDEBUG - if( aaTraceFILE && aaruleno>=0 - && aaruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 86 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); -} -// 632 "parser.php7.c" - break; - case 1: - case 14: - case 15: -// 94 "parser.php7.lemon" -{ - aagotominor.aa8 = aamsp[0].minor.aa8; -} -// 641 "parser.php7.c" - break; - case 2: -// 102 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); -} -// 648 "parser.php7.c" - break; - case 3: - case 8: -// 106 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 656 "parser.php7.c" - break; - case 4: -// 114 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); - aa_destructor(2,&aamsp[-4].minor); - aa_destructor(4,&aamsp[-2].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 666 "parser.php7.c" - break; - case 5: -// 118 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-3].minor); - aa_destructor(4,&aamsp[-1].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 676 "parser.php7.c" - break; - case 6: -// 122 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-1].minor); -} -// 684 "parser.php7.c" - break; - case 7: -// 130 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); - aa_destructor(1,&aamsp[-1].minor); -} -// 692 "parser.php7.c" - break; - case 9: -// 142 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 699 "parser.php7.c" - break; - case 10: - case 12: -// 146 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(7,&aamsp[-1].minor); -} -// 708 "parser.php7.c" - break; - case 11: - case 13: -// 150 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(8,&aamsp[-1].minor); -} -// 717 "parser.php7.c" - break; - case 16: -// 174 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); -} -// 724 "parser.php7.c" - break; - case 17: -// 178 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); -} -// 731 "parser.php7.c" - break; - case 18: -// 182 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); -} -// 738 "parser.php7.c" - break; - case 19: -// 186 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); -} -// 745 "parser.php7.c" - break; - case 20: -// 190 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); - aa_destructor(11,&aamsp[0].minor); -} -// 753 "parser.php7.c" - break; - case 21: -// 194 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); - aa_destructor(12,&aamsp[0].minor); -} -// 761 "parser.php7.c" - break; - case 22: -// 198 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); - aa_destructor(13,&aamsp[0].minor); -} -// 769 "parser.php7.c" - break; - case 23: -// 202 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(14,&aamsp[-2].minor); - aa_destructor(15,&aamsp[0].minor); -} -// 778 "parser.php7.c" - break; - case 24: -// 206 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(16,&aamsp[-2].minor); - aa_destructor(17,&aamsp[0].minor); -} -// 787 "parser.php7.c" - break; - }; - aagoto = aaRuleInfo[aaruleno].lhs; - aasize = aaRuleInfo[aaruleno].nrhs; - aapParser->aaidx -= aasize; - aaact = aa_find_reduce_action(aapParser,aagoto); - if( aaact < AANSTATE ){ - aa_shift(aapParser,aaact,aagoto,&aagotominor); - }else if( aaact == AANSTATE + AANRULE + 1 ){ - aa_accept(aapParser); - } -} - -static void aa_parse_failed( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_syntax_error( - aaParser *aapParser, /* The parser */ - int aamajor, /* The major type of the error token */ - AAMINORTYPE aaminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define ATOKEN (aaminor.aa0) -// 32 "parser.php7.lemon" - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - - status->status = PHANNOT_PARSING_FAILED; - -// 874 "parser.php7.c" - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_accept( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *aap, /* The parser */ - int aamajor, /* The major token code number */ - phannot_TOKENTYPE aaminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - AAMINORTYPE aaminorunion; - int aaact; /* The parser action. */ - int aaendofinput; /* True if we are at the end of input */ - int aaerrorhit = 0; /* True if aamajor has invoked an error */ - aaParser *aapParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - aapParser = (aaParser*)aap; - if( aapParser->aaidx<0 ){ - if( aamajor==0 ) return; - aapParser->aaidx = 0; - aapParser->aaerrcnt = -1; - aapParser->aastack[0].stateno = 0; - aapParser->aastack[0].major = 0; - } - aaminorunion.aa0 = aaminor; - aaendofinput = (aamajor==0); - phannot_ARG_STORE; - -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); - } -#endif - - do{ - aaact = aa_find_shift_action(aapParser,aamajor); - if( aaactaaerrcnt--; - if( aaendofinput && aapParser->aaidx>=0 ){ - aamajor = 0; - }else{ - aamajor = AANOCODE; - } - }else if( aaact < AANSTATE + AANRULE ){ - aa_reduce(aapParser,aaact-AANSTATE); - }else if( aaact == AA_ERROR_ACTION ){ - int aamx; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); - } -#endif -#ifdef AAERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( aapParser->aaerrcnt<0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aamx = aapParser->aastack[aapParser->aaidx].major; - if( aamx==AAERRORSYMBOL || aaerrorhit ){ -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sDiscard input token %s\n", - aaTracePrompt,aaTokenName[aamajor]); - } -#endif - aa_destructor(aamajor,&aaminorunion); - aamajor = AANOCODE; - }else{ - while( - aapParser->aaidx >= 0 && - aamx != AAERRORSYMBOL && - (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE - ){ - aa_pop_parser_stack(aapParser); - } - if( aapParser->aaidx < 0 || aamajor==0 ){ - aa_destructor(aamajor,&aaminorunion); - aa_parse_failed(aapParser); - aamajor = AANOCODE; - }else if( aamx!=AAERRORSYMBOL ){ - AAMINORTYPE u2; - u2.AAERRSYMDT = 0; - aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); - } - } - aapParser->aaerrcnt = 3; - aaerrorhit = 1; -#else /* AAERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( aapParser->aaerrcnt<=0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aapParser->aaerrcnt = 3; - aa_destructor(aamajor,&aaminorunion); - if( aaendofinput ){ - aa_parse_failed(aapParser); - } - aamajor = AANOCODE; -#endif - }else{ - aa_accept(aapParser); - aamajor = AANOCODE; - } - }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); - return; -} -#endif - - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { + if (ch == '@') { smart_str_appendc(&processed_str, ch); i++; @@ -39241,2185 +32993,381 @@ static int phannot_internal_parse_annotations(zval **result, const char *comment } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval* yy36; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); + + zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reader, parse) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + HashTable *_3$$5, *_9$$10; + HashPosition _2$$5, _8$$10; + int ZEPHIR_LAST_CALL_STATUS, line = 0; + zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; + zval *className = NULL; -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &className_param); -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_get_strval(className, className_param); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + + ZEPHIR_INIT_VAR(annotations); + array_init(annotations); + ZEPHIR_INIT_VAR(reflection); + object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_VAR(classAnnotations); + ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { + zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); } - efree((yypminor->yy0)); } + ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); + zephir_check_call_status(); + if (zephir_fast_count_int(properties TSRMLS_CC)) { + line = 1; + ZEPHIR_INIT_VAR(annotationsProperties); + array_init(annotationsProperties); + zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); + for ( + ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) + ) { + ZEPHIR_GET_HVALUE(property, _4$$5); + ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(propertyAnnotations); + ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_6$$7); + ZVAL_LONG(_6$$7, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_7$$8); + zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); + zephir_check_call_status(); + if (zephir_fast_count_int(methods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(annotationsMethods); + array_init(annotationsMethods); + zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); + for ( + ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) + ) { + ZEPHIR_GET_HVALUE(method, _10$$10); + ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(methodAnnotations); + ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_13$$13); + zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); + } + } + RETURN_CCTOR(annotations); + } - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy36)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } + +static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *docBlock_param = NULL, *file = NULL, *line = NULL; + zval *docBlock = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); + + zephir_get_strval(docBlock, docBlock_param); + if (!file) { + ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(file); + } + if (!line) { + line = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(file) != IS_STRING) { + ZEPHIR_INIT_NVAR(file); + ZVAL_STRING(file, "eval code", 1); + } + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); + } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } + + +#ifdef HAVE_CONFIG_H #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; -static void yy_accept(yyParser*); /* Forward Declaration */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy36; -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy36 = yymsp[0].minor.yy36; -} - break; - case 2: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-1].minor.yy36, yymsp[0].minor.yy36); -} - break; - case 3: - case 8: -{ - yygotominor.yy36 = phannot_ret_zval_list(NULL, yymsp[0].minor.yy36); -} - break; - case 4: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-3].minor.yy0, yymsp[-1].minor.yy36, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-2].minor.yy36, yymsp[0].minor.yy36); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - yygotominor.yy36 = phannot_ret_named_item(NULL, yymsp[0].minor.yy36); -} - break; - case 10: - case 12: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} + return SUCCESS; -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - if (!token_name) { - token_name = "UNKNOWN"; - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - status->status = PHANNOT_PARSING_FAILED; - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } +#ifdef HAVE_CONFIG_H #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval yy8; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + zval *reflectionData = NULL; -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_fetch_params(0, 0, 1, &reflectionData); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); - } - efree((yypminor->yy0)); + if (!reflectionData) { + reflectionData = ZEPHIR_GLOBAL(global_null); } -} - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy8)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} + if (Z_TYPE_P(reflectionData) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); + } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; + zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; + int ZEPHIR_LAST_CALL_STATUS; -static void yy_accept(yyParser*); /* Forward Declaration */ + ZEPHIR_MM_GROW(); -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy8, 1, 1); -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy8 = yymsp[0].minor.yy8; -} - break; - case 2: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-1].minor.yy8, &yymsp[0].minor.yy8); -} - break; - case 3: - case 8: -{ - phannot_ret_zval_list(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 4: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-3].minor.yy0, &yymsp[-1].minor.yy8, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-2].minor.yy8, &yymsp[0].minor.yy8); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - phannot_ret_named_item(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 10: - case 12: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; + ZEPHIR_MM_GROW(); - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionMethods); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); + zephir_check_call_status(); + zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + RETURN_MM_BOOL(0); } + RETURN_CCTOR(annotations); - status->status = PHANNOT_PARSING_FAILED; - - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; + ZEPHIR_MM_GROW(); -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionProperties); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); + zephir_check_call_status(); + zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); + } + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); + } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + RETURN_CCTOR(annotations); - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; } +static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { + -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(this_ptr, "_reflectionData"); +} +static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { + int ZEPHIR_LAST_CALL_STATUS; + zval *data, *reflectionData = NULL; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); - zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); - return SUCCESS; + if (Z_TYPE_P(data) == IS_ARRAY) { + if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); + zephir_check_call_status(); + RETURN_MM(); + } + } + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Annotations_Reader, parse) { - HashTable *_3$$5, *_9$$10; - HashPosition _2$$5, _8$$10; - int ZEPHIR_LAST_CALL_STATUS, line = 0; - zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; - zval *className = NULL; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); - - zephir_get_strval(className, className_param); - - - ZEPHIR_INIT_VAR(annotations); - array_init(annotations); - ZEPHIR_INIT_VAR(reflection); - object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_VAR(classAnnotations); - ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { - zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); - zephir_check_call_status(); - if (zephir_fast_count_int(properties TSRMLS_CC)) { - line = 1; - ZEPHIR_INIT_VAR(annotationsProperties); - array_init(annotationsProperties); - zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); - for ( - ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) - ) { - ZEPHIR_GET_HVALUE(property, _4$$5); - ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(propertyAnnotations); - ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_6$$7); - ZVAL_LONG(_6$$7, line); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_7$$8); - zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); - zephir_check_call_status(); - if (zephir_fast_count_int(methods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(annotationsMethods); - array_init(annotationsMethods); - zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); - for ( - ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) - ) { - ZEPHIR_GET_HVALUE(method, _10$$10); - ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(methodAnnotations); - ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_13$$13); - zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); - } - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *docBlock_param = NULL, *file = NULL, *line = NULL; - zval *docBlock = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); - - zephir_get_strval(docBlock, docBlock_param); - if (!file) { - ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(file); - } - if (!line) { - line = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(file) != IS_STRING) { - ZEPHIR_INIT_NVAR(file); - ZVAL_STRING(file, "eval code", 1); - } - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations, ReaderInterface, phalcon, annotations_readerinterface, phalcon_annotations_readerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { - - zval *reflectionData = NULL; - - zephir_fetch_params(0, 0, 1, &reflectionData); - - if (!reflectionData) { - reflectionData = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(reflectionData) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { - - zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - annotations = zephir_fetch_nproperty_this(this_ptr, SL("_classAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionClass, _0$$3, SS("class"), 1 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collection); - object_init_ex(collection, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, collection, "__construct", NULL, 17, reflectionClass); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC); - RETURN_CCTOR(collection); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionMethods); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); - zephir_check_call_status(); - zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionProperties); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); - zephir_check_call_status(); - zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { - - - - RETURN_MEMBER(this_ptr, "_reflectionData"); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data, *reflectionData = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - - - - if (Z_TYPE_P(data) == IS_ARRAY) { - if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); - zephir_check_call_status(); - RETURN_MM(); - } - } - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); - zephir_check_call_status(); - RETURN_MM(); - -} - - - -/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ -// 1 "scanner.re" +/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ +// 1 "scanner.re" @@ -47040,9 +38988,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, delete) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { - zend_object_iterator *_2; + zend_object_iterator *_3; + zephir_nts_static zend_class_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_1 = NULL, _3$$5 = zval_used_for_init, *_4$$5 = NULL; + zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_2 = NULL, _4$$5 = zval_used_for_init, *_5$$5 = NULL; zval *prefix = NULL, *_0$$4; ZEPHIR_MM_GROW(); @@ -47067,29 +39016,34 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { ZEPHIR_INIT_VAR(keys); array_init(keys); ZEPHIR_INIT_VAR(apc); - object_init_ex(apc, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _1, prefixPattern); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_1); - _2 = zephir_get_iterator(apc TSRMLS_CC); - _2->funcs->rewind(_2 TSRMLS_CC); - for (;_2->funcs->valid(_2 TSRMLS_CC) == SUCCESS && !EG(exception); _2->funcs->move_forward(_2 TSRMLS_CC)) { - ZEPHIR_GET_IMKEY(key, _2); + if (!_1) { + _1 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(apc, _1); + if (zephir_has_constructor(apc TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2); + ZVAL_STRING(_2, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _2, prefixPattern); + zephir_check_temp_parameter(_2); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_2); + _3 = zephir_get_iterator(apc TSRMLS_CC); + _3->funcs->rewind(_3 TSRMLS_CC); + for (;_3->funcs->valid(_3 TSRMLS_CC) == SUCCESS && !EG(exception); _3->funcs->move_forward(_3 TSRMLS_CC)) { + ZEPHIR_GET_IMKEY(key, _3); { zval **ZEPHIR_TMP_ITERATOR_PTR; - _2->funcs->get_current_data(_2, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); - ZEPHIR_CPY_WRT(_1, (*ZEPHIR_TMP_ITERATOR_PTR)); + _3->funcs->get_current_data(_3, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); + ZEPHIR_CPY_WRT(_2, (*ZEPHIR_TMP_ITERATOR_PTR)); } - ZEPHIR_SINIT_NVAR(_3$$5); - ZVAL_LONG(&_3$$5, 5); - ZEPHIR_INIT_NVAR(_4$$5); - zephir_substr(_4$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_array_append(&keys, _4$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); + ZEPHIR_SINIT_NVAR(_4$$5); + ZVAL_LONG(&_4$$5, 5); + ZEPHIR_INIT_NVAR(_5$$5); + zephir_substr(_5$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_array_append(&keys, _5$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); } - _2->funcs->dtor(_2 TSRMLS_CC); + _3->funcs->dtor(_3 TSRMLS_CC); RETURN_CCTOR(keys); } @@ -47131,9 +39085,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, exists) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { + zephir_nts_static zend_class_entry *_3 = NULL; zend_object_iterator *_1; - zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_3, *_4$$3; - zephir_fcall_cache_entry *_5 = NULL; + zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_4, *_5$$3; + zephir_fcall_cache_entry *_6 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -47142,12 +39097,17 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { ZEPHIR_INIT_VAR(prefixPattern); ZEPHIR_CONCAT_SVS(prefixPattern, "/^_PHCA", _0, "/"); ZEPHIR_INIT_VAR(_2); - object_init_ex(_2, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_3); - ZVAL_STRING(_3, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _3, prefixPattern); - zephir_check_temp_parameter(_3); - zephir_check_call_status(); + if (!_3) { + _3 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(_2, _3); + if (zephir_has_constructor(_2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _4, prefixPattern); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } _1 = zephir_get_iterator(_2 TSRMLS_CC); _1->funcs->rewind(_1 TSRMLS_CC); for (;_1->funcs->valid(_1 TSRMLS_CC) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1 TSRMLS_CC)) { @@ -47156,8 +39116,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { _1->funcs->get_current_data(_1, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); ZEPHIR_CPY_WRT(item, (*ZEPHIR_TMP_ITERATOR_PTR)); } - zephir_array_fetch_string(&_4$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_5, 111, _4$$3); + zephir_array_fetch_string(&_5$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_6, 111, _5$$3); zephir_check_call_status(); } _1->funcs->dtor(_1 TSRMLS_CC); @@ -50047,10 +42007,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); - if (zephir_has_constructor(redis TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); + zephir_check_call_status(); ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { @@ -75944,7 +67902,7 @@ static PHP_METHOD(Phalcon_Http_Response, setStatusCode) { } if (ZEPHIR_IS_STRING_IDENTICAL(message, "")) { ZEPHIR_INIT_VAR(statusCodes); - zephir_create_array(statusCodes, 67, 0 TSRMLS_CC); + zephir_create_array(statusCodes, 63, 0 TSRMLS_CC); add_index_stringl(statusCodes, 100, SL("Continue"), 1); add_index_stringl(statusCodes, 101, SL("Switching Protocols"), 1); add_index_stringl(statusCodes, 102, SL("Processing"), 1); @@ -78737,9 +70695,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, check) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { zend_bool _26$$14; - zephir_fcall_cache_entry *_25 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, _30$$14, _31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; + zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_25$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, *_30$$14 = NULL, *_31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -78796,35 +70753,35 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { do { if (ZEPHIR_IS_LONG(_9$$4, 1)) { _10$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 255, _10$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 0, _10$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _11$$6 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 2)) { _12$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 256, _12$$7); + ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 0, _12$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _13$$7 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 3)) { _14$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 257, _14$$8); + ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 0, _14$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _15$$8 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 15)) { _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 258, _16$$9); + ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 0, _16$$9); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _17$$9 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 16)) { _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 259, _18$$10); + ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 0, _18$$10); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _19$$10 TSRMLS_CC); break; @@ -78849,7 +70806,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { } while(0); _24$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _24$$4, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_25$$4); + ZVAL_BOOL(_25$$4, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _24$$4, _25$$4); zephir_check_call_status(); } else { _26$$14 = !width; @@ -78868,18 +70827,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_SINIT_VAR(_30$$14); - ZVAL_LONG(&_30$$14, width); - ZEPHIR_SINIT_VAR(_31$$14); - ZVAL_LONG(&_31$$14, height); - ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 261, &_30$$14, &_31$$14); + ZEPHIR_INIT_VAR(_30$$14); + ZVAL_LONG(_30$$14, width); + ZEPHIR_INIT_VAR(_31$$14); + ZVAL_LONG(_31$$14, height); + ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 0, _30$$14, _31$$14); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _32$$14 TSRMLS_CC); _33$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _33$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _33$$14, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _34$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _34$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_30$$14); + ZVAL_BOOL(_30$$14, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _34$$14, _30$$14); zephir_check_call_status(); _35$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_realpath"), _35$$14 TSRMLS_CC); @@ -78903,8 +70864,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { zend_bool _4$$3, _8$$4; - zephir_fcall_cache_entry *_9 = NULL, *_19 = NULL, *_32 = NULL, *_34 = NULL; - zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_20$$3, *_21$$3, *_22$$3, _23$$3, _24$$3, _25$$3, _26$$3, _27$$3, _28$$3, *_29$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, _13$$4, _14$$4, _15$$4, _16$$4, *_17$$4 = NULL, *_18$$6, *_30$$7, *_31$$7 = NULL, *_33$$7 = NULL, *_35$$8, _36$$8, _37$$8, *_38$$8, *_39$$8 = NULL, *_40$$8 = NULL; + zephir_fcall_cache_entry *_9 = NULL; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_19$$3 = NULL, *_20$$3 = NULL, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_25$$3, *_26$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, *_13$$4, *_14$$4, *_15$$4, *_16$$4, *_17$$4 = NULL, *_18$$6, *_27$$7, *_28$$7 = NULL, *_29$$7 = NULL, *_30$$8, *_31$$8, *_32$$8, *_33$$8, *_34$$8 = NULL, *_35$$8 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -78958,74 +70919,74 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { _10$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _11$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _12$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_13$$4); - ZVAL_LONG(&_13$$4, 0); - ZEPHIR_SINIT_VAR(_14$$4); - ZVAL_LONG(&_14$$4, 0); - ZEPHIR_SINIT_VAR(_15$$4); - ZVAL_LONG(&_15$$4, 0); - ZEPHIR_SINIT_VAR(_16$$4); - ZVAL_LONG(&_16$$4, 0); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 263, image, _10$$4, &_13$$4, &_14$$4, &_15$$4, &_16$$4, pre_width, pre_height, _11$$4, _12$$4); + ZEPHIR_INIT_VAR(_13$$4); + ZVAL_LONG(_13$$4, 0); + ZEPHIR_INIT_VAR(_14$$4); + ZVAL_LONG(_14$$4, 0); + ZEPHIR_INIT_VAR(_15$$4); + ZVAL_LONG(_15$$4, 0); + ZEPHIR_INIT_VAR(_16$$4); + ZVAL_LONG(_16$$4, 0); + ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 0, image, _10$$4, _13$$4, _14$$4, _15$$4, _16$$4, pre_width, pre_height, _11$$4, _12$$4); zephir_check_call_status(); if (zephir_is_true(_17$$4)) { _18$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _18$$6); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); } } + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, width); ZEPHIR_INIT_VAR(_20$$3); - ZVAL_LONG(_20$$3, width); - ZEPHIR_INIT_VAR(_21$$3); - ZVAL_LONG(_21$$3, height); - ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _20$$3, _21$$3); - zephir_check_call_status(); - _22$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, 0); - ZEPHIR_SINIT_VAR(_24$$3); - ZVAL_LONG(&_24$$3, 0); - ZEPHIR_SINIT_VAR(_25$$3); - ZVAL_LONG(&_25$$3, 0); - ZEPHIR_SINIT_VAR(_26$$3); - ZVAL_LONG(&_26$$3, 0); - ZEPHIR_SINIT_VAR(_27$$3); - ZVAL_LONG(&_27$$3, width); - ZEPHIR_SINIT_VAR(_28$$3); - ZVAL_LONG(&_28$$3, height); - ZEPHIR_CALL_FUNCTION(&_29$$3, "imagecopyresampled", NULL, 265, image, _22$$3, &_23$$3, &_24$$3, &_25$$3, &_26$$3, &_27$$3, &_28$$3, pre_width, pre_height); - zephir_check_call_status(); - if (zephir_is_true(_29$$3)) { - _30$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _30$$7); + ZVAL_LONG(_20$$3, height); + ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _19$$3, _20$$3); + zephir_check_call_status(); + _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_NVAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, 0); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, width); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, height); + ZEPHIR_CALL_FUNCTION(&_26$$3, "imagecopyresampled", NULL, 0, image, _21$$3, _19$$3, _20$$3, _22$$3, _23$$3, _24$$3, _25$$3, pre_width, pre_height); + zephir_check_call_status(); + if (zephir_is_true(_26$$3)) { + _27$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _27$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_31$$7, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_28$$7, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _31$$7 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33$$7, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _28$$7 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_29$$7, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33$$7 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _29$$7 TSRMLS_CC); } } else { - _35$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_36$$8); - ZVAL_LONG(&_36$$8, width); - ZEPHIR_SINIT_VAR(_37$$8); - ZVAL_LONG(&_37$$8, height); - ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 268, _35$$8, &_36$$8, &_37$$8); + _30$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_31$$8); + ZVAL_LONG(_31$$8, width); + ZEPHIR_INIT_VAR(_32$$8); + ZVAL_LONG(_32$$8, height); + ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 0, _30$$8, _31$$8, _32$$8); zephir_check_call_status(); - _38$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _38$$8); + _33$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _33$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_39$$8, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_34$$8, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _39$$8 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_40$$8, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _34$$8 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_35$$8, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _40$$8 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _35$$8 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79033,8 +70994,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { - zephir_fcall_cache_entry *_16 = NULL, *_18 = NULL, *_20 = NULL; - zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, *_14$$3 = NULL, *_15$$4, *_17$$4 = NULL, *_19$$4 = NULL, *_21$$5 = NULL, *_22$$5, *_23$$5, *_24$$5 = NULL, *_25$$5 = NULL; + zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3 = NULL, *_4$$3 = NULL, *_5$$3, *_6$$3, *_7$$3, *_8$$3, *_9$$3, *_10$$3, *_11$$3, *_12$$3 = NULL, *_13$$4, *_14$$4 = NULL, *_15$$4 = NULL, *_16$$5 = NULL, *_17$$5, *_18$$5, *_19$$5 = NULL, *_20$$5 = NULL; int width, height, offsetX, offsetY, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79060,64 +71020,64 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", NULL, 0, _3$$3, _4$$3); zephir_check_call_status(); _5$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_VAR(_7$$3); - ZVAL_LONG(&_7$$3, 0); - ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, offsetX); - ZEPHIR_SINIT_VAR(_9$$3); - ZVAL_LONG(&_9$$3, offsetY); - ZEPHIR_SINIT_VAR(_10$$3); - ZVAL_LONG(&_10$$3, width); - ZEPHIR_SINIT_VAR(_11$$3); - ZVAL_LONG(&_11$$3, height); - ZEPHIR_SINIT_VAR(_12$$3); - ZVAL_LONG(&_12$$3, width); - ZEPHIR_SINIT_VAR(_13$$3); - ZVAL_LONG(&_13$$3, height); - ZEPHIR_CALL_FUNCTION(&_14$$3, "imagecopyresampled", NULL, 265, image, _5$$3, &_6$$3, &_7$$3, &_8$$3, &_9$$3, &_10$$3, &_11$$3, &_12$$3, &_13$$3); + ZEPHIR_INIT_NVAR(_3$$3); + ZVAL_LONG(_3$$3, 0); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, 0); + ZEPHIR_INIT_VAR(_6$$3); + ZVAL_LONG(_6$$3, offsetX); + ZEPHIR_INIT_VAR(_7$$3); + ZVAL_LONG(_7$$3, offsetY); + ZEPHIR_INIT_VAR(_8$$3); + ZVAL_LONG(_8$$3, width); + ZEPHIR_INIT_VAR(_9$$3); + ZVAL_LONG(_9$$3, height); + ZEPHIR_INIT_VAR(_10$$3); + ZVAL_LONG(_10$$3, width); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, height); + ZEPHIR_CALL_FUNCTION(&_12$$3, "imagecopyresampled", NULL, 0, image, _5$$3, _3$$3, _4$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3); zephir_check_call_status(); - if (zephir_is_true(_14$$3)) { - _15$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _15$$4); + if (zephir_is_true(_12$$3)) { + _13$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_14$$4, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _17$$4 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_19$$4, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _14$$4 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_15$$4, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _19$$4 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _15$$4 TSRMLS_CC); } } else { ZEPHIR_INIT_VAR(rect); zephir_create_array(rect, 4, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$5); - ZVAL_LONG(_21$$5, offsetX); - zephir_array_update_string(&rect, SL("x"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, offsetY); - zephir_array_update_string(&rect, SL("y"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, width); - zephir_array_update_string(&rect, SL("width"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, height); - zephir_array_update_string(&rect, SL("height"), &_21$$5, PH_COPY | PH_SEPARATE); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 269, _22$$5, rect); - zephir_check_call_status(); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _23$$5); + ZEPHIR_INIT_VAR(_16$$5); + ZVAL_LONG(_16$$5, offsetX); + zephir_array_update_string(&rect, SL("x"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, offsetY); + zephir_array_update_string(&rect, SL("y"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, width); + zephir_array_update_string(&rect, SL("width"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, height); + zephir_array_update_string(&rect, SL("height"), &_16$$5, PH_COPY | PH_SEPARATE); + _17$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 0, _17$$5, rect); + zephir_check_call_status(); + _18$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_24$$5, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_19$$5, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _24$$5 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$5, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _19$$5 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_20$$5, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _25$$5 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _20$$5 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79125,7 +71085,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { - zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1 = zval_used_for_init, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, *_5, *_6, _7, *_8 = NULL, *_9$$3; + zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1, _2, _3, _4, *_5, *_6 = NULL, *_7 = NULL, *_8, *_9, *_10, *_11, *_12 = NULL, *_13$$3; int degrees, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79143,37 +71103,39 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { ZVAL_LONG(&_3, 0); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, 127); - ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 270, _0, &_1, &_2, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 256, _0, &_1, &_2, &_3, &_4); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, (360 - degrees)); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 1); - ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 271, _5, &_1, transparent, &_2); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, (360 - degrees)); + ZEPHIR_INIT_VAR(_7); + ZVAL_LONG(_7, 1); + ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 0, _5, _6, transparent, _7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_6); + ZVAL_BOOL(_6, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _6); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 0, image); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 267, image); + ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 0, image); zephir_check_call_status(); - _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 100); - ZEPHIR_CALL_FUNCTION(&_8, "imagecopymerge", NULL, 272, _6, image, &_1, &_2, &_3, &_4, width, height, &_7); + _8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_INIT_NVAR(_7); + ZVAL_LONG(_7, 0); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 100); + ZEPHIR_CALL_FUNCTION(&_12, "imagecopymerge", NULL, 0, _8, image, _6, _7, _9, _10, width, height, _11); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _9$$3); + if (zephir_is_true(_12)) { + _13$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_width"), width TSRMLS_CC); @@ -79185,8 +71147,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { - zephir_fcall_cache_entry *_14 = NULL, *_29 = NULL; - zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_24$$3, *_25$$3 = NULL, *_26$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, _9$$5 = zval_used_for_init, _10$$5 = zval_used_for_init, _11$$5 = zval_used_for_init, _12$$5 = zval_used_for_init, _13$$5 = zval_used_for_init, *_15$$6, *_16$$7, *_17$$7, *_18$$7, _19$$7 = zval_used_for_init, _20$$7 = zval_used_for_init, _21$$7 = zval_used_for_init, _22$$7 = zval_used_for_init, _23$$7 = zval_used_for_init, *_27$$9, _28$$9, *_30$$10, _31$$10; + zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_23$$3, *_24$$3 = NULL, *_25$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, *_9$$5 = NULL, *_10$$5 = NULL, *_11$$5 = NULL, *_12$$5 = NULL, *_13$$5 = NULL, *_14$$6, *_15$$7, *_16$$7, *_17$$7, *_18$$7 = NULL, *_19$$7 = NULL, *_20$$7 = NULL, *_21$$7 = NULL, *_22$$7 = NULL, *_26$$9, *_27$$9, *_28$$10, *_29$$10; int direction, ZEPHIR_LAST_CALL_STATUS, x = 0; ZEPHIR_MM_GROW(); @@ -79217,66 +71178,66 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_9$$5); - ZVAL_LONG(&_9$$5, x); - ZEPHIR_SINIT_NVAR(_10$$5); - ZVAL_LONG(&_10$$5, 0); - ZEPHIR_SINIT_NVAR(_11$$5); - ZVAL_LONG(&_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); - ZEPHIR_SINIT_NVAR(_12$$5); - ZVAL_LONG(&_12$$5, 0); - ZEPHIR_SINIT_NVAR(_13$$5); - ZVAL_LONG(&_13$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _6$$5, &_9$$5, &_10$$5, &_11$$5, &_12$$5, &_13$$5, _8$$5); + ZEPHIR_INIT_NVAR(_9$$5); + ZVAL_LONG(_9$$5, x); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_LONG(_10$$5, 0); + ZEPHIR_INIT_NVAR(_11$$5); + ZVAL_LONG(_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); + ZEPHIR_INIT_NVAR(_12$$5); + ZVAL_LONG(_12$$5, 0); + ZEPHIR_INIT_NVAR(_13$$5); + ZVAL_LONG(_13$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _6$$5, _9$$5, _10$$5, _11$$5, _12$$5, _13$$5, _8$$5); zephir_check_call_status(); } } else { x = 0; while (1) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - if (!(ZEPHIR_GT_LONG(_15$$6, x))) { + _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + if (!(ZEPHIR_GT_LONG(_14$$6, x))) { break; } x++; - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _18$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, 0); - ZEPHIR_SINIT_NVAR(_20$$7); - ZVAL_LONG(&_20$$7, x); - ZEPHIR_SINIT_NVAR(_21$$7); - ZVAL_LONG(&_21$$7, 0); - ZEPHIR_SINIT_NVAR(_22$$7); - ZVAL_LONG(&_22$$7, ((zephir_get_numberval(_17$$7) - x) - 1)); - ZEPHIR_SINIT_NVAR(_23$$7); - ZVAL_LONG(&_23$$7, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _16$$7, &_19$$7, &_20$$7, &_21$$7, &_22$$7, _18$$7, &_23$$7); + _15$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_18$$7); + ZVAL_LONG(_18$$7, 0); + ZEPHIR_INIT_NVAR(_19$$7); + ZVAL_LONG(_19$$7, x); + ZEPHIR_INIT_NVAR(_20$$7); + ZVAL_LONG(_20$$7, 0); + ZEPHIR_INIT_NVAR(_21$$7); + ZVAL_LONG(_21$$7, ((zephir_get_numberval(_16$$7) - x) - 1)); + ZEPHIR_INIT_NVAR(_22$$7); + ZVAL_LONG(_22$$7, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _15$$7, _18$$7, _19$$7, _20$$7, _21$$7, _17$$7, _22$$7); zephir_check_call_status(); } } - _24$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _24$$3); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _23$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&_24$$3, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _25$$3 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_26$$3, "imagesy", NULL, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _24$$3 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _26$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _25$$3 TSRMLS_CC); } else { if (direction == 11) { - _27$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_28$$9); - ZVAL_LONG(&_28$$9, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _27$$9, &_28$$9); + _26$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_27$$9); + ZEPHIR_GET_CONSTANT(_27$$9, "IMG_FLIP_HORIZONTAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _26$$9, _27$$9); zephir_check_call_status(); } else { - _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_31$$10); - ZVAL_LONG(&_31$$10, 2); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _30$$10, &_31$$10); + _28$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_29$$10); + ZEPHIR_GET_CONSTANT(_29$$10, "IMG_FLIP_VERTICAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _28$$10, _29$$10); zephir_check_call_status(); } } @@ -79287,7 +71248,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zval *_3 = NULL; - zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, _6, _7, *_8 = NULL, *_9$$3, *_10$$3 = NULL, *_11$$3, *_12$$3 = NULL; + zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, *_6, *_7 = NULL, *_8$$3, *_9$$3 = NULL, *_10$$3, *_11$$3 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79344,21 +71305,21 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zephir_array_fast_append(_3, _4); zephir_array_fast_append(matrix, _3); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6); - ZVAL_LONG(&_6, (amount - 8)); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(&_8, "imageconvolution", NULL, 275, _5, matrix, &_6, &_7); + ZEPHIR_INIT_NVAR(_4); + ZVAL_LONG(_4, (amount - 8)); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_CALL_FUNCTION(&_7, "imageconvolution", NULL, 0, _5, matrix, _4, _6); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_10$$3, "imagesx", NULL, 266, _9$$3); + if (zephir_is_true(_7)) { + _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_9$$3, "imagesx", NULL, 0, _8$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _10$$3 TSRMLS_CC); - _11$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_12$$3, "imagesy", NULL, 267, _11$$3); + zephir_update_property_this(this_ptr, SL("_width"), _9$$3 TSRMLS_CC); + _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_11$$3, "imagesy", NULL, 0, _10$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _12$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _11$$3 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79366,9 +71327,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { - zephir_fcall_cache_entry *_6 = NULL, *_13 = NULL, *_29 = NULL; + zephir_fcall_cache_entry *_6 = NULL; zend_bool fadeIn; - zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_3, *_4, *_5, *_7, *_8, *_9, _10, _11, _12, *_31, *_32 = NULL, *_33 = NULL, *_14$$5, *_15$$5, *_20$$5, *_21$$5 = NULL, *_22$$5, *_23$$5, _24$$5 = zval_used_for_init, _25$$5 = zval_used_for_init, _26$$5 = zval_used_for_init, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_30$$5, *_16$$6 = NULL, _17$$6 = zval_used_for_init, *_18$$7 = NULL, _19$$7 = zval_used_for_init; + zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1, *_2 = NULL, *_3, *_4, *_5 = NULL, *_7, *_8, *_9, *_10, *_11, *_12, *_29, *_30 = NULL, *_31 = NULL, *_13$$5, *_14$$5, *_19$$5, *_20$$5 = NULL, *_21$$5, *_22$$5, *_23$$5 = NULL, *_24$$5 = NULL, *_25$$5 = NULL, *_26$$5 = NULL, *_27$$5, *_28$$5 = NULL, *_15$$6 = NULL, _16$$6 = zval_used_for_init, *_17$$7 = NULL, _18$$7 = zval_used_for_init; int height, opacity, ZEPHIR_LAST_CALL_STATUS, stepping = 0, offset = 0, src_y = 0, dst_y = 0, dst_opacity = 0; ZEPHIR_MM_GROW(); @@ -79400,94 +71361,94 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { _7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _9 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, 0); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 0); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, _7, &_1, &_10, &_11, &_12, _8, _9); + ZEPHIR_INIT_NVAR(_5); + ZVAL_LONG(_5, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, _7, _5, _10, _11, _12, _8, _9); zephir_check_call_status(); offset = 0; while (1) { if (!(height >= offset)) { break; } + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + src_y = ((zephir_get_numberval(_13$$5) - offset) - 1); _14$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - src_y = ((zephir_get_numberval(_14$$5) - offset) - 1); - _15$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - dst_y = (zephir_get_numberval(_15$$5) + offset); + dst_y = (zephir_get_numberval(_14$$5) + offset); if (fadeIn) { - ZEPHIR_INIT_NVAR(_16$$6); - ZEPHIR_SINIT_NVAR(_17$$6); - ZVAL_LONG(&_17$$6, (opacity + ((stepping * ((height - offset)))))); - zephir_round(_16$$6, &_17$$6, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_16$$6); + ZEPHIR_INIT_NVAR(_15$$6); + ZEPHIR_SINIT_NVAR(_16$$6); + ZVAL_LONG(&_16$$6, (opacity + ((stepping * ((height - offset)))))); + zephir_round(_15$$6, &_16$$6, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_15$$6); } else { - ZEPHIR_INIT_NVAR(_18$$7); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, (opacity + ((stepping * offset)))); - zephir_round(_18$$7, &_19$$7, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_18$$7); - } - _20$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, 1); - ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _20$$5, _21$$5); - zephir_check_call_status(); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, src_y); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, line, _22$$5, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _23$$5, &_28$$5); - zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 4); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, dst_opacity); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_29, 276, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, &_28$$5); - zephir_check_call_status(); - _30$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, dst_y); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _30$$5, &_28$$5); + ZEPHIR_INIT_NVAR(_17$$7); + ZEPHIR_SINIT_NVAR(_18$$7); + ZVAL_LONG(&_18$$7, (opacity + ((stepping * offset)))); + zephir_round(_17$$7, &_18$$7, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_17$$7); + } + _19$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 1); + ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _19$$5, _20$$5); + zephir_check_call_status(); + _21$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 0); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, src_y); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, line, _21$$5, _20$$5, _23$$5, _24$$5, _25$$5, _22$$5, _26$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_20$$5); + ZEPHIR_GET_CONSTANT(_20$$5, "IMG_FILTER_COLORIZE"); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, dst_opacity); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, line, _20$$5, _23$$5, _24$$5, _25$$5, _26$$5); + zephir_check_call_status(); + _27$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, dst_y); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 0); + ZEPHIR_INIT_NVAR(_28$$5); + ZVAL_LONG(_28$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, line, _23$$5, _24$$5, _25$$5, _26$$5, _27$$5, _28$$5); zephir_check_call_status(); offset++; } - _31 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _31); + _29 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _29); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), reflection TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_32, "imagesx", NULL, 266, reflection); + ZEPHIR_CALL_FUNCTION(&_30, "imagesx", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _32 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33, "imagesy", NULL, 267, reflection); + zephir_update_property_this(this_ptr, SL("_width"), _30 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_31, "imagesy", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _31 TSRMLS_CC); ZEPHIR_MM_RESTORE(); } @@ -79495,7 +71456,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { int offsetX, offsetY, opacity, ZEPHIR_LAST_CALL_STATUS, width = 0, height = 0; - zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_9, *_10, _11, _12, _13, _14, _15, _16, *_17 = NULL, *_3$$3, _4$$3 = zval_used_for_init, *_5$$3 = NULL, _6$$3 = zval_used_for_init, _7$$3 = zval_used_for_init, _8$$3 = zval_used_for_init; + zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22 = NULL, *_4$$3, _5$$3 = zval_used_for_init, *_6$$3 = NULL, _7$$3, _8$$3, _9$$3, *_10$$3, *_11$$3, *_12$$3, *_13$$3, *_14$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &watermark, &offsetX_param, &offsetY_param, &opacity_param); @@ -79507,69 +71468,71 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { ZEPHIR_CALL_METHOD(&_0, watermark, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, overlay, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_1); + ZVAL_BOOL(_1, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, overlay, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, overlay); + ZEPHIR_CALL_FUNCTION(&_2, "imagesx", NULL, 0, overlay); zephir_check_call_status(); - width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, overlay); + width = zephir_get_intval(_2); + ZEPHIR_CALL_FUNCTION(&_3, "imagesy", NULL, 0, overlay); zephir_check_call_status(); - height = zephir_get_intval(_2); + height = zephir_get_intval(_3); if (opacity < 100) { - ZEPHIR_INIT_VAR(_3$$3); - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_DOUBLE(&_4$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_5$$3, "abs", NULL, 202, &_4$$3); + ZEPHIR_INIT_VAR(_4$$3); + ZEPHIR_SINIT_VAR(_5$$3); + ZVAL_DOUBLE(&_5$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); + ZEPHIR_CALL_FUNCTION(&_6$$3, "abs", NULL, 202, &_5$$3); zephir_check_call_status(); - zephir_round(_3$$3, _5$$3, NULL, NULL TSRMLS_CC); - opacity = zephir_get_intval(_3$$3); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 127); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 127); + zephir_round(_4$$3, _6$$3, NULL, NULL TSRMLS_CC); + opacity = zephir_get_intval(_4$$3); + ZEPHIR_SINIT_NVAR(_5$$3); + ZVAL_LONG(&_5$$3, 127); ZEPHIR_SINIT_VAR(_7$$3); ZVAL_LONG(&_7$$3, 127); ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3); + ZVAL_LONG(&_8$$3, 127); + ZEPHIR_SINIT_VAR(_9$$3); + ZVAL_LONG(&_9$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, overlay, &_5$$3, &_7$$3, &_8$$3, &_9$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 278, overlay, &_4$$3); + ZEPHIR_INIT_VAR(_10$$3); + ZEPHIR_GET_CONSTANT(_10$$3, "IMG_EFFECT_OVERLAY"); + ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 0, overlay, _10$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 0); - ZEPHIR_SINIT_NVAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_NVAR(_7$$3); - ZVAL_LONG(&_7$$3, width); - ZEPHIR_SINIT_NVAR(_8$$3); - ZVAL_LONG(&_8$$3, height); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 279, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3, color); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, 0); + ZEPHIR_INIT_VAR(_12$$3); + ZVAL_LONG(_12$$3, 0); + ZEPHIR_INIT_VAR(_13$$3); + ZVAL_LONG(_13$$3, width); + ZEPHIR_INIT_VAR(_14$$3); + ZVAL_LONG(_14$$3, height); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, overlay, _11$$3, _12$$3, _13$$3, _14$$3, color); zephir_check_call_status(); } - _9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _9, ZEPHIR_GLOBAL(global_true)); + _15 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _15, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); - _10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, offsetX); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, offsetY); - ZEPHIR_SINIT_VAR(_13); - ZVAL_LONG(&_13, 0); - ZEPHIR_SINIT_VAR(_14); - ZVAL_LONG(&_14, 0); - ZEPHIR_SINIT_VAR(_15); - ZVAL_LONG(&_15, width); - ZEPHIR_SINIT_VAR(_16); - ZVAL_LONG(&_16, height); - ZEPHIR_CALL_FUNCTION(&_17, "imagecopy", NULL, 273, _10, overlay, &_11, &_12, &_13, &_14, &_15, &_16); - zephir_check_call_status(); - if (zephir_is_true(_17)) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, overlay); + _16 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_1); + ZVAL_LONG(_1, offsetX); + ZEPHIR_INIT_VAR(_17); + ZVAL_LONG(_17, offsetY); + ZEPHIR_INIT_VAR(_18); + ZVAL_LONG(_18, 0); + ZEPHIR_INIT_VAR(_19); + ZVAL_LONG(_19, 0); + ZEPHIR_INIT_VAR(_20); + ZVAL_LONG(_20, width); + ZEPHIR_INIT_VAR(_21); + ZVAL_LONG(_21, height); + ZEPHIR_CALL_FUNCTION(&_22, "imagecopy", NULL, 0, _16, overlay, _1, _17, _18, _19, _20, _21); + zephir_check_call_status(); + if (zephir_is_true(_22)) { + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, overlay); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79579,9 +71542,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zend_bool _10$$3, _11$$3, _12$$3; - zephir_fcall_cache_entry *_3 = NULL, *_20 = NULL; + zephir_fcall_cache_entry *_3 = NULL, *_22 = NULL; int offsetX, offsetY, opacity, r, g, b, size, ZEPHIR_LAST_CALL_STATUS, angle = 0, s0, s1, s4, s5, width = 0, height = 0; - zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, _4$$3 = zval_used_for_init, _5$$3 = zval_used_for_init, *_13$$3 = NULL, *_14$$3 = NULL, *_17$$3, _18$$3 = zval_used_for_init, _19$$3 = zval_used_for_init, *_21$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_15$$6, *_16$$7, _22$$8 = zval_used_for_init, *_23$$8 = NULL, *_24$$8 = NULL, *_27$$8, _28$$8 = zval_used_for_init, _29$$8 = zval_used_for_init, _30$$8, *_31$$8, *_25$$9, *_26$$10; + zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, *_4$$3 = NULL, *_5$$3 = NULL, _13$$3 = zval_used_for_init, *_14$$3 = NULL, *_15$$3 = NULL, *_18$$3, _19$$3, _20$$3, _21$$3, *_23$$3, *_24$$3, *_25$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_16$$6, *_17$$7, *_26$$8 = NULL, *_27$$8 = NULL, *_28$$8 = NULL, *_31$$8, _32$$8, _33$$8, _34$$8, _35$$8, *_36$$8, *_37$$8, *_38$$8, *_29$$9, *_30$$10; zval *text = NULL, *fontfile = NULL; ZEPHIR_MM_GROW(); @@ -79610,11 +71573,11 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zephir_round(_0, _2, NULL, NULL TSRMLS_CC); opacity = zephir_get_intval(_0); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_VAR(_5$$3); - ZVAL_LONG(&_5$$3, 0); - ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 280, &_4$$3, &_5$$3, fontfile, text); + ZEPHIR_INIT_VAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_VAR(_5$$3); + ZVAL_LONG(_5$$3, 0); + ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 0, _4$$3, _5$$3, fontfile, text); zephir_check_call_status(); if (zephir_array_isset_long(space, 0)) { ZEPHIR_OBS_VAR(_6$$4); @@ -79646,85 +71609,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "Call to imagettfbbox() failed", "phalcon/image/adapter/gd.zep", 357); return; } - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s4 - s0)); - ZEPHIR_CALL_FUNCTION(&_13$$3, "abs", &_3, 202, &_4$$3); + ZEPHIR_SINIT_VAR(_13$$3); + ZVAL_LONG(&_13$$3, (s4 - s0)); + ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - width = (zephir_get_numberval(_13$$3) + 10); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s5 - s1)); - ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_4$$3); + width = (zephir_get_numberval(_14$$3) + 10); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, (s5 - s1)); + ZEPHIR_CALL_FUNCTION(&_15$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - height = (zephir_get_numberval(_14$$3) + 10); + height = (zephir_get_numberval(_15$$3) + 10); if (offsetX < 0) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_15$$6) - width) + offsetX); + _16$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_16$$6) - width) + offsetX); } if (offsetY < 0) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_16$$7) - height) + offsetY); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_17$$7) - height) + offsetY); } - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, r); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, g); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, b); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, r); ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _17$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3); + ZVAL_LONG(&_19$$3, g); + ZEPHIR_SINIT_VAR(_20$$3); + ZVAL_LONG(&_20$$3, b); + ZEPHIR_SINIT_VAR(_21$$3); + ZVAL_LONG(&_21$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _18$$3, &_13$$3, &_19$$3, &_20$$3, &_21$$3); zephir_check_call_status(); angle = 0; - _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, angle); - ZEPHIR_SINIT_NVAR(_18$$3); - ZVAL_LONG(&_18$$3, offsetX); - ZEPHIR_SINIT_NVAR(_19$$3); - ZVAL_LONG(&_19$$3, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 281, _21$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3, color, fontfile, text); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_NVAR(_5$$3); + ZVAL_LONG(_5$$3, angle); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, offsetX); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 0, _23$$3, _4$$3, _5$$3, _24$$3, _25$$3, color, fontfile, text); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_23$$8, "imagefontwidth", NULL, 282, &_22$$8); + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_27$$8, "imagefontwidth", NULL, 0, _26$$8); zephir_check_call_status(); - width = (zephir_get_intval(_23$$8) * zephir_fast_strlen_ev(text)); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_24$$8, "imagefontheight", NULL, 283, &_22$$8); + width = (zephir_get_intval(_27$$8) * zephir_fast_strlen_ev(text)); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_28$$8, "imagefontheight", NULL, 0, _26$$8); zephir_check_call_status(); - height = zephir_get_intval(_24$$8); + height = zephir_get_intval(_28$$8); if (offsetX < 0) { - _25$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_25$$9) - width) + offsetX); + _29$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_29$$9) - width) + offsetX); } if (offsetY < 0) { - _26$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_26$$10) - height) + offsetY); - } - _27$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, r); - ZEPHIR_SINIT_VAR(_28$$8); - ZVAL_LONG(&_28$$8, g); - ZEPHIR_SINIT_VAR(_29$$8); - ZVAL_LONG(&_29$$8, b); - ZEPHIR_SINIT_VAR(_30$$8); - ZVAL_LONG(&_30$$8, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _27$$8, &_22$$8, &_28$$8, &_29$$8, &_30$$8); - zephir_check_call_status(); + _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_30$$10) - height) + offsetY); + } _31$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_SINIT_NVAR(_28$$8); - ZVAL_LONG(&_28$$8, offsetX); - ZEPHIR_SINIT_NVAR(_29$$8); - ZVAL_LONG(&_29$$8, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 284, _31$$8, &_22$$8, &_28$$8, &_29$$8, text, color); + ZEPHIR_SINIT_VAR(_32$$8); + ZVAL_LONG(&_32$$8, r); + ZEPHIR_SINIT_VAR(_33$$8); + ZVAL_LONG(&_33$$8, g); + ZEPHIR_SINIT_VAR(_34$$8); + ZVAL_LONG(&_34$$8, b); + ZEPHIR_SINIT_VAR(_35$$8); + ZVAL_LONG(&_35$$8, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _31$$8, &_32$$8, &_33$$8, &_34$$8, &_35$$8); + zephir_check_call_status(); + _36$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_INIT_VAR(_37$$8); + ZVAL_LONG(_37$$8, offsetX); + ZEPHIR_INIT_VAR(_38$$8); + ZVAL_LONG(_38$$8, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 0, _36$$8, _26$$8, _37$$8, _38$$8, text, color); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79733,10 +71696,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { - zend_bool _12; - zephir_fcall_cache_entry *_3 = NULL, *_10 = NULL, *_24 = NULL, *_29 = NULL, *_30 = NULL, *_35 = NULL; + zend_bool _13; + zephir_fcall_cache_entry *_10 = NULL, *_29 = NULL, *_30 = NULL; int ZEPHIR_LAST_CALL_STATUS, mask_width = 0, mask_height = 0, x = 0, y = 0, alpha = 0; - zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4, *_5, _6 = zval_used_for_init, _7 = zval_used_for_init, _8, _9, *_11, *_13, *_25, *_36, *_14$$3, *_15$$3, *_16$$3, *_17$$3, _18$$3, _19$$3, _20$$3, _21$$3, _22$$3, _23$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_31$$6, _32$$6 = zval_used_for_init; + zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4, *_5, _6, _7, _8, _9, *_11, *_12, *_14, *_25, *_37, *_15$$3, *_16$$3, *_17$$3, *_18$$3, *_19$$3, *_20$$3, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_35$$5 = NULL, *_36$$5 = NULL, *_31$$6, _32$$6 = zval_used_for_init; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &mask); @@ -79745,22 +71708,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZEPHIR_CALL_METHOD(&_0, mask, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, maskImage); + ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 0, maskImage); zephir_check_call_status(); mask_width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, maskImage); + ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 0, maskImage); zephir_check_call_status(); mask_height = zephir_get_intval(_2); alpha = 127; - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, maskImage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, maskImage, _3); zephir_check_call_status(); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&newimage, this_ptr, "_create", NULL, 0, _4, _5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, newimage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, newimage, _3); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, 0); @@ -79770,42 +71737,42 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_8, 0); ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, &_6, &_7, &_8, &_9); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, &_6, &_7, &_8, &_9); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_6); - ZVAL_LONG(&_6, 0); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 285, newimage, &_6, &_7, color); + ZEPHIR_INIT_NVAR(_3); + ZVAL_LONG(_3, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 0, newimage, _3, _11, color); zephir_check_call_status(); - _11 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_11, mask_width); - if (!(_12)) { - _13 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_13, mask_height); + _12 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_12, mask_width); + if (!(_13)) { + _14 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_14, mask_height); } - if (_12) { - _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 261, _14$$3, _15$$3); - zephir_check_call_status(); - _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, 0); - ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, 0); - ZEPHIR_SINIT_VAR(_20$$3); - ZVAL_LONG(&_20$$3, 0); - ZEPHIR_SINIT_VAR(_21$$3); - ZVAL_LONG(&_21$$3, 0); - ZEPHIR_SINIT_VAR(_22$$3); - ZVAL_LONG(&_22$$3, mask_width); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, mask_height); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 265, tempImage, maskImage, &_18$$3, &_19$$3, &_20$$3, &_21$$3, _16$$3, _17$$3, &_22$$3, &_23$$3); + if (_13) { + _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 0, _15$$3, _16$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_VAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_21$$3); + ZVAL_LONG(_21$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, mask_width); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, mask_height); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 0, tempImage, maskImage, _19$$3, _20$$3, _21$$3, _22$$3, _17$$3, _18$$3, _23$$3, _24$$3); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); ZEPHIR_CPY_WRT(maskImage, tempImage); } @@ -79825,9 +71792,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, maskImage, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, maskImage, &_27$$5, &_28$$5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, maskImage, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, maskImage, index); zephir_check_call_status(); if (zephir_array_isset_string(color, SS("red"))) { zephir_array_fetch_string(&_31$$6, color, SL("red"), PH_NOISY | PH_READONLY, "phalcon/image/adapter/gd.zep", 430 TSRMLS_CC); @@ -79840,10 +71807,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, _33$$5, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, _33$$5, &_27$$5, &_28$$5); zephir_check_call_status(); _34$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, _34$$5, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, _34$$5, index); zephir_check_call_status(); ZEPHIR_OBS_NVAR(r); zephir_array_fetch_string(&r, color, SL("red"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); @@ -79853,22 +71820,22 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { zephir_array_fetch_string(&b, color, SL("blue"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_27$$5); ZVAL_LONG(&_27$$5, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, r, g, b, &_27$$5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, r, g, b, &_27$$5); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, x); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", &_35, 288, newimage, &_27$$5, &_28$$5, color); + ZEPHIR_INIT_NVAR(_35$$5); + ZVAL_LONG(_35$$5, x); + ZEPHIR_INIT_NVAR(_36$$5); + ZVAL_LONG(_36$$5, y); + ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", NULL, 0, newimage, _35$$5, _36$$5, color); zephir_check_call_status(); y++; } x++; } - _36 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, _36); + _37 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _37); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), newimage TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -79877,7 +71844,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { - zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, _5 = zval_used_for_init, *_6, *_7, *_8, *_9 = NULL, *_10$$3; + zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2, _3, _4, _5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13 = NULL, *_14$$3; int r, g, b, opacity, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79902,26 +71869,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { ZVAL_LONG(&_4, b); ZEPHIR_SINIT_VAR(_5); ZVAL_LONG(&_5, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, background, &_2, &_3, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, background, &_2, &_3, &_4, &_5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, background, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, background, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_NVAR(_5); - ZVAL_LONG(&_5, 0); - ZEPHIR_CALL_FUNCTION(&_9, "imagecopy", NULL, 273, background, _6, &_2, &_3, &_4, &_5, _7, _8); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(&_13, "imagecopy", NULL, 0, background, _6, _9, _10, _11, _12, _7, _8); zephir_check_call_status(); - if (zephir_is_true(_9)) { - _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _10$$3); + if (zephir_is_true(_13)) { + _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _14$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), background TSRMLS_CC); } @@ -79931,8 +71898,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { - zephir_fcall_cache_entry *_2 = NULL; - zval *radius_param = NULL, *_0$$3, _1$$3 = zval_used_for_init; + zval *radius_param = NULL, *_0$$3, *_1$$3 = NULL; int radius, ZEPHIR_LAST_CALL_STATUS, i = 0; ZEPHIR_MM_GROW(); @@ -79947,9 +71913,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { break; } _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1$$3); - ZVAL_LONG(&_1$$3, 7); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_2, 276, _0$$3, &_1$$3); + ZEPHIR_INIT_NVAR(_1$$3); + ZEPHIR_GET_CONSTANT(_1$$3, "IMG_FILTER_GAUSSIAN_BLUR"); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, _0$$3, _1$$3); zephir_check_call_status(); i++; } @@ -79959,8 +71925,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { - zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; - zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, _7$$4 = zval_used_for_init, _8$$4 = zval_used_for_init; + zephir_fcall_cache_entry *_5 = NULL; + zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, *_7$$4 = NULL, *_8$$4 = NULL, *_9$$4 = NULL, *_10$$4 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS, x = 0, y = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0; ZEPHIR_MM_GROW(); @@ -79988,20 +71954,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { ZVAL_LONG(&_3$$4, x1); ZEPHIR_SINIT_NVAR(_4$$4); ZVAL_LONG(&_4$$4, y1); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 286, _2$$4, &_3$$4, &_4$$4); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 257, _2$$4, &_3$$4, &_4$$4); zephir_check_call_status(); x2 = (x + amount); y2 = (y + amount); _6$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_3$$4); - ZVAL_LONG(&_3$$4, x); - ZEPHIR_SINIT_NVAR(_4$$4); - ZVAL_LONG(&_4$$4, y); - ZEPHIR_SINIT_NVAR(_7$$4); - ZVAL_LONG(&_7$$4, x2); - ZEPHIR_SINIT_NVAR(_8$$4); - ZVAL_LONG(&_8$$4, y2); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", &_9, 279, _6$$4, &_3$$4, &_4$$4, &_7$$4, &_8$$4, color); + ZEPHIR_INIT_NVAR(_7$$4); + ZVAL_LONG(_7$$4, x); + ZEPHIR_INIT_NVAR(_8$$4); + ZVAL_LONG(_8$$4, y); + ZEPHIR_INIT_NVAR(_9$$4); + ZVAL_LONG(_9$$4, x2); + ZEPHIR_INIT_NVAR(_10$$4); + ZVAL_LONG(_10$$4, y2); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, _6$$4, _7$$4, _8$$4, _9$$4, _10$$4, color); zephir_check_call_status(); y += amount; } @@ -80014,9 +71980,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zend_bool _10; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL, *_16 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_18 = NULL, *_22 = NULL, *_26 = NULL, *_30, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, _15$$6, *_17$$9, *_19$$10, *_20$$10 = NULL, *_21$$10, *_23$$11, *_24$$11 = NULL, *_25$$11, *_27$$12, *_28$$12 = NULL, *_29$$12; + zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_17 = NULL, *_21 = NULL, *_25 = NULL, *_29, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, *_15$$6, *_16$$9, *_18$$10, *_19$$10 = NULL, *_20$$10, *_22$$11, *_23$$11 = NULL, *_24$$11, *_26$$12, *_27$$12 = NULL, *_28$$12; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -80032,7 +71998,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zephir_check_call_status(); if (!(zephir_is_true(ext))) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 289, _1$$3, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 259, _1$$3, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_2); @@ -80040,30 +72006,30 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZEPHIR_CPY_WRT(ext, _2); ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_3, 0)) { ZEPHIR_INIT_ZVAL_NREF(_5$$4); ZVAL_LONG(_5$$4, 1); zephir_update_property_this(this_ptr, SL("_type"), _5$$4 TSRMLS_CC); _5$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 291, _5$$4); + ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 261, _5$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _6$$4 TSRMLS_CC); _8$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _8$$4, file); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _8$$4, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_9, 0); if (!(_10)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_11, 0); } @@ -80072,7 +72038,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZVAL_LONG(_12$$5, 2); zephir_update_property_this(this_ptr, SL("_type"), _12$$5 TSRMLS_CC); _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 291, _12$$5); + ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 261, _12$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _13$$5 TSRMLS_CC); if (quality >= 0) { @@ -80082,73 +72048,73 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { quality = 100; } _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_15$$6); - ZVAL_LONG(&_15$$6, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _14$$6, file, &_15$$6); + ZEPHIR_INIT_VAR(_15$$6); + ZVAL_LONG(_15$$6, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _14$$6, file, _15$$6); zephir_check_call_status(); } else { - _17$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _17$$9, file); + _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _16$$9, file); zephir_check_call_status(); } RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "png", 0); - ZEPHIR_CALL_FUNCTION(&_18, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_17, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_18, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_19$$10); - ZVAL_LONG(_19$$10, 3); - zephir_update_property_this(this_ptr, SL("_type"), _19$$10 TSRMLS_CC); - _19$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_20$$10, "image_type_to_mime_type", &_7, 291, _19$$10); + if (ZEPHIR_IS_LONG(_17, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_18$$10); + ZVAL_LONG(_18$$10, 3); + zephir_update_property_this(this_ptr, SL("_type"), _18$$10 TSRMLS_CC); + _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_19$$10, "image_type_to_mime_type", &_7, 261, _18$$10); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _20$$10 TSRMLS_CC); - _21$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _21$$10, file); + zephir_update_property_this(this_ptr, SL("_mime"), _19$$10 TSRMLS_CC); + _20$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _20$$10, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_22, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_21, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_22, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_23$$11); - ZVAL_LONG(_23$$11, 15); - zephir_update_property_this(this_ptr, SL("_type"), _23$$11 TSRMLS_CC); - _23$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_24$$11, "image_type_to_mime_type", &_7, 291, _23$$11); + if (ZEPHIR_IS_LONG(_21, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_22$$11); + ZVAL_LONG(_22$$11, 15); + zephir_update_property_this(this_ptr, SL("_type"), _22$$11 TSRMLS_CC); + _22$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_23$$11, "image_type_to_mime_type", &_7, 261, _22$$11); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _24$$11 TSRMLS_CC); - _25$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _25$$11, file); + zephir_update_property_this(this_ptr, SL("_mime"), _23$$11 TSRMLS_CC); + _24$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _24$$11, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_26, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_25, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_26, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_27$$12); - ZVAL_LONG(_27$$12, 16); - zephir_update_property_this(this_ptr, SL("_type"), _27$$12 TSRMLS_CC); - _27$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_28$$12, "image_type_to_mime_type", &_7, 291, _27$$12); + if (ZEPHIR_IS_LONG(_25, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_26$$12); + ZVAL_LONG(_26$$12, 16); + zephir_update_property_this(this_ptr, SL("_type"), _26$$12 TSRMLS_CC); + _26$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_27$$12, "image_type_to_mime_type", &_7, 261, _26$$12); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _28$$12 TSRMLS_CC); - _29$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _29$$12, file); + zephir_update_property_this(this_ptr, SL("_mime"), _27$$12 TSRMLS_CC); + _28$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _28$$12, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_INIT_NVAR(_2); object_init_ex(_2, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_30); - ZEPHIR_CONCAT_SVS(_30, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _30); + ZEPHIR_INIT_VAR(_29); + ZEPHIR_CONCAT_SVS(_29, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _29); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/image/adapter/gd.zep", 554 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -80161,8 +72127,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zend_bool _7; zephir_fcall_cache_entry *_3 = NULL, *_5 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_11 = NULL, *_13 = NULL, *_15 = NULL, *_17, *_4$$3, *_9$$4, _10$$4, *_12$$5, *_14$$6, *_16$$7; - zval *ext = NULL, *_18; + zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_12 = NULL, *_14 = NULL, *_16 = NULL, *_19, *_4$$3, *_9$$4, *_10$$4, *_11$$4, *_13$$5, *_15$$6, *_17$$7, *_18$$7; + zval *ext = NULL, *_20; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &ext_param, &quality_param); @@ -80178,81 +72144,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_2, 0)) { _4$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _4$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _4$$3); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_6, 0); if (!(_7)) { ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_8, 0); } if (_7) { _9$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_10$$4); - ZVAL_LONG(&_10$$4, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 293, _9$$4, ZEPHIR_GLOBAL(global_null), &_10$$4); + ZEPHIR_INIT_VAR(_10$$4); + ZVAL_NULL(_10$$4); + ZEPHIR_INIT_VAR(_11$$4); + ZVAL_LONG(_11$$4, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _9$$4, _10$$4, _11$$4); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "png", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_12, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_11, 0)) { - _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _12$$5); + if (ZEPHIR_IS_LONG(_12, 0)) { + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _13$$5); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_13, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_14, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_13, 0)) { - _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _14$$6); + if (ZEPHIR_IS_LONG(_14, 0)) { + _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _15$$6); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_15, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_16, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_15, 0)) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _16$$7, ZEPHIR_GLOBAL(global_null)); + if (ZEPHIR_IS_LONG(_16, 0)) { + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_18$$7); + ZVAL_NULL(_18$$7); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _17$$7, _18$$7); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_INIT_VAR(_17); - object_init_ex(_17, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_18); - ZEPHIR_CONCAT_SVS(_18, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _17, "__construct", NULL, 9, _18); + ZEPHIR_INIT_VAR(_19); + object_init_ex(_19, phalcon_image_exception_ce); + ZEPHIR_INIT_VAR(_20); + ZEPHIR_CONCAT_SVS(_20, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _19, "__construct", NULL, 9, _20); zephir_check_call_status(); - zephir_throw_exception_debug(_17, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); + zephir_throw_exception_debug(_19, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; @@ -80260,7 +72230,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { - zval *width_param = NULL, *height_param = NULL, *image = NULL, _0, _1; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *_0 = NULL, *_1; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -80270,15 +72240,17 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { height = zephir_get_intval(height_param); - ZEPHIR_SINIT_VAR(_0); - ZVAL_LONG(&_0, width); - ZEPHIR_SINIT_VAR(_1); - ZVAL_LONG(&_1, height); - ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 261, &_0, &_1); + ZEPHIR_INIT_VAR(_0); + ZVAL_LONG(_0, width); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, height); + ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 0, _0, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, image, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, image, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_0); + ZVAL_BOOL(_0, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _0); zephir_check_call_status(); RETURN_CCTOR(image); @@ -80294,7 +72266,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __destruct) { ZEPHIR_OBS_VAR(image); zephir_read_property_this(&image, this_ptr, SL("_image"), PH_NOISY_CC); if (Z_TYPE_P(image) == IS_RESOURCE) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, image); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -80397,8 +72369,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { zephir_update_property_this(this_ptr, SL("_file"), file TSRMLS_CC); ZEPHIR_INIT_VAR(_1); object_init_ex(_1, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(_1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); + zephir_check_call_status(); + } zephir_update_property_this(this_ptr, SL("_image"), _1 TSRMLS_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); if ((zephir_file_exists(_2 TSRMLS_CC) == SUCCESS)) { @@ -80467,11 +72441,13 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { _24$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_25$$8); object_init_ex(_25$$8, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_26$$8); - ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); - zephir_check_temp_parameter(_26$$8); - zephir_check_call_status(); + if (zephir_has_constructor(_25$$8 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); + zephir_check_temp_parameter(_26$$8); + zephir_check_call_status(); + } ZEPHIR_INIT_NVAR(_26$$8); ZVAL_LONG(_26$$8, width); ZEPHIR_INIT_VAR(_27$$8); @@ -80685,8 +72661,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _rotate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } while (1) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3$$3); @@ -80875,8 +72853,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { } ZEPHIR_INIT_VAR(fade); object_init_ex(fade, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(fade TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_17, reflection, "getimagewidth", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_18, reflection, "getimageheight", NULL, 0); @@ -80925,12 +72905,16 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { zephir_check_call_status(); ZEPHIR_INIT_VAR(image); object_init_ex(image, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(image TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } _30 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_31, _30, "getimageheight", NULL, 0); zephir_check_call_status(); @@ -81057,8 +73041,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _watermark) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(watermark); object_init_ex(watermark, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(watermark TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(method); ZVAL_STRING(method, "setImageOpacity", 1); if (likely((zephir_method_exists_ex(watermark, SS("getversion") TSRMLS_CC) == SUCCESS))) { @@ -81140,8 +73126,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(draw); object_init_ex(draw, zephir_get_internal_ce(SS("imagickdraw") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(draw TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rgb(%d, %d, %d)", 0); ZEPHIR_SINIT_VAR(_1); @@ -81154,8 +73142,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_4); object_init_ex(_4, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(_4 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(NULL, draw, "setfillcolor", NULL, 0, _4); zephir_check_call_status(); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { @@ -81374,8 +73364,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _mask) { ZEPHIR_INIT_VAR(mask); object_init_ex(mask, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(mask TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_0, image, "render", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, mask, "readimageblob", NULL, 0, _0); @@ -81448,20 +73440,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _background) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel1); object_init_ex(pixel1, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(pixel1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); + zephir_check_call_status(); + } opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(pixel2); object_init_ex(pixel2, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_4); - ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); - zephir_check_temp_parameter(_4); - zephir_check_call_status(); + if (zephir_has_constructor(pixel2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(background); object_init_ex(background, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(background TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); + zephir_check_call_status(); + } _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 0); @@ -83192,7 +75190,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (Z_TYPE_P(handler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_0$$7); @@ -83224,7 +75222,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83304,7 +75302,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __wakeup) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode", "phalcon/logger/adapter/file.zep", 153); return; } - ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 298, path, mode); + ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 263, path, mode); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_fileHandler"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -83493,7 +75491,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (!(zephir_is_true(stream))) { ZEPHIR_INIT_VAR(_0$$6); @@ -83523,7 +75521,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83620,7 +75618,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, __construct) { ZEPHIR_INIT_NVAR(facility); ZVAL_LONG(facility, 8); } - ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 303, name, option, facility); + ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 268, name, option, facility); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_opened"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -83684,7 +75682,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, logInternal) { } zephir_array_fetch_long(&_3, appliedFormat, 0, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); zephir_array_fetch_long(&_4, appliedFormat, 1, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 304, _3, _4); + ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 269, _3, _4); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -83701,7 +75699,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, close) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(1); } - ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 305); + ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 270); zephir_check_call_status(); RETURN_MM(); @@ -84109,7 +76107,7 @@ static PHP_METHOD(Phalcon_Logger_Formatter_Line, format) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_LONG(&_2$$3, timestamp); - ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 306, _1$$3, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 271, _1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2$$3); ZVAL_STRING(&_2$$3, "%date%", 0); @@ -85089,7 +77087,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, _getResultset) { } ZEPHIR_INIT_VAR(collections); array_init(collections); - ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 307, documentsCursor, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 272, documentsCursor, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); zephir_is_iterable(_5, &_7, &_6, 0, 0, "phalcon/mvc/collection.zep", 443); for ( @@ -85563,7 +77561,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _2 TSRMLS_CC); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _5 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 308, _4, _5, exists); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 273, _4, _5, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { RETURN_MM_BOOL(0); @@ -85597,7 +77595,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -85629,7 +77627,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85669,7 +77667,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _6, _7, _8); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _6, _7, _8); zephir_check_call_status(); RETURN_MM(); @@ -85709,22 +77707,22 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 310, criteria); + ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 275, criteria); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&data, this_ptr, "toarray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 311, keys, data); + ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 276, keys, data); zephir_check_call_status(); if (zephir_is_true(_5)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Criteria parameter must be array with one or more attributes of the model", "phalcon/mvc/collection.zep", 1046); return; } - ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 312, data, keys); + ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 277, data, keys); zephir_check_call_status(); success = 0; ZEPHIR_INIT_VAR(_6); @@ -85773,7 +77771,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_14, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _13, _8, _14); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _13, _8, _14); zephir_check_call_status(); RETURN_MM(); @@ -85804,7 +77802,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _3 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, exists); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85839,7 +77837,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -87182,7 +79180,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, mount) { if (zephir_is_true(_0$$5)) { ZEPHIR_INIT_VAR(lazyHandler); object_init_ex(lazyHandler, phalcon_mvc_micro_lazyloader_ce); - ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 313, mainHandler); + ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 278, mainHandler); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(lazyHandler, mainHandler); @@ -87340,7 +79338,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, setService) { } else { ZVAL_BOOL(_0, 0); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 314, serviceName, definition, _0); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 279, serviceName, definition, _0); zephir_check_call_status(); RETURN_MM(); @@ -87376,7 +79374,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, hasService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 315, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 280, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87412,7 +79410,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 316, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 281, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87437,7 +79435,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getSharedService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 317, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 282, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -88547,7 +80545,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, assign) { continue; } } - ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 318, attributeField, value); + ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 283, attributeField, value); zephir_check_call_status(); if (!(zephir_is_true(_10$$16))) { zephir_update_property_zval_zval(this_ptr, attributeField, value TSRMLS_CC); @@ -89000,12 +80998,12 @@ static PHP_METHOD(Phalcon_Mvc_Model, query) { ZEPHIR_CALL_METHOD(NULL, criteria, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 319, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 284, dependencyInjector); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_3); zephir_get_called_class(_3 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, _3); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, _3); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -90031,7 +82029,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, _preSave) { } } if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 321); + ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 286); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_7$$9)) { RETURN_MM_BOOL(0); @@ -90595,9 +82593,9 @@ static PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) { break; } if (ZEPHIR_IS_LONG(dataType, 3) || ZEPHIR_IS_LONG(dataType, 7)) { - ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 322, snapshotValue); + ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 287, snapshotValue); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 322, value); + ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 287, value); zephir_check_call_status(); changed = !ZEPHIR_IS_IDENTICAL(_12$$25, _14$$25); break; @@ -91107,7 +83105,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, save) { object_init_ex(_9$$12, phalcon_mvc_model_validationfailed_ce); ZEPHIR_CALL_METHOD(&_10$$12, this_ptr, "getmessages", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 323, this_ptr, _10$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 288, this_ptr, _10$$12); zephir_check_call_status(); zephir_throw_exception_debug(_9$$12, "phalcon/mvc/model.zep", 3030 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -91277,7 +83275,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { array_init(_1); zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 324); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 289); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2$$3)) { RETURN_MM_BOOL(0); @@ -91395,7 +83393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { ZEPHIR_CALL_METHOD(&success, writeConnection, "delete", NULL, 0, table, _19, values, bindTypes); zephir_check_call_status(); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 325); + ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 290); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_20$$20)) { RETURN_MM_BOOL(0); @@ -92307,7 +84305,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __call) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) != IS_NULL) { RETURN_CCTOR(records); @@ -92350,7 +84348,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __callStatic) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) == IS_NULL) { ZEPHIR_INIT_VAR(_1$$3); @@ -92447,13 +84445,13 @@ static PHP_METHOD(Phalcon_Mvc_Model, __set) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 318, property, value); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 283, property, value); zephir_check_call_status(); if (zephir_is_true(_10)) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 327, this_ptr, property); + ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 292, this_ptr, property); zephir_check_call_status(); if (zephir_is_true(_11)) { ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", &_1, 0); @@ -94849,7 +86847,7 @@ static PHP_METHOD(Phalcon_Mvc_Url, get) { } } if (zephir_is_true(args)) { - ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 385, args); + ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 350, args); zephir_check_call_status(); _25$$19 = Z_TYPE_P(queryString) == IS_STRING; if (_25$$19) { @@ -95591,7 +87589,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _loadTemplateEngines) { if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_1$$4, PH_COPY | PH_SEPARATE); } else { @@ -95682,7 +87680,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _engineRender) { ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(viewsDir, _4); - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 387, viewPath); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 352, viewPath); zephir_check_call_status(); if (!(zephir_is_true(_5$$3))) { ZEPHIR_INIT_NVAR(viewsDirPath); @@ -96223,7 +88221,7 @@ static PHP_METHOD(Phalcon_Mvc_View, getPartial) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "partial", NULL, 0, partialPath, params); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 262); zephir_check_call_status(); RETURN_MM(); @@ -97892,7 +89890,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -99928,12 +91926,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) { ZEPHIR_INIT_VAR(_12$$10); ZEPHIR_CONCAT_SVS(_12$$10, " ", operator, " "); zephir_fast_join(_11$$10, _12$$10, conditions TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 328, _11$$10); + ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 293, _11$$10); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 329, bind); + ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 294, bind); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, modelName); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, modelName); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -100946,7 +92944,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOne) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 1); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101022,7 +93020,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addBelongsTo) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101099,7 +93097,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101194,9 +93192,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasManyToMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 4); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 331, intermediateFields, intermediateModel, intermediateReferencedFields); + ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 296, intermediateFields, intermediateModel, intermediateReferencedFields); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101644,7 +93642,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not supported", "phalcon/mvc/model/manager.zep", 1254); return; } - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 332, extraParameters, parameters); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 297, extraParameters, parameters); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&builder, this_ptr, "createbuilder", NULL, 0, _5$$3); zephir_check_call_status(); @@ -101728,10 +93726,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_CALL_METHOD(&_26, record, "getdi", NULL, 0); zephir_check_call_status(); zephir_array_update_string(&findParams, SL("di"), &_26, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 332, findParams, parameters); + ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 297, findParams, parameters); zephir_check_call_status(); if (Z_TYPE_P(extraParameters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 332, findArguments, extraParameters); + ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 297, findArguments, extraParameters); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(findParams, findArguments); @@ -102448,7 +94446,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, __destruct) { ZEPHIR_MM_GROW(); phalcon_orm_destroy_cache(TSRMLS_C); - ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 333); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 298); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -104180,7 +96178,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCallArgument) { add_assoc_stringl_ex(return_value, SS("type"), SL("all"), 1); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 339, argument); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 304, argument); zephir_check_call_status(); RETURN_MM(); @@ -104215,11 +96213,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_4$$4, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(_4$$4, SS("type"), SL("when"), 1); zephir_array_fetch_string(&_6$$4, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 369 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _6$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _6$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("expr"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_8$$4, whenExpr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 370 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _8$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _8$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("then"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _4$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 371); @@ -104228,7 +96226,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_9$$5, 2, 0 TSRMLS_CC); add_assoc_stringl_ex(_9$$5, SS("type"), SL("else"), 1); zephir_array_fetch_string(&_11$$5, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 375 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 339, _11$$5); + ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 304, _11$$5); zephir_check_call_status(); zephir_array_update_string(&_9$$5, SL("expr"), &_10$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _9$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 376); @@ -104237,7 +96235,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(return_value, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(return_value, SS("type"), SL("case"), 1); zephir_array_fetch_string(&_13, expr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 382 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 339, _13); + ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 304, _13); zephir_check_call_status(); zephir_array_update_string(&return_value, SL("expr"), &_12, PH_COPY | PH_SEPARATE); zephir_array_update_string(&return_value, SL("when-clauses"), &whenClauses, PH_COPY | PH_SEPARATE); @@ -104276,13 +96274,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getFunctionCall) { ; zephir_hash_move_forward_ex(_1$$6, &_0$$6) ) { ZEPHIR_GET_HVALUE(argument, _2$$6); - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 340, argument); + ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 305, argument); zephir_check_call_status(); zephir_array_append(&functionArgs, _3$$7, PH_SEPARATE, "phalcon/mvc/model/query.zep", 406); } } else { zephir_create_array(functionArgs, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 340, arguments); + ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 305, arguments); zephir_check_call_status(); zephir_array_fast_append(functionArgs, _5$$8); } @@ -104351,7 +96349,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_0$$5, 0); } - ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 339, exprLeft, _0$$5); + ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 304, exprLeft, _0$$5); zephir_check_call_status(); } ZEPHIR_OBS_VAR(exprRight); @@ -104362,7 +96360,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_2$$6, 0); } - ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 339, exprRight, _2$$6); + ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 304, exprRight, _2$$6); zephir_check_call_status(); } } @@ -104440,7 +96438,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 355)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); break; } @@ -104885,12 +96883,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 350)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 342, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 307, expr); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(exprType, 409)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 343, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 308, expr); zephir_check_call_status(); break; } @@ -104900,7 +96898,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { add_assoc_stringl_ex(exprReturn, SS("type"), SL("select"), 1); ZEPHIR_INIT_VAR(_36$$68); ZVAL_BOOL(_36$$68, 1); - ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 344, expr, _36$$68); + ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 309, expr, _36$$68); zephir_check_call_status(); zephir_array_update_string(&exprReturn, SL("value"), &_35$$68, PH_COPY | PH_SEPARATE); break; @@ -104919,7 +96917,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { RETURN_CCTOR(exprReturn); } if (zephir_array_isset_string(expr, SS("domain"))) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); RETURN_MM(); } @@ -104932,7 +96930,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { ; zephir_hash_move_forward_ex(_40$$71, &_39$$71) ) { ZEPHIR_GET_HVALUE(exprListItem, _41$$71); - ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 339, exprListItem); + ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 304, exprListItem); zephir_check_call_status(); zephir_array_append(&listItems, _42$$72, PH_SEPARATE, "phalcon/mvc/model/query.zep", 760); } @@ -105053,7 +97051,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSelectColumn) { add_assoc_stringl_ex(sqlColumn, SS("type"), SL("scalar"), 1); ZEPHIR_OBS_VAR(columnData); zephir_array_fetch_string(&columnData, column, SL("column"), PH_NOISY, "phalcon/mvc/model/query.zep", 886 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 339, columnData); + ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 304, columnData); zephir_check_call_status(); ZEPHIR_OBS_VAR(balias); if (zephir_array_isset_string_fetch(&balias, sqlExprColumn, SS("balias"), 0 TSRMLS_CC)) { @@ -105250,7 +97248,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_2$$3, SS("type"), 355); zephir_array_update_string(&_2$$3, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_2$$3, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _2$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _2$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("left"), &_1$$3, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_4$$3); @@ -105258,7 +97256,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_4$$3, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_4$$3, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_4$$3, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _4$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _4$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("right"), &_1$$3, PH_COPY | PH_SEPARATE); zephir_array_fast_append(sqlJoinConditions, _0$$3); @@ -105294,7 +97292,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_14$$5, SS("type"), 355); zephir_array_update_string(&_14$$5, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_14$$5, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _14$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _14$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("left"), &_13$$5, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_15$$5); @@ -105302,7 +97300,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_15$$5, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_15$$5, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$5, SL("name"), &referencedField, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _15$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _15$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("right"), &_13$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlJoinPartialConditions, _12$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1093); @@ -105385,7 +97383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_8$$4, SS("type"), 355); zephir_array_update_string(&_8$$4, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_8$$4, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _8$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _8$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("left"), &_7$$4, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$4); @@ -105393,7 +97391,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_10$$4, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_10$$4, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$4, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _10$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _10$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("right"), &_7$$4, PH_COPY | PH_SEPARATE); } @@ -105415,7 +97413,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_15$$6, SS("type"), 355); zephir_array_update_string(&_15$$6, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$6, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _15$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _15$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_16$$6); @@ -105423,7 +97421,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_16$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_16$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_16$$6, SL("name"), &intermediateFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _16$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _16$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105444,7 +97442,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_17$$6, SS("type"), 355); zephir_array_update_string(&_17$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_17$$6, SL("name"), &intermediateReferencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _17$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _17$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_18$$6); @@ -105452,7 +97450,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_18$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_18$$6, SL("domain"), &referencedModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_18$$6, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _18$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _18$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105528,7 +97526,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(joinItem, _2); - ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 345, manager, joinItem); + ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 310, manager, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, joinData, SL("source"), PH_NOISY, "phalcon/mvc/model/query.zep", 1334 TSRMLS_CC); @@ -105542,7 +97540,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { zephir_create_array(completeSource, 2, 0 TSRMLS_CC); zephir_array_fast_append(completeSource, source); zephir_array_fast_append(completeSource, schema); - ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 346, joinItem); + ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 311, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(aliasExpr); if (zephir_array_isset_string_fetch(&aliasExpr, joinItem, SS("alias"), 0 TSRMLS_CC)) { @@ -105610,7 +97608,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_GET_HVALUE(joinItem, _14); ZEPHIR_OBS_NVAR(joinExpr); if (zephir_array_isset_string_fetch(&joinExpr, joinItem, SS("conditions"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 339, joinExpr); + ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 304, joinExpr); zephir_check_call_status(); zephir_array_update_zval(&joinPreCondition, joinAliasName, &_15$$13, PH_COPY | PH_SEPARATE); } @@ -105707,10 +97705,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_CALL_METHOD(&_41$$23, relation, "isthrough", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_41$$23))) { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 347, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 312, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } else { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 348, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 313, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } if (zephir_array_isset_long(sqlJoin, 0)) { @@ -105781,7 +97779,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getOrderClause) { ) { ZEPHIR_GET_HVALUE(orderItem, _2); zephir_array_fetch_string(&_3$$5, orderItem, SL("column"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 1650 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 339, _3$$5); + ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 304, _3$$5); zephir_check_call_status(); if (zephir_array_isset_string_fetch(&orderSort, orderItem, SS("sort"), 1 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(orderPartSort); @@ -105833,13 +97831,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getGroupClause) { ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HVALUE(groupItem, _2$$3); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 339, groupItem); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 304, groupItem); zephir_check_call_status(); zephir_array_append(&groupParts, _3$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1684); } } else { zephir_create_array(groupParts, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 339, group); + ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 304, group); zephir_check_call_status(); zephir_array_fast_append(groupParts, _5$$5); } @@ -105864,13 +97862,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getLimitClause) { array_init(limit); ZEPHIR_OBS_VAR(number); if (zephir_array_isset_string_fetch(&number, limitClause, SS("number"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 339, number); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 304, number); zephir_check_call_status(); zephir_array_update_string(&limit, SL("number"), &_0$$3, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(offset); if (zephir_array_isset_string_fetch(&offset, limitClause, SS("offset"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 339, offset); + ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 304, offset); zephir_check_call_status(); zephir_array_update_string(&limit, SL("offset"), &_2$$4, PH_COPY | PH_SEPARATE); } @@ -106193,12 +98191,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { if (zephir_fast_count_int(automaticJoins TSRMLS_CC)) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(sqlJoins); @@ -106214,7 +98212,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { ; zephir_hash_move_forward_ex(_43, &_42) ) { ZEPHIR_GET_HVALUE(column, _44); - ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 350, column); + ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 315, column); zephir_check_call_status(); zephir_is_iterable(_45$$41, &_48$$41, &_47$$41, 0, 0, "phalcon/mvc/model/query.zep", 2024); for ( @@ -106263,31 +98261,31 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { } ZEPHIR_OBS_VAR(where); if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 339, where); + ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 304, where); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("where"), &_53$$51, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(groupBy); if (zephir_array_isset_string_fetch(&groupBy, ast, SS("groupBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 351, groupBy); + ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 316, groupBy); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("group"), &_55$$52, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(having); if (zephir_array_isset_string_fetch(&having, ast, SS("having"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 339, having); + ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 304, having); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("having"), &_56$$53, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(order); if (zephir_array_isset_string_fetch(&order, ast, SS("orderBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 352, order); + ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 317, order); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("order"), &_57$$54, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("limit"), &_58$$55, PH_COPY | PH_SEPARATE); } @@ -106385,7 +98383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareInsert) { } else { ZVAL_BOOL(_11$$9, 0); } - ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 339, exprValue, _11$$9); + ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 304, exprValue, _11$$9); zephir_check_call_status(); zephir_array_update_string(&_8$$9, SL("value"), &_10$$9, PH_COPY | PH_SEPARATE); zephir_array_append(&exprValues, _8$$9, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2139); @@ -106566,7 +98564,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_14$$17, 0); } - ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 339, _13$$17, _14$$17); + ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 304, _13$$17, _14$$17); zephir_check_call_status(); zephir_array_append(&sqlFields, _12$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2289); ZEPHIR_OBS_NVAR(exprColumn); @@ -106582,7 +98580,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_19$$17, 0); } - ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 339, exprColumn, _19$$17); + ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 304, exprColumn, _19$$17); zephir_check_call_status(); zephir_array_update_string(&_16$$17, SL("value"), &_18$$17, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlValues, _16$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2294); @@ -106597,13 +98595,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_21$$18); ZVAL_BOOL(_21$$18, 1); - ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 339, where, _21$$18); + ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 304, where, _21$$18); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("where"), &_20$$18, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("limit"), &_22$$19, PH_COPY | PH_SEPARATE); } @@ -106722,13 +98720,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareDelete) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_10$$14); ZVAL_BOOL(_10$$14, 1); - ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 339, where, _10$$14); + ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 304, where, _10$$14); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("where"), &_9$$14, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("limit"), &_11$$15, PH_COPY | PH_SEPARATE); } @@ -106776,22 +98774,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, parse) { zephir_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 344); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 309); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 354); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 319); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 355); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 320); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 356); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 321); zephir_check_call_status(); break; } @@ -107191,12 +99189,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeSelect) { } else { ZVAL_BOOL(_55$$53, 0); } - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 357, simpleColumnMap, resultObject, resultData, cache, _55$$53); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 322, simpleColumnMap, resultObject, resultData, cache, _55$$53); zephir_check_call_status(); RETURN_MM(); } object_init_ex(return_value, phalcon_mvc_model_resultset_complex_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 358, columns1, resultData, cache); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 323, columns1, resultData, cache); zephir_check_call_status(); RETURN_MM(); @@ -107356,7 +99354,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeInsert) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_CALL_METHOD(&_20, insertModel, "create", NULL, 0, insertValues); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 359, _20, insertModel); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 324, _20, insertModel); zephir_check_call_status(); RETURN_MM(); @@ -107486,13 +99484,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { zephir_array_update_zval(&updateValues, fieldName, &updateValue, PH_COPY | PH_SEPARATE); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, selectBindParams, selectBindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, selectBindParams, selectBindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_17$$19); ZVAL_BOOL(_17$$19, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _17$$19); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _17$$19); zephir_check_call_status(); RETURN_MM(); } @@ -107527,7 +99525,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_23$$24); ZVAL_BOOL(_23$$24, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _23$$24, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _23$$24, record); zephir_check_call_status(); RETURN_MM(); } @@ -107539,7 +99537,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_25); ZVAL_BOOL(_25, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _25); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _25); zephir_check_call_status(); RETURN_MM(); @@ -107571,13 +99569,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { ZEPHIR_CALL_METHOD(&model, _1$$4, "load", NULL, 0, modelName); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, bindParams, bindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_2$$5); ZVAL_BOOL(_2$$5, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _2$$5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _2$$5); zephir_check_call_status(); RETURN_MM(); } @@ -107612,7 +99610,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_8$$10); ZVAL_BOOL(_8$$10, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _8$$10, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _8$$10, record); zephir_check_call_status(); RETURN_MM(); } @@ -107624,7 +99622,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_10); ZVAL_BOOL(_10, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _10); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _10); zephir_check_call_status(); RETURN_MM(); @@ -107672,18 +99670,18 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getRelatedRecords) { } ZEPHIR_INIT_VAR(query); object_init_ex(query, phalcon_mvc_model_query_ce); - ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 361); + ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 326); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 362, _5); + ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 327, _5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 309); - ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 363, _2); + ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 328, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 364, selectIr); + ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 329, selectIr); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); RETURN_MM(); @@ -107804,22 +99802,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, execute) { zephir_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 366, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 331, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 367, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 332, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 368, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 333, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 369, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 334, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } @@ -107874,7 +99872,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSingleResult) { zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(_1, "getfirst", NULL, 0); zephir_check_call_status(); @@ -108071,7 +100069,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSql) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_bindTypes"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3$$3); ZVAL_BOOL(_3$$3, 1); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 366, intermediate, _1$$3, _2$$3, _3$$3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 331, intermediate, _1$$3, _2$$3, _3$$3); zephir_check_call_status(); RETURN_MM(); } @@ -109503,7 +101501,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, rollback) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_model_transaction_failed_ce); _2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackRecord"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 376, rollbackMessage, _2$$4); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 341, rollbackMessage, _2$$4); zephir_check_call_status(); zephir_throw_exception_debug(_1$$4, "phalcon/mvc/model/transaction.zep", 163 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -109522,7 +101520,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, getConnection) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackOnAbort"), PH_NOISY_CC); if (zephir_is_true(_0)) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 377); + ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 342); zephir_check_call_status(); if (zephir_is_true(_1$$3)) { ZEPHIR_INIT_VAR(_2$$4); @@ -110080,7 +102078,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -110458,9 +102456,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 335, _2, options); + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 300, _2, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110554,7 +102552,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110658,9 +102656,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 337, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 302, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110754,7 +102752,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110962,9 +102960,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 338, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 303, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -111058,7 +103056,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -111904,703 +103902,6 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getColumnMa - -const phql_token_names phql_tokens[] = -{ - { SL("INTEGER"), PHQL_T_INTEGER }, - { SL("DOUBLE"), PHQL_T_DOUBLE }, - { SL("STRING"), PHQL_T_STRING }, - { SL("IDENTIFIER"), PHQL_T_IDENTIFIER }, - { SL("HEXAINTEGER"), PHQL_T_HINTEGER }, - { SL("MINUS"), PHQL_T_MINUS }, - { SL("+"), PHQL_T_ADD }, - { SL("-"), PHQL_T_SUB }, - { SL("*"), PHQL_T_MUL }, - { SL("/"), PHQL_T_DIV }, - { SL("&"), PHQL_T_BITWISE_AND }, - { SL("|"), PHQL_T_BITWISE_OR }, - { SL("%%"), PHQL_T_MOD }, - { SL("AND"), PHQL_T_AND }, - { SL("OR"), PHQL_T_OR }, - { SL("LIKE"), PHQL_T_LIKE }, - { SL("ILIKE"), PHQL_T_ILIKE }, - { SL("DOT"), PHQL_T_DOT }, - { SL("COLON"), PHQL_T_COLON }, - { SL("COMMA"), PHQL_T_COMMA }, - { SL("EQUALS"), PHQL_T_EQUALS }, - { SL("NOT EQUALS"), PHQL_T_NOTEQUALS }, - { SL("NOT"), PHQL_T_NOT }, - { SL("<"), PHQL_T_LESS }, - { SL("<="), PHQL_T_LESSEQUAL }, - { SL(">"), PHQL_T_GREATER }, - { SL(">="), PHQL_T_GREATEREQUAL }, - { SL("("), PHQL_T_PARENTHESES_OPEN }, - { SL(")"), PHQL_T_PARENTHESES_CLOSE }, - { SL("NUMERIC PLACEHOLDER"), PHQL_T_NPLACEHOLDER }, - { SL("STRING PLACEHOLDER"), PHQL_T_SPLACEHOLDER }, - { SL("UPDATE"), PHQL_T_UPDATE }, - { SL("SET"), PHQL_T_SET }, - { SL("WHERE"), PHQL_T_WHERE }, - { SL("DELETE"), PHQL_T_DELETE }, - { SL("FROM"), PHQL_T_FROM }, - { SL("AS"), PHQL_T_AS }, - { SL("INSERT"), PHQL_T_INSERT }, - { SL("INTO"), PHQL_T_INTO }, - { SL("VALUES"), PHQL_T_VALUES }, - { SL("SELECT"), PHQL_T_SELECT }, - { SL("ORDER"), PHQL_T_ORDER }, - { SL("BY"), PHQL_T_BY }, - { SL("LIMIT"), PHQL_T_LIMIT }, - { SL("OFFSET"), PHQL_T_OFFSET }, - { SL("GROUP"), PHQL_T_GROUP }, - { SL("HAVING"), PHQL_T_HAVING }, - { SL("IN"), PHQL_T_IN }, - { SL("ON"), PHQL_T_ON }, - { SL("INNER"), PHQL_T_INNER }, - { SL("JOIN"), PHQL_T_JOIN }, - { SL("LEFT"), PHQL_T_LEFT }, - { SL("RIGHT"), PHQL_T_RIGHT }, - { SL("IS"), PHQL_T_IS }, - { SL("NULL"), PHQL_T_NULL }, - { SL("NOT IN"), PHQL_T_NOTIN }, - { SL("CROSS"), PHQL_T_CROSS }, - { SL("OUTER"), PHQL_T_OUTER }, - { SL("FULL"), PHQL_T_FULL }, - { SL("ASC"), PHQL_T_ASC }, - { SL("DESC"), PHQL_T_DESC }, - { SL("BETWEEN"), PHQL_T_BETWEEN }, - { SL("DISTINCT"), PHQL_T_DISTINCT }, - { SL("AGAINST"), PHQL_T_AGAINST }, - { SL("CAST"), PHQL_T_CAST }, - { SL("CONVERT"), PHQL_T_CONVERT }, - { SL("USING"), PHQL_T_USING }, - { SL("ALL"), PHQL_T_ALL }, - { SL("EXISTS"), PHQL_T_EXISTS }, - { SL("CASE"), PHQL_T_CASE }, - { SL("WHEN"), PHQL_T_WHEN }, - { SL("THEN"), PHQL_T_THEN }, - { SL("ELSE"), PHQL_T_ELSE }, - { SL("END"), PHQL_T_END }, - { SL("FOR"), PHQL_T_FOR }, - { SL("WITH"), PHQL_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phql_wrapper_alloc(size_t bytes) -{ - return emalloc(bytes); -} - -static void phql_wrapper_free(void *pointer) -{ - efree(pointer); -} - -static void phql_parse_with_token(void* phql_parser, int opcode, int parsercode, phql_scanner_token *token, phql_parser_status *parser_status) -{ - - phql_parser_token *pToken; - - pToken = emalloc(sizeof(phql_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - phql_(phql_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phql_scanner_error_msg(phql_parser_status *parser_status, zval **error_msg TSRMLS_DC) -{ - - char *error = NULL, *error_part; - unsigned int length; - phql_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_UNDEF(*error_msg); -#endif - - if (state->start) { - length = 64 + state->start_length + parser_status->phql_length; - error = emalloc(sizeof(char) * length); - if (state->start_length > 16) { - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' when parsing: %s (%d)", error_part, parser_status->phql, parser_status->phql_length); - efree(error_part); - } else { - snprintf(error, length, "Scanning error before '%s' when parsing: %s (%d)", state->start, parser_status->phql, parser_status->phql_length); - } - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - } else { -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, "Scanning error near to EOF", 1); -#else - ZVAL_STRING(*error_msg, "Scanning error near to EOF"); -#endif - } - - if (error) { - efree(error); - } -} - -static int phql_parse_phql(zval *result, zval *phql TSRMLS_DC) -{ -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval err_msg, *error_msg = &err_msg; - ZVAL_UNDEF(error_msg); -#endif - - ZVAL_NULL(result); - - if (phql_internal_parse_phql(&result, Z_STRVAL_P(phql), Z_STRLEN_P(phql), &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, Z_STRVAL_P(error_msg)); - return FAILURE; - } - - return SUCCESS; -} - -static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length, zval **error_msg TSRMLS_DC) -{ - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; - phql_parser_status *parser_status = NULL; - int scanner_status, status = SUCCESS, error_length, cache_level; - phql_scanner_state *state; - phql_scanner_token token; - void* phql_parser; - char *error; - unsigned long phql_key = 0; -#if PHP_VERSION_ID < 70000 - zval **temp_ast; -#else - zval *temp_ast; -#endif - - if (!phql) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL", 1); -#else - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL"); -#endif - return FAILURE; - } - - cache_level = phalcon_globals_ptr->orm.cache_level; - if (cache_level >= 0) { - phql_key = zend_inline_hash_func(phql, phql_length + 1); - if (phalcon_globals_ptr->orm.parser_cache != NULL) { -#if PHP_VERSION_ID < 70000 - if (zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key, (void**) &temp_ast) == SUCCESS) { - ZVAL_ZVAL(*result, *temp_ast, 1, 0); - Z_SET_REFCOUNT_P(*result, 1); - return SUCCESS; - } -#else - if ((temp_ast = zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key)) != NULL) { - ZVAL_ZVAL(*result, temp_ast, 1, 0); - Z_TRY_ADDREF_P(*result); - return SUCCESS; - } -#endif - } - } - - phql_parser = phql_Alloc(phql_wrapper_alloc); - - parser_status = emalloc(sizeof(phql_parser_status)); - state = emalloc(sizeof(phql_scanner_state)); - - parser_status->status = PHQL_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->syntax_error = NULL; - parser_status->token = &token; - parser_status->enable_literals = phalcon_globals_ptr->orm.enable_literals; - parser_status->phql = phql; - parser_status->phql_length = phql_length; - - state->active_token = 0; - state->start = phql; - state->start_length = 0; - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phql_get_token(state, &token))) { - - /* Calculate the 'start' length */ - state->start_length = (phql + phql_length - state->start); - - state->active_token = token.opcode; - - /* Parse the token found */ - switch (token.opcode) { - - case PHQL_T_IGNORE: - break; - - case PHQL_T_ADD: - phql_(phql_parser, PHQL_PLUS, NULL, parser_status); - break; - case PHQL_T_SUB: - phql_(phql_parser, PHQL_MINUS, NULL, parser_status); - break; - case PHQL_T_MUL: - phql_(phql_parser, PHQL_TIMES, NULL, parser_status); - break; - case PHQL_T_DIV: - phql_(phql_parser, PHQL_DIVIDE, NULL, parser_status); - break; - case PHQL_T_MOD: - phql_(phql_parser, PHQL_MOD, NULL, parser_status); - break; - case PHQL_T_AND: - phql_(phql_parser, PHQL_AND, NULL, parser_status); - break; - case PHQL_T_OR: - phql_(phql_parser, PHQL_OR, NULL, parser_status); - break; - case PHQL_T_EQUALS: - phql_(phql_parser, PHQL_EQUALS, NULL, parser_status); - break; - case PHQL_T_NOTEQUALS: - phql_(phql_parser, PHQL_NOTEQUALS, NULL, parser_status); - break; - case PHQL_T_LESS: - phql_(phql_parser, PHQL_LESS, NULL, parser_status); - break; - case PHQL_T_GREATER: - phql_(phql_parser, PHQL_GREATER, NULL, parser_status); - break; - case PHQL_T_GREATEREQUAL: - phql_(phql_parser, PHQL_GREATEREQUAL, NULL, parser_status); - break; - case PHQL_T_LESSEQUAL: - phql_(phql_parser, PHQL_LESSEQUAL, NULL, parser_status); - break; - - case PHQL_T_IDENTIFIER: - phql_parse_with_token(phql_parser, PHQL_T_IDENTIFIER, PHQL_IDENTIFIER, &token, parser_status); - break; - - case PHQL_T_DOT: - phql_(phql_parser, PHQL_DOT, NULL, parser_status); - break; - case PHQL_T_COMMA: - phql_(phql_parser, PHQL_COMMA, NULL, parser_status); - break; - - case PHQL_T_PARENTHESES_OPEN: - phql_(phql_parser, PHQL_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHQL_T_PARENTHESES_CLOSE: - phql_(phql_parser, PHQL_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHQL_T_LIKE: - phql_(phql_parser, PHQL_LIKE, NULL, parser_status); - break; - case PHQL_T_ILIKE: - phql_(phql_parser, PHQL_ILIKE, NULL, parser_status); - break; - case PHQL_T_NOT: - phql_(phql_parser, PHQL_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_AND: - phql_(phql_parser, PHQL_BITWISE_AND, NULL, parser_status); - break; - case PHQL_T_BITWISE_OR: - phql_(phql_parser, PHQL_BITWISE_OR, NULL, parser_status); - break; - case PHQL_T_BITWISE_NOT: - phql_(phql_parser, PHQL_BITWISE_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_XOR: - phql_(phql_parser, PHQL_BITWISE_XOR, NULL, parser_status); - break; - case PHQL_T_AGAINST: - phql_(phql_parser, PHQL_AGAINST, NULL, parser_status); - break; - case PHQL_T_CASE: - phql_(phql_parser, PHQL_CASE, NULL, parser_status); - break; - case PHQL_T_WHEN: - phql_(phql_parser, PHQL_WHEN, NULL, parser_status); - break; - case PHQL_T_THEN: - phql_(phql_parser, PHQL_THEN, NULL, parser_status); - break; - case PHQL_T_END: - phql_(phql_parser, PHQL_END, NULL, parser_status); - break; - case PHQL_T_ELSE: - phql_(phql_parser, PHQL_ELSE, NULL, parser_status); - break; - case PHQL_T_FOR: - phql_(phql_parser, PHQL_FOR, NULL, parser_status); - break; - case PHQL_T_WITH: - phql_(phql_parser, PHQL_WITH, NULL, parser_status); - break; - - case PHQL_T_INTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_INTEGER, PHQL_INTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_DOUBLE: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_DOUBLE, PHQL_DOUBLE, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_STRING: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_STRING, PHQL_STRING, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_TRUE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_TRUE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_FALSE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_FALSE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_HINTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_HINTEGER, PHQL_HINTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - - case PHQL_T_NPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_NPLACEHOLDER, PHQL_NPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_SPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_SPLACEHOLDER, PHQL_SPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_BPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_BPLACEHOLDER, PHQL_BPLACEHOLDER, &token, parser_status); - break; - - case PHQL_T_FROM: - phql_(phql_parser, PHQL_FROM, NULL, parser_status); - break; - case PHQL_T_UPDATE: - phql_(phql_parser, PHQL_UPDATE, NULL, parser_status); - break; - case PHQL_T_SET: - phql_(phql_parser, PHQL_SET, NULL, parser_status); - break; - case PHQL_T_WHERE: - phql_(phql_parser, PHQL_WHERE, NULL, parser_status); - break; - case PHQL_T_DELETE: - phql_(phql_parser, PHQL_DELETE, NULL, parser_status); - break; - case PHQL_T_INSERT: - phql_(phql_parser, PHQL_INSERT, NULL, parser_status); - break; - case PHQL_T_INTO: - phql_(phql_parser, PHQL_INTO, NULL, parser_status); - break; - case PHQL_T_VALUES: - phql_(phql_parser, PHQL_VALUES, NULL, parser_status); - break; - case PHQL_T_SELECT: - phql_(phql_parser, PHQL_SELECT, NULL, parser_status); - break; - case PHQL_T_AS: - phql_(phql_parser, PHQL_AS, NULL, parser_status); - break; - case PHQL_T_ORDER: - phql_(phql_parser, PHQL_ORDER, NULL, parser_status); - break; - case PHQL_T_BY: - phql_(phql_parser, PHQL_BY, NULL, parser_status); - break; - case PHQL_T_LIMIT: - phql_(phql_parser, PHQL_LIMIT, NULL, parser_status); - break; - case PHQL_T_OFFSET: - phql_(phql_parser, PHQL_OFFSET, NULL, parser_status); - break; - case PHQL_T_GROUP: - phql_(phql_parser, PHQL_GROUP, NULL, parser_status); - break; - case PHQL_T_HAVING: - phql_(phql_parser, PHQL_HAVING, NULL, parser_status); - break; - case PHQL_T_ASC: - phql_(phql_parser, PHQL_ASC, NULL, parser_status); - break; - case PHQL_T_DESC: - phql_(phql_parser, PHQL_DESC, NULL, parser_status); - break; - case PHQL_T_IN: - phql_(phql_parser, PHQL_IN, NULL, parser_status); - break; - case PHQL_T_ON: - phql_(phql_parser, PHQL_ON, NULL, parser_status); - break; - case PHQL_T_INNER: - phql_(phql_parser, PHQL_INNER, NULL, parser_status); - break; - case PHQL_T_JOIN: - phql_(phql_parser, PHQL_JOIN, NULL, parser_status); - break; - case PHQL_T_LEFT: - phql_(phql_parser, PHQL_LEFT, NULL, parser_status); - break; - case PHQL_T_RIGHT: - phql_(phql_parser, PHQL_RIGHT, NULL, parser_status); - break; - case PHQL_T_CROSS: - phql_(phql_parser, PHQL_CROSS, NULL, parser_status); - break; - case PHQL_T_FULL: - phql_(phql_parser, PHQL_FULL, NULL, parser_status); - break; - case PHQL_T_OUTER: - phql_(phql_parser, PHQL_OUTER, NULL, parser_status); - break; - case PHQL_T_IS: - phql_(phql_parser, PHQL_IS, NULL, parser_status); - break; - case PHQL_T_NULL: - phql_(phql_parser, PHQL_NULL, NULL, parser_status); - break; - case PHQL_T_BETWEEN: - phql_(phql_parser, PHQL_BETWEEN, NULL, parser_status); - break; - case PHQL_T_DISTINCT: - phql_(phql_parser, PHQL_DISTINCT, NULL, parser_status); - break; - case PHQL_T_ALL: - phql_(phql_parser, PHQL_ALL, NULL, parser_status); - break; - case PHQL_T_CAST: - phql_(phql_parser, PHQL_CAST, NULL, parser_status); - break; - case PHQL_T_CONVERT: - phql_(phql_parser, PHQL_CONVERT, NULL, parser_status); - break; - case PHQL_T_USING: - phql_(phql_parser, PHQL_USING, NULL, parser_status); - break; - case PHQL_T_EXISTS: - phql_(phql_parser, PHQL_EXISTS, NULL, parser_status); - break; - - default: - parser_status->status = PHQL_PARSING_FAILED; - error_length = sizeof(char) * 32; - error = emalloc(error_length); - snprintf(error, error_length, "Scanner: Unknown opcode %d", token.opcode); - error[error_length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - efree(error); - break; - } - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHQL_SCANNER_RETCODE_ERR: - case PHQL_SCANNER_RETCODE_IMPOSSIBLE: -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#endif - status = FAILURE; - break; - - default: - phql_(phql_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - ZVAL_STRING(*error_msg, parser_status->syntax_error); - } -#endif - efree(parser_status->syntax_error); - } - } - - phql_Free(phql_parser, phql_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHQL_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { -#endif - - if (phalcon_globals_ptr->orm.cache_level >= 1) { -#if PHP_VERSION_ID < 70000 - if (Z_TYPE_P(parser_status->ret) == IS_ARRAY) { - add_assoc_long(parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { - add_assoc_long(&parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#endif - } - -#if PHP_VERSION_ID < 70000 - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - - if (cache_level >= 0) { - - if (!phalcon_globals_ptr->orm.parser_cache) { - ALLOC_HASHTABLE(phalcon_globals_ptr->orm.parser_cache); - zend_hash_init(phalcon_globals_ptr->orm.parser_cache, 0, NULL, ZVAL_PTR_DTOR, 0); - } - -#if PHP_VERSION_ID < 70000 - - Z_ADDREF_PP(result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - result, - sizeof(zval *), - NULL - ); -#else - Z_TRY_ADDREF_P(*result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - *result - ); -#endif - } - - } else { -#if PHP_VERSION_ID < 70000 - efree(parser_status->ret); -#endif - } - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -113855,9 +105156,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { } else { ZEPHIR_CPY_WRT(attributeField, firstPrimaryKey); } - ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 370, attributeField); + ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 335, attributeField); zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$13); ZEPHIR_CONCAT_VSVSV(_9$$13, _6$$13, ".", _8$$13, " = ", conditions); @@ -113903,7 +105204,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { if (Z_TYPE_P(columnAlias) == IS_LONG) { zephir_array_append(&selectedColumns, column, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1135); } else { - ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 370, columnAlias); + ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 335, columnAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_15$$28); ZEPHIR_CONCAT_VSV(_15$$28, column, " AS ", _14$$28); @@ -113929,11 +105230,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HVALUE(model, _19$$31); ZEPHIR_INIT_NVAR(selectedColumn); if (Z_TYPE_P(modelColumnAlias) == IS_LONG) { - ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _20$$33, ".*"); } else { - ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 370, modelColumnAlias); + ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 335, modelColumnAlias); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _21$$34, ".*"); } @@ -113943,7 +105244,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { zephir_fast_join_str(_22$$31, SL(", "), selectedColumns TSRMLS_CC); zephir_concat_self(&phql, _22$$31 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_24$$35); ZEPHIR_CONCAT_VS(_24$$35, _23$$35, ".*"); @@ -113961,14 +105262,14 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HMKEY(modelAlias, _26$$36, _25$$36); ZEPHIR_GET_HVALUE(model, _27$$36); if (Z_TYPE_P(modelAlias) == IS_STRING) { - ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 370, modelAlias); + ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 335, modelAlias); zephir_check_call_status(); ZEPHIR_INIT_NVAR(selectedModel); ZEPHIR_CONCAT_VSV(selectedModel, _28$$38, " AS ", _29$$38); } else { - ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); } zephir_array_append(&selectedModels, selectedModel, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1184); @@ -113979,7 +105280,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_CONCAT_SV(_31$$36, " FROM ", _30$$36); zephir_concat_self(&phql, _31$$36 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_33$$40); ZEPHIR_CONCAT_SV(_33$$40, " FROM ", _32$$40); @@ -114003,20 +105304,20 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_OBS_NVAR(joinType); zephir_array_fetch_long(&joinType, join, 3, PH_NOISY, "phalcon/mvc/model/query/builder.zep", 1219 TSRMLS_CC); if (zephir_is_true(joinType)) { - ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_38$$43); ZEPHIR_CONCAT_SVSV(_38$$43, " ", joinType, " JOIN ", _37$$43); zephir_concat_self(&phql, _38$$43 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_40$$44); ZEPHIR_CONCAT_SV(_40$$44, " JOIN ", _39$$44); zephir_concat_self(&phql, _40$$44 TSRMLS_CC); } if (zephir_is_true(joinAlias)) { - ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 370, joinAlias); + ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 335, joinAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_42$$45); ZEPHIR_CONCAT_SV(_42$$45, " AS ", _41$$45); @@ -114061,7 +105362,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_50$$49, &_49$$49) ) { ZEPHIR_GET_HVALUE(groupItem, _51$$49); - ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 370, groupItem); + ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 335, groupItem); zephir_check_call_status(); zephir_array_append(&groupItems, _52$$52, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1268); } @@ -114092,7 +105393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_57$$56, &_56$$56) ) { ZEPHIR_GET_HVALUE(orderItem, _58$$56); - ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 370, orderItem); + ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 335, orderItem); zephir_check_call_status(); zephir_array_append(&orderItems, _59$$57, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1289); } @@ -114184,7 +105485,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getQuery) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 371); + ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 336); zephir_check_call_status(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); @@ -114378,4372 +105679,19 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Lang, parsePHQL) { - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || - spy->prec<0 || spx->prec==spy->prec ){ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 39 "parser.php5.lemon" + + +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -118751,41 +105699,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** PPCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** PPNOCODE is a number of type PPCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** PPFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** PPACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phql_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** PPMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phql_TOKENTYPE. The entry in the union +** for base tokens is called "pp0". +** PPSTACKDEPTH is the maximum depth of the parser's stack. +** phql_ARG_SDECL A static variable declaration for the %extra_argument +** phql_ARG_PDECL A parameter declaration for the %extra_argument +** phql_ARG_STORE Code to store %extra_argument into pppParser +** phql_ARG_FETCH Code to extract %extra_argument from pppParser +** PPNSTATE the combined number of states. +** PPNRULE the number of rules in the grammar +** PPERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define PPCODETYPE unsigned char +#define PPNOCODE 134 +#define PPACTIONTYPE unsigned short int +#define phql_TOKENTYPE phql_parser_token* +typedef union { + phql_TOKENTYPE pp0; + zval* pp162; + int pp267; +} PPMINORTYPE; +#define PPSTACKDEPTH 100 +#define phql_ARG_SDECL phql_parser_status *status; +#define phql_ARG_PDECL ,phql_parser_status *status +#define phql_ARG_FETCH phql_parser_status *status = pppParser->status +#define phql_ARG_STORE pppParser->status = status +#define PPNSTATE 293 +#define PPNRULE 161 +#define PPERRORSYMBOL 79 +#define PPERRSYMDT pp267 +#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) +#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) +#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -118795,741 +105760,126 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < PPNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == PPNSTATE+PPNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == PPNSTATE+PPNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused +** slots in the pp_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named pp_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** pp_action[ pp_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value pp_shift_ofst[S]+X is out of range or if the value +** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] +** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table +** and that pp_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the pp_reduce_ofst[] array is used in place of +** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of +** PP_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** pp_action[] A single table containing all actions. +** pp_lookahead[] A table containing the lookahead for each entry in +** pp_action. Used to detect hash collisions. +** pp_shift_ofst[] For each state, the offset into pp_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** pp_reduce_ofst[] For each state, the offset into pp_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. +** pp_default[] Default action for each state. */ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 39 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** PPCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** PPNOCODE is a number of type PPCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** PPFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** PPACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** PPMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "pp0". -** PPSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into pppParser -** phql_ARG_FETCH Code to extract %extra_argument from pppParser -** PPNSTATE the combined number of states. -** PPNRULE the number of rules in the grammar -** PPERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define PPCODETYPE unsigned char -#define PPNOCODE 134 -#define PPACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE pp0; - zval* pp162; - int pp267; -} PPMINORTYPE; -#define PPSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = pppParser->status -#define phql_ARG_STORE pppParser->status = status -#define PPNSTATE 293 -#define PPNRULE 161 -#define PPERRORSYMBOL 79 -#define PPERRSYMDT pp267 -#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) -#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) -#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < PPNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. -** -** N == PPNSTATE+PPNRULE A syntax error has occurred. -** -** N == PPNSTATE+PPNRULE+1 The parser accepts its input. -** -** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused -** slots in the pp_action[] table. -** -** The action table is constructed as a single large table named pp_action[]. -** Given state S and lookahead X, the action is computed as -** -** pp_action[ pp_shift_ofst[S] + X ] -** -** If the index value pp_shift_ofst[S]+X is out of range or if the value -** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] -** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table -** and that pp_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the pp_reduce_ofst[] array is used in place of -** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of -** PP_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** pp_action[] A single table containing all actions. -** pp_lookahead[] A table containing the lookahead for each entry in -** pp_action. Used to detect hash collisions. -** pp_shift_ofst[] For each state, the offset into pp_action for -** shifting terminals. -** pp_reduce_ofst[] For each state, the offset into pp_action for -** shifting non-terminals after a reduce. -** pp_default[] Default action for each state. -*/ -static PPACTIONTYPE pp_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, +static PPACTIONTYPE pp_action[] = { + /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, + /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, + /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, + /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, + /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, + /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, + /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, + /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, + /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, + /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, + /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, + /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, + /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, + /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, + /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, + /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, + /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, + /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, + /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, + /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, + /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, + /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, + /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, + /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, + /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, + /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, + /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, + /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, + /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, + /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, + /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, + /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, + /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, + /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, + /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, + /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, + /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, + /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, + /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, + /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, + /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, + /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, + /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, + /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, + /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, + /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, + /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, + /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, + /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, + /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, + /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, + /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, + /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, + /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, + /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, + /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, + /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, + /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, + /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, + /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, + /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, + /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, + /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, + /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, + /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, + /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, + /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, + /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, + /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, + /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, + /* 790 */ 118, 231, 243, 296, 116, 14, }; static PPCODETYPE pp_lookahead[] = { /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -124785,5139 +111135,823 @@ static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ +// 1 "scanner.re" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval* yy162; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ +#define PPCTYPE unsigned char +#define PPCURSOR (s->start) +#define PPLIMIT (s->end) +#define PPMARKER q -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ +static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ + char *q = PPCURSOR; + int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + +// 45 "scanner.c" + { + PPCTYPE ppch; + unsigned int ppaccept = 0; -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + ppch = *PPCURSOR; + switch (ppch) { + case 0x00: goto pp72; + case '\t': + case '\n': + case '\r': + case ' ': goto pp70; + case '!': goto pp53; + case '"': goto pp32; + case '%': goto pp45; + case '&': goto pp64; + case '\'': goto pp33; + case '(': goto pp49; + case ')': goto pp51; + case '*': goto pp41; + case '+': goto pp37; + case ',': goto pp47; + case '-': goto pp39; + case '.': goto pp11; + case '/': goto pp43; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp2; + case ':': goto pp15; + case '<': goto pp55; + case '=': goto pp59; + case '>': goto pp57; + case '?': goto pp13; + case '@': goto pp61; + case 'A': + case 'a': goto pp4; + case 'B': + case 'b': goto pp5; + case 'C': + case 'c': goto pp6; + case 'D': + case 'd': goto pp7; + case 'E': + case 'e': goto pp8; + case 'F': + case 'f': goto pp9; + case 'G': + case 'g': goto pp25; + case 'H': + case 'h': goto pp26; + case 'I': + case 'i': goto pp21; + case 'J': + case 'j': goto pp29; + case 'K': + case 'M': + case 'P': + case 'Q': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'k': + case 'm': + case 'p': + case 'q': + case 'y': + case 'z': goto pp35; + case 'L': + case 'l': goto pp27; + case 'N': + case 'n': goto pp28; + case 'O': + case 'o': goto pp24; + case 'R': + case 'r': goto pp30; + case 'S': + case 's': goto pp20; + case 'T': + case 't': goto pp31; + case 'U': + case 'u': goto pp18; + case 'V': + case 'v': goto pp22; + case 'W': + case 'w': goto pp23; + case '[': goto pp36; + case '\\': goto pp34; + case '^': goto pp68; + case 'x': goto pp10; + case '{': goto pp17; + case '|': goto pp62; + case '~': goto pp66; + default: goto pp74; + } +pp2: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '.': goto pp340; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp342; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'x': goto pp344; + default: goto pp3; + } +pp3: +// 46 "scanner.re" + { + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; + if (token->len > 2 && !memcmp(token->value, "0x", 2)) { + token->opcode = PHQL_T_HINTEGER; + } else { + int i, alpha = 0; + for (i = 0; i < token->len; i++) { + unsigned char ch = token->value[i]; + if (!((ch >= '0') && (ch <= '9'))) { + alpha = 1; + break; + } + } + if (alpha) { + token->opcode = PHQL_T_IDENTIFIER; + } else { + token->opcode = PHQL_T_INTEGER; + } + } + q = PPCURSOR; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy162)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy162; -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; -} - break; - case 5: -{ - yygotominor.yy162 = phql_ret_select_statement(yymsp[-6].minor.yy162, yymsp[-5].minor.yy162, yymsp[-2].minor.yy162, yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 6: -{ - yygotominor.yy162 = phql_ret_select_clause(yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - yygotominor.yy162 = phql_ret_distinct_all(1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - yygotominor.yy162 = phql_ret_distinct_all(0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - yygotominor.yy162 = NULL; -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[0].minor.yy162, NULL); -} - break; - case 12: - case 140: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-1].minor.yy162, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 21: - case 128: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 24: -{ - yygotominor.yy162 = phql_ret_join_item(yymsp[-3].minor.yy162, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 25: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-7].minor.yy162, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - yygotominor.yy162 = phql_ret_update_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 48: -{ - yygotominor.yy162 = phql_ret_update_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - yygotominor.yy162 = phql_ret_update_item(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - yygotominor.yy162 = phql_ret_delete_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 54: -{ - yygotominor.yy162 = phql_ret_delete_clause(yymsp[0].minor.yy162); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-1].minor.yy162, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 58: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-6].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-5].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-3].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[0].minor.yy162, 0); -} - break; - case 75: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - yygotominor.yy162 = phql_ret_for_update_clause(); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MINUS, NULL, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUB, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ADD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MUL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_DIV, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MOD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_XOR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTEQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATER, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATEREQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESSEQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NLIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ILIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NILIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_IN, yymsp[-4].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTIN, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUBQUERY, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EXISTS, NULL, yymsp[-1].minor.yy162); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AGAINST, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CAST, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CONVERT, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CASE, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_WHEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ELSE, yymsp[0].minor.yy162, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - yygotominor.yy162 = phql_ret_func_call(yymsp[-4].minor.yy0, yymsp[-1].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - yygotominor.yy162 = phql_ret_distinct(); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNULL, yymsp[-2].minor.yy162, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNOTNULL, yymsp[-3].minor.yy162, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BETWEEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ENCLOSED, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - +// 201 "scanner.c" +pp4: + ppch = *++PPCURSOR; + switch (ppch) { + case 'G': + case 'g': goto pp323; + case 'L': + case 'l': goto pp324; + case 'N': + case 'n': goto pp325; + case 'S': + case 's': goto pp326; + default: goto pp248; } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +pp5: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp314; + case 'Y': + case 'y': goto pp315; + default: goto pp248; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); +pp6: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp296; + case 'O': + case 'o': goto pp297; + case 'R': + case 'r': goto pp298; + default: goto pp248; + } +pp7: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp279; + case 'I': + case 'i': goto pp280; + default: goto pp248; + } +pp8: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp265; + case 'N': + case 'n': goto pp266; + case 'X': goto pp267; + case 'x': goto pp268; + default: goto pp248; + } +pp9: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp249; + case 'O': + case 'o': goto pp250; + case 'R': + case 'r': goto pp251; + case 'U': + case 'u': goto pp252; + default: goto pp248; + } +pp10: + ppch = *++PPCURSOR; + goto pp248; +pp11: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp244; + default: goto pp12; + } +pp12: +// 432 "scanner.re" + { + token->opcode = PHQL_T_DOT; + return 0; + } +// 292 "scanner.c" +pp13: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp241; + default: goto pp14; + } +pp14: +// 557 "scanner.re" + { + status = PHQL_SCANNER_RETCODE_ERR; + break; + } +// 314 "scanner.c" +pp15: + ppaccept = 0; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp237; + default: goto pp16; + } +pp16: +// 437 "scanner.re" + { + token->opcode = PHQL_T_COLON; + return 0; + } +// 391 "scanner.c" +pp17: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp233; + default: goto pp14; + } +pp18: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case 'P': + case 'p': goto pp222; + case 'S': + case 's': goto pp223; + default: goto pp101; + } +pp19: +// 380 "scanner.re" + { + token->opcode = PHQL_T_IDENTIFIER; + if ((PPCURSOR - q) > 1) { + if (q[0] == '\\') { + token->value = estrndup(q + 1, PPCURSOR - q - 1); + token->len = PPCURSOR - q - 1; } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; - } - - if (!token_found) { - if (token_name) { - efree(token_name); - } + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } + q = PPCURSOR; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval yy204; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ - -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); +// 491 "scanner.c" +pp20: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp214; + default: goto pp101; + } +pp21: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp193; + case 'N': + case 'n': goto pp194; + case 'S': + case 's': goto pp196; + default: goto pp101; + } +pp22: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp187; + default: goto pp101; + } +pp23: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp176; + case 'I': + case 'i': goto pp177; + default: goto pp101; + } +pp24: + ppch = *++PPCURSOR; + switch (ppch) { + case 'F': + case 'f': goto pp157; + case 'N': + case 'n': goto pp158; + case 'R': + case 'r': goto pp160; + case 'U': + case 'u': goto pp162; + default: goto pp101; + } +pp25: + ppch = *++PPCURSOR; + switch (ppch) { + case 'R': + case 'r': goto pp152; + default: goto pp101; + } +pp26: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp146; + default: goto pp101; + } +pp27: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp134; + case 'I': + case 'i': goto pp135; + default: goto pp101; + } +pp28: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp127; + case 'U': + case 'u': goto pp128; + default: goto pp101; + } +pp29: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp123; + default: goto pp101; + } +pp30: + ppch = *++PPCURSOR; + switch (ppch) { + case 'I': + case 'i': goto pp118; + default: goto pp101; + } +pp31: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp110; + case 'R': + case 'r': goto pp111; + default: goto pp101; + } +pp32: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp108; +pp33: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp103; +pp34: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp100; + default: goto pp14; + } +pp35: + ppch = *++PPCURSOR; + goto pp101; +pp36: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '\\': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp95; + default: goto pp14; + } +pp37: + ++PPCURSOR; +// 407 "scanner.re" + { + token->opcode = PHQL_T_ADD; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy204)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy204, 1, 1); -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; -} - break; - case 5: -{ - phql_ret_select_statement(&yygotominor.yy204, &yymsp[-6].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 6: -{ - phql_ret_select_clause(&yygotominor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - phql_ret_distinct_all(&yygotominor.yy204, 1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - phql_ret_distinct_all(&yygotominor.yy204, 0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - ZVAL_UNDEF(&yygotominor.yy204); -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); -} - break; - case 12: - case 140: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-2].minor.yy204, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-1].minor.yy204, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 21: - case 128: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 24: -{ - phql_ret_join_item(&yygotominor.yy204, &yymsp[-3].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 25: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-7].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - phql_ret_update_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 48: -{ - phql_ret_update_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - phql_ret_update_item(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - phql_ret_delete_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 54: -{ - phql_ret_delete_clause(&yygotominor.yy204, &yymsp[0].minor.yy204); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-1].minor.yy204, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 58: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-6].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-5].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-3].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, NULL, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[0].minor.yy204, 0); -} - break; - case 75: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - phql_ret_for_update_clause(&yygotominor.yy204); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MINUS, NULL, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUB, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ADD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MUL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_DIV, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MOD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_XOR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTEQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATER, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATEREQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESSEQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NLIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ILIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NILIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_IN, &yymsp[-4].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTIN, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUBQUERY, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EXISTS, NULL, &yymsp[-1].minor.yy204); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AGAINST, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CAST, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CONVERT, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_CASE, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_WHEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ELSE, &yymsp[0].minor.yy204, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - phql_ret_func_call(&yygotominor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - phql_ret_distinct(&yygotominor.yy204); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNULL, &yymsp[-2].minor.yy204, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNOTNULL, &yymsp[-3].minor.yy204, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BETWEEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ENCLOSED, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - - } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +// 732 "scanner.c" +pp39: + ++PPCURSOR; +// 412 "scanner.re" + { + token->opcode = PHQL_T_SUB; + return 0; + } +// 740 "scanner.c" +pp41: + ++PPCURSOR; +// 417 "scanner.re" + { + token->opcode = PHQL_T_MUL; + return 0; + } +// 748 "scanner.c" +pp43: + ++PPCURSOR; +// 422 "scanner.re" + { + token->opcode = PHQL_T_DIV; + return 0; + } +// 756 "scanner.c" +pp45: + ++PPCURSOR; +// 427 "scanner.re" + { + token->opcode = PHQL_T_MOD; + return 0; + } +// 764 "scanner.c" +pp47: + ++PPCURSOR; +// 442 "scanner.re" + { + token->opcode = PHQL_T_COMMA; + return 0; + } +// 772 "scanner.c" +pp49: + ++PPCURSOR; +// 447 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_OPEN; + return 0; + } +// 780 "scanner.c" +pp51: + ++PPCURSOR; +// 452 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_CLOSE; + return 0; + } +// 788 "scanner.c" +pp53: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '!': goto pp91; + case '=': goto pp93; + default: goto pp54; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); - } - } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; +pp54: +// 522 "scanner.re" + { + token->opcode = PHQL_T_NOT; + return 0; + } +// 802 "scanner.c" +pp55: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp87; + case '>': goto pp89; + default: goto pp56; } - - if (!token_found) { - if (token_name) { - efree(token_name); - } +pp56: +// 477 "scanner.re" + { + token->opcode = PHQL_T_LESS; + return 0; + } +// 816 "scanner.c" +pp57: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp85; + default: goto pp58; } +pp58: +// 482 "scanner.re" + { + token->opcode = PHQL_T_GREATER; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ -// 1 "scanner.re" - - -#ifdef HAVE_CONFIG_H -#endif - - - -#define PPCTYPE unsigned char -#define PPCURSOR (s->start) -#define PPLIMIT (s->end) -#define PPMARKER q - -static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { - - char *q = PPCURSOR; - int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; - - while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { - - -// 45 "scanner.c" - { - PPCTYPE ppch; - unsigned int ppaccept = 0; - - ppch = *PPCURSOR; - switch (ppch) { - case 0x00: goto pp72; - case '\t': - case '\n': - case '\r': - case ' ': goto pp70; - case '!': goto pp53; - case '"': goto pp32; - case '%': goto pp45; - case '&': goto pp64; - case '\'': goto pp33; - case '(': goto pp49; - case ')': goto pp51; - case '*': goto pp41; - case '+': goto pp37; - case ',': goto pp47; - case '-': goto pp39; - case '.': goto pp11; - case '/': goto pp43; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp2; - case ':': goto pp15; - case '<': goto pp55; - case '=': goto pp59; - case '>': goto pp57; - case '?': goto pp13; - case '@': goto pp61; - case 'A': - case 'a': goto pp4; - case 'B': - case 'b': goto pp5; - case 'C': - case 'c': goto pp6; - case 'D': - case 'd': goto pp7; - case 'E': - case 'e': goto pp8; - case 'F': - case 'f': goto pp9; - case 'G': - case 'g': goto pp25; - case 'H': - case 'h': goto pp26; - case 'I': - case 'i': goto pp21; - case 'J': - case 'j': goto pp29; - case 'K': - case 'M': - case 'P': - case 'Q': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'k': - case 'm': - case 'p': - case 'q': - case 'y': - case 'z': goto pp35; - case 'L': - case 'l': goto pp27; - case 'N': - case 'n': goto pp28; - case 'O': - case 'o': goto pp24; - case 'R': - case 'r': goto pp30; - case 'S': - case 's': goto pp20; - case 'T': - case 't': goto pp31; - case 'U': - case 'u': goto pp18; - case 'V': - case 'v': goto pp22; - case 'W': - case 'w': goto pp23; - case '[': goto pp36; - case '\\': goto pp34; - case '^': goto pp68; - case 'x': goto pp10; - case '{': goto pp17; - case '|': goto pp62; - case '~': goto pp66; - default: goto pp74; - } -pp2: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '.': goto pp340; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp342; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'x': goto pp344; - default: goto pp3; - } -pp3: -// 46 "scanner.re" - { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - if (token->len > 2 && !memcmp(token->value, "0x", 2)) { - token->opcode = PHQL_T_HINTEGER; - } else { - int i, alpha = 0; - for (i = 0; i < token->len; i++) { - unsigned char ch = token->value[i]; - if (!((ch >= '0') && (ch <= '9'))) { - alpha = 1; - break; - } - } - if (alpha) { - token->opcode = PHQL_T_IDENTIFIER; - } else { - token->opcode = PHQL_T_INTEGER; - } - } - q = PPCURSOR; - return 0; - } -// 201 "scanner.c" -pp4: - ppch = *++PPCURSOR; - switch (ppch) { - case 'G': - case 'g': goto pp323; - case 'L': - case 'l': goto pp324; - case 'N': - case 'n': goto pp325; - case 'S': - case 's': goto pp326; - default: goto pp248; - } -pp5: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp314; - case 'Y': - case 'y': goto pp315; - default: goto pp248; - } -pp6: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp296; - case 'O': - case 'o': goto pp297; - case 'R': - case 'r': goto pp298; - default: goto pp248; - } -pp7: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp279; - case 'I': - case 'i': goto pp280; - default: goto pp248; - } -pp8: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp265; - case 'N': - case 'n': goto pp266; - case 'X': goto pp267; - case 'x': goto pp268; - default: goto pp248; - } -pp9: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp249; - case 'O': - case 'o': goto pp250; - case 'R': - case 'r': goto pp251; - case 'U': - case 'u': goto pp252; - default: goto pp248; - } -pp10: - ppch = *++PPCURSOR; - goto pp248; -pp11: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp244; - default: goto pp12; - } -pp12: -// 432 "scanner.re" - { - token->opcode = PHQL_T_DOT; - return 0; - } -// 292 "scanner.c" -pp13: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp241; - default: goto pp14; - } -pp14: -// 557 "scanner.re" - { - status = PHQL_SCANNER_RETCODE_ERR; - break; - } -// 314 "scanner.c" -pp15: - ppaccept = 0; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp237; - default: goto pp16; - } -pp16: -// 437 "scanner.re" - { - token->opcode = PHQL_T_COLON; - return 0; - } -// 391 "scanner.c" -pp17: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case ':': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp233; - default: goto pp14; - } -pp18: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case 'P': - case 'p': goto pp222; - case 'S': - case 's': goto pp223; - default: goto pp101; - } -pp19: -// 380 "scanner.re" - { - token->opcode = PHQL_T_IDENTIFIER; - if ((PPCURSOR - q) > 1) { - if (q[0] == '\\') { - token->value = estrndup(q + 1, PPCURSOR - q - 1); - token->len = PPCURSOR - q - 1; - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - q = PPCURSOR; - return 0; - } -// 491 "scanner.c" -pp20: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp214; - default: goto pp101; - } -pp21: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp193; - case 'N': - case 'n': goto pp194; - case 'S': - case 's': goto pp196; - default: goto pp101; - } -pp22: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp187; - default: goto pp101; - } -pp23: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp176; - case 'I': - case 'i': goto pp177; - default: goto pp101; - } -pp24: - ppch = *++PPCURSOR; - switch (ppch) { - case 'F': - case 'f': goto pp157; - case 'N': - case 'n': goto pp158; - case 'R': - case 'r': goto pp160; - case 'U': - case 'u': goto pp162; - default: goto pp101; - } -pp25: - ppch = *++PPCURSOR; - switch (ppch) { - case 'R': - case 'r': goto pp152; - default: goto pp101; - } -pp26: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp146; - default: goto pp101; - } -pp27: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp134; - case 'I': - case 'i': goto pp135; - default: goto pp101; - } -pp28: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp127; - case 'U': - case 'u': goto pp128; - default: goto pp101; - } -pp29: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp123; - default: goto pp101; - } -pp30: - ppch = *++PPCURSOR; - switch (ppch) { - case 'I': - case 'i': goto pp118; - default: goto pp101; - } -pp31: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp110; - case 'R': - case 'r': goto pp111; - default: goto pp101; - } -pp32: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp108; -pp33: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp103; -pp34: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp100; - default: goto pp14; - } -pp35: - ppch = *++PPCURSOR; - goto pp101; -pp36: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '\\': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp95; - default: goto pp14; - } -pp37: - ++PPCURSOR; -// 407 "scanner.re" - { - token->opcode = PHQL_T_ADD; - return 0; - } -// 732 "scanner.c" -pp39: - ++PPCURSOR; -// 412 "scanner.re" - { - token->opcode = PHQL_T_SUB; - return 0; - } -// 740 "scanner.c" -pp41: - ++PPCURSOR; -// 417 "scanner.re" - { - token->opcode = PHQL_T_MUL; - return 0; - } -// 748 "scanner.c" -pp43: - ++PPCURSOR; -// 422 "scanner.re" - { - token->opcode = PHQL_T_DIV; - return 0; - } -// 756 "scanner.c" -pp45: - ++PPCURSOR; -// 427 "scanner.re" - { - token->opcode = PHQL_T_MOD; - return 0; - } -// 764 "scanner.c" -pp47: - ++PPCURSOR; -// 442 "scanner.re" - { - token->opcode = PHQL_T_COMMA; - return 0; - } -// 772 "scanner.c" -pp49: - ++PPCURSOR; -// 447 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_OPEN; - return 0; - } -// 780 "scanner.c" -pp51: - ++PPCURSOR; -// 452 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_CLOSE; - return 0; - } -// 788 "scanner.c" -pp53: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '!': goto pp91; - case '=': goto pp93; - default: goto pp54; - } -pp54: -// 522 "scanner.re" - { - token->opcode = PHQL_T_NOT; - return 0; - } -// 802 "scanner.c" -pp55: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp87; - case '>': goto pp89; - default: goto pp56; - } -pp56: -// 477 "scanner.re" - { - token->opcode = PHQL_T_LESS; - return 0; - } -// 816 "scanner.c" -pp57: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp85; - default: goto pp58; - } -pp58: -// 482 "scanner.re" - { - token->opcode = PHQL_T_GREATER; - return 0; - } -// 829 "scanner.c" -pp59: - ++PPCURSOR; -// 487 "scanner.re" - { - token->opcode = PHQL_T_EQUALS; - return 0; - } -// 837 "scanner.c" -pp61: - ppch = *++PPCURSOR; +// 829 "scanner.c" +pp59: + ++PPCURSOR; +// 487 "scanner.re" + { + token->opcode = PHQL_T_EQUALS; + return 0; + } +// 837 "scanner.c" +pp61: + ppch = *++PPCURSOR; switch (ppch) { case '>': goto pp81; case '@': goto pp83; @@ -135362,21643 +117396,9483 @@ static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { case 'x': goto pp344; default: goto pp3; } - } -// 562 "scanner.re" - - } - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { - - zval *success_param = NULL, *model = NULL; - zend_bool success; - - zephir_fetch_params(0, 1, 1, &success_param, &model); - - success = zephir_get_boolval(success_param); - if (!model) { - model = ZEPHIR_GLOBAL(global_null); - } - - - if (success) { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { - - - - RETURN_MEMBER(this_ptr, "_model"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { - - zval *model = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(model); - zephir_read_property_this(&model, this_ptr, SL("_model"), PH_NOISY_CC); - if (Z_TYPE_P(model) != IS_OBJECT) { - array_init(return_value); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(model, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { - - - - RETURN_MEMBER(this_ptr, "_success"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnTypes, *result = NULL, *cache = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); - - if (!result) { - result = ZEPHIR_GLOBAL(global_null); - } - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { - - zend_class_entry *_13$$15; - HashTable *_3, *_6$$11; - HashPosition _2, _5$$11; - zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; - zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; - int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); - RETURN_CCTOR(row); - } - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_INIT_NVAR(activeRow); - object_init_ex(activeRow, phalcon_mvc_model_row_ce); - if (zephir_has_constructor(activeRow TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); - zephir_check_call_status(); - } - break; - } - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - ZEPHIR_INIT_NVAR(activeRow); - array_init(activeRow); - break; - } - ZEPHIR_INIT_NVAR(activeRow); - object_init(activeRow); - break; - } while(0); - - dirtyState = 0; - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); - zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HMKEY(alias, _3, _2); - ZEPHIR_GET_HVALUE(column, _4); - if (Z_TYPE_P(column) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); - return; - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); - if (ZEPHIR_IS_STRING(type, "object")) { - ZEPHIR_OBS_NVAR(source); - zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); - ZEPHIR_OBS_NVAR(attributes); - zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); - ZEPHIR_OBS_NVAR(columnMap); - zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); - ZEPHIR_INIT_NVAR(rowModel); - array_init(rowModel); - zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); - for ( - ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) - ) { - ZEPHIR_GET_HVALUE(attribute, _7$$11); - ZEPHIR_OBS_NVAR(columnValue); - ZEPHIR_INIT_LNVAR(_8$$12); - ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); - zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); - zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); - } - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_OBS_NVAR(keepSnapshots); - if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(keepSnapshots); - ZVAL_BOOL(keepSnapshots, 0); - } - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_NVAR(_9$$15); - zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); - if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { - zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); - ZEPHIR_INIT_NVAR(modelName); - zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_12$$15); - ZVAL_LONG(_12$$15, dirtyState); - _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); - zephir_check_call_status(); - } else { - zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_16$$18); - ZVAL_LONG(_16$$18, dirtyState); - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - ZEPHIR_OBS_NVAR(attribute); - zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(sqlAlias); - if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { - ZEPHIR_OBS_NVAR(value); - zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(value); - zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); - } - if (zephir_array_isset_string(column, SS("balias"))) { - ZEPHIR_CPY_WRT(attribute, alias); - } else { - ZEPHIR_SINIT_NVAR(_18$$24); - ZVAL_STRING(&_18$$24, "_", 0); - ZEPHIR_SINIT_NVAR(_19$$24); - ZVAL_STRING(&_19$$24, "", 0); - ZEPHIR_INIT_NVAR(attribute); - zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); - } - } - if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { - do { - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); - break; - } - zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); - break; - } while(0); - - } - } - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { - - zval *records = NULL, *current = NULL, *_0 = NULL; - zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(records); - array_init(records); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0))) { - break; - } - ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 373); - zephir_check_call_status(); - zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); - zephir_check_call_status(); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { - - zval *_0; - zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(cache); - zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnTypes); - zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 4, 0 TSRMLS_CC); - zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_CCTOR(serialized); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - if (1) { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_2); - ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); - zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); - - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - if (!keepSnapshots) { - keepSnapshots = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { - - zend_class_entry *_5$$6; - zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; - zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_VAR(_0$$6); - zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); - if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { - _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(modelName); - zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_4$$6); - ZVAL_LONG(_4$$6, 0); - _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); - zephir_check_call_status(); - } else { - _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_9$$9); - ZVAL_LONG(_9$$9, 0); - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 374, _7$$9, row, columnMap, _9$$9, _8$$9); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 375, row, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { - - HashTable *_2$$7, *_5$$8; - HashPosition _1$$7, _4$$8; - zephir_fcall_cache_entry *_9 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; - zend_bool renameColumns; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &renameColumns_param); - - if (!renameColumns_param) { - renameColumns = 1; - } else { - renameColumns = zephir_get_boolval(renameColumns_param); - } - - - ZEPHIR_OBS_VAR(records); - zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); - if (Z_TYPE_P(records) != IS_ARRAY) { - ZEPHIR_OBS_VAR(result); - zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(_0$$3) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); - } - if (renameColumns) { - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - if (Z_TYPE_P(columnMap) != IS_ARRAY) { - RETURN_CCTOR(records); - } - ZEPHIR_INIT_VAR(renamedRecords); - array_init(renamedRecords); - if (Z_TYPE_P(records) == IS_ARRAY) { - zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); - for ( - ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) - ) { - ZEPHIR_GET_HVALUE(record, _3$$7); - ZEPHIR_INIT_NVAR(renamed); - array_init(renamed); - zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); - for ( - ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS - ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) - ) { - ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); - ZEPHIR_GET_HVALUE(value, _6$$8); - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(renamedKey) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_10$$12); - object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_11$$12); - ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); - } - zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); - } - } - RETURN_CCTOR(renamedRecords); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { - - zval *_1 = NULL, *_2 = NULL, *_3; - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 6, 0 TSRMLS_CC); - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(_3); - ZVAL_BOOL(_3, 0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); - zephir_check_call_status(); - zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); - zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_3); - ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); - zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); - zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, *record = NULL; - zval *message = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &record); - - if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(message_param) == IS_STRING)) { - zephir_get_strval(message, message_param); - } else { - ZEPHIR_INIT_VAR(message); - ZVAL_EMPTY_STRING(message); - } - if (!record) { - record = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { - - zval *record = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(record); - zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); - if (Z_TYPE_P(record) != IS_NULL) { - ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { - - - - RETURN_MEMBER(this_ptr, "_record"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *dependencyInjector = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &dependencyInjector); - - if (!dependencyInjector) { - ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(dependencyInjector); - } - - - if (!(zephir_is_true(dependencyInjector))) { - ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); - return; - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { - - zval *service_param = NULL; - zval *service = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &service_param); - - if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(service_param) == IS_STRING)) { - zephir_get_strval(service, service_param); - } else { - ZEPHIR_INIT_VAR(service); - ZVAL_EMPTY_STRING(service); - } - - - zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { - - - - RETURN_MEMBER(this_ptr, "_service"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { - - zval *rollbackPendent_param = NULL; - zend_bool rollbackPendent; - - zephir_fetch_params(0, 1, 0, &rollbackPendent_param); - - rollbackPendent = zephir_get_boolval(rollbackPendent_param); - - - if (rollbackPendent) { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { - - - - RETURN_MEMBER(this_ptr, "_rollbackPendent"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { - - zval *_0; - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { - - zval *_2$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); - if (zephir_is_true(_1$$3)) { - ZEPHIR_INIT_VAR(_2$$4); - zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$4, this_ptr); - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "rollbackPendent", 1); - zephir_array_fast_append(_2$$4, _3$$4); - ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 378, _2$$4); - zephir_check_call_status(); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(_4); - if (autoBegin) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { - - HashTable *_2$$5; - HashPosition _1$$5; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(transaction, _3$$5); - if (Z_TYPE_P(transaction) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_BOOL(_4$$7, 0); - ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); - zephir_check_call_status(); - RETURN_CCTOR(transaction); - } - } - } - } - ZEPHIR_INIT_NVAR(transaction); - object_init_ex(transaction, phalcon_mvc_model_transaction_ce); - _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_6); - if (autoBegin) { - ZVAL_BOOL(_6, 1); - } else { - ZVAL_BOOL(_6, 0); - } - ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 379, dependencyInjector, _6, _5); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 380, this_ptr); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); - RETURN_CCTOR(transaction); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { - - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { - - HashTable *_1$$3; - HashPosition _0$$3; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &collect); - - if (!collect) { - collect = ZEPHIR_GLOBAL(global_true); - } - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); - zephir_check_call_status(); - } - if (zephir_is_true(collect)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(newTransactions); - array_init(newTransactions); - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); - if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { - zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); - } else { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - } - zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { - - HashTable *_2$$3; - HashPosition _1$$3; - zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_0$$3); - zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); - for ( - ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) - ) { - ZEPHIR_GET_HVALUE(_0$$3, _3$$3); - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 274); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { - - zval *_5$$7; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if (zephir_fast_in_array(value, domain TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_4$$7); - ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_4$$7); - zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { - - zval *_8$$9; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(strict); - ZVAL_BOOL(strict, 0); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_4)) { - if (Z_TYPE_P(strict) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); - return; - } - ZEPHIR_INIT_VAR(_5$$7); - ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); - zephir_check_temp_parameter(_5$$7); - zephir_check_call_status(); - } - ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 381, value, domain, strict); - zephir_check_call_status(); - if (!(zephir_is_true(_6))) { - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_8$$9); - zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_7$$9); - zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_7$$9); - ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { - - zval *_6, *_12$$5; - zend_bool _5; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_1); - ZVAL_LONG(_1, (1048576 | 2097152)); - ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_2)) { - ZEPHIR_INIT_VAR(allowPrivate); - ZVAL_LONG(allowPrivate, 0); - } else { - ZEPHIR_INIT_NVAR(allowPrivate); - ZVAL_LONG(allowPrivate, 8388608); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_3)) { - ZEPHIR_INIT_VAR(allowReserved); - ZVAL_LONG(allowReserved, 0); - } else { - ZEPHIR_INIT_NVAR(allowReserved); - ZVAL_LONG(allowReserved, 4194304); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_NVAR(_1); - ZVAL_BOOL(_1, 0); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _5 = zephir_is_true(_4); - if (_5) { - _5 = ZEPHIR_IS_EMPTY(value); - } - if (_5) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(options); - zephir_create_array(options, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_6); - zephir_create_array(_6, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_VAR(_7); - zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); - ZEPHIR_INIT_VAR(_8); - zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); - zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 275); - ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); - zephir_check_call_status(); - if (!(zephir_is_true(_9))) { - ZEPHIR_INIT_VAR(_10$$5); - ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_11$$5); - ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_temp_parameter(_11$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_12$$5); - zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$5); - ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { - - zval *_4$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - if (!(zephir_is_numeric(value))) { - ZEPHIR_INIT_VAR(_3$$5); - ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field :field must be numeric", 1); - } - ZEPHIR_INIT_VAR(_4$$5); - zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$5); - ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { - - zval *_4$$4; - zend_bool _1, _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - _1 = Z_TYPE_P(value) == IS_NULL; - if (!(_1)) { - _2 = Z_TYPE_P(value) == IS_STRING; - if (_2) { - _2 = !(zephir_fast_strlen_ev(value)); - } - _1 = _2; - } - if (_1) { - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "':field' is required", 1); - } - ZEPHIR_INIT_VAR(_4$$4); - zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$4); - ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { - - zval *_6$$8; - zend_bool failed = 0, _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (!(zephir_is_true(_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - failed = 0; - ZEPHIR_INIT_VAR(matches); - ZVAL_NULL(matches); - ZEPHIR_INIT_NVAR(_0); - zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); - if (zephir_is_true(_0)) { - zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); - failed = !ZEPHIR_IS_EQUAL(_4$$6, value); - } else { - failed = 1; - } - if (failed == 1) { - ZEPHIR_INIT_VAR(_5$$8); - ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); - } - ZEPHIR_INIT_VAR(_6$$8); - zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$8); - ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { - - zval *_6$$9, *_11$$12; - zend_bool _1, _3; - zephir_fcall_cache_entry *_8 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _1 = !zephir_is_true(isSetMin); - if (_1) { - _1 = !zephir_is_true(isSetMax); - } - if (_1) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 382, value); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(length); - ZVAL_LONG(length, zephir_fast_strlen_ev(value)); - } - if (zephir_is_true(isSetMax)) { - ZEPHIR_INIT_VAR(_4$$8); - ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); - zephir_check_temp_parameter(_4$$8); - zephir_check_call_status(); - if (ZEPHIR_GT(length, maximum)) { - ZEPHIR_INIT_VAR(_5$$9); - ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); - } - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$9); - ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - if (zephir_is_true(isSetMin)) { - ZEPHIR_INIT_VAR(_9$$11); - ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); - zephir_check_temp_parameter(_9$$11); - zephir_check_call_status(); - if (ZEPHIR_LT(length, minimum)) { - ZEPHIR_INIT_VAR(_10$$12); - ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); - } - ZEPHIR_INIT_VAR(_11$$12); - zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$12); - ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { - - HashTable *_2$$5, *_22$$16; - HashPosition _1$$5, _21$$16; - zend_class_entry *_33; - zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; - int ZEPHIR_LAST_CALL_STATUS, number = 0; - zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(bindTypes); - array_init(bindTypes); - ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); - zephir_check_call_status(); - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_INIT_VAR(conditions); - array_init(conditions); - ZEPHIR_INIT_VAR(bindParams); - array_init(bindParams); - number = 0; - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(composeField, _3$$5); - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_4$$8); - object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_5$$8); - ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, composeField); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_SINIT_NVAR(_9$$6); - ZVAL_LONG(&_9$$6, number); - ZEPHIR_INIT_LNVAR(_10$$6); - ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); - zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); - ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); - number++; - } - } else { - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_13$$13); - object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_14$$13); - ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, field); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_15$$15); - object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_16$$15); - ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(_17$$11); - ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); - zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); - ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); - number++; - } - ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_19, 2)) { - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); - zephir_check_call_status(); - zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) - ) { - ZEPHIR_GET_HVALUE(primaryField, _23$$16); - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_24$$20); - object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_25$$20); - ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); - zephir_check_call_status(); - zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(attributeField); - if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_26$$22); - object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_27$$22); - ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); - zephir_check_call_status(); - zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(attributeField, primaryField); - } - ZEPHIR_SINIT_NVAR(_28$$19); - ZVAL_LONG(&_28$$19, number); - ZEPHIR_INIT_LNVAR(_29$$19); - ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); - zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); - ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); - number++; - } - } - ZEPHIR_INIT_VAR(params); - array_init(params); - zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_0); - zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); - zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(className); - zephir_get_class(className, record, 0 TSRMLS_CC); - _33 = zephir_fetch_class(className TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); - zephir_check_call_status(); - if (!ZEPHIR_IS_LONG(_32, 0)) { - ZEPHIR_INIT_VAR(_34$$24); - ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(replacePairs); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_35$$25); - zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); - } - } else { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); - } - } - ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_34$$24); - ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 273); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, ":field does not have a valid url format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { - - zval *_0; - zval *handler_param = NULL, *prefix_param = NULL; - zval *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { - - zval *_0; - zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; - zval *module = NULL, *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_array_fast_append(_0, module); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { - - zend_bool _5$$6; - HashTable *_3, *_9$$14, *_13$$16, *_17$$18; - HashPosition _2, _8$$14, _12$$16, _16$$18; - zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; - zval *uri = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &uri_param); - - if (!uri_param) { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } else { - if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { - zephir_get_strval(uri, uri_param); - } else { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } - } - - - if (!(!(!uri) && Z_STRLEN_P(uri))) { - ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(realUri, uri); - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); - return; - } - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(handlers); - zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(controllerSuffix); - zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); - zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HVALUE(scope, _4); - if (Z_TYPE_P(scope) != IS_ARRAY) { - continue; - } - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); - _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); - if (_5$$6) { - _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); - } - if (_5$$6) { - continue; - } - ZEPHIR_OBS_NVAR(handler); - zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); - if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { - ZEPHIR_INIT_NVAR(controllerName); - zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(namespaceName); - zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(controllerName, handler); - ZEPHIR_OBS_NVAR(namespaceName); - zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); - } - zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(sufixed); - ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); - if (Z_TYPE_P(namespaceName) != IS_NULL) { - ZEPHIR_INIT_LNVAR(_6$$11); - ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); - ZEPHIR_CPY_WRT(sufixed, _6$$11); - } - ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); - zephir_check_call_status(); - if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { - continue; - } - ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(annotations) == IS_ARRAY) { - zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); - for ( - ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) - ) { - ZEPHIR_GET_HVALUE(annotation, _10$$14); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); - zephir_check_call_status(); - } - } - } - ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(lowerControllerName); - zephir_uncamelize(lowerControllerName, controllerName, NULL ); - zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); - for ( - ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) - ) { - ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); - ZEPHIR_GET_HVALUE(collection, _14$$16); - if (Z_TYPE_P(collection) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS - ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) - ) { - ZEPHIR_GET_HVALUE(annotation, _18$$18); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); - zephir_check_call_status(); - } - } - } - } - } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 383, realUri); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; - zval *handler = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &handler_param, &annotation); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - - - ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { - ZEPHIR_INIT_VAR(_2$$3); - ZVAL_LONG(_2$$3, 0); - ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { - - HashTable *_7$$22, *_11$$24; - HashPosition _6$$22, _10$$24; - zend_bool isRoute = 0, _14$$9, _5$$20; - zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; - zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { - zephir_get_strval(namespaceName, namespaceName_param); - } else { - ZEPHIR_INIT_VAR(namespaceName); - ZVAL_EMPTY_STRING(namespaceName); - } - if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { - zephir_get_strval(controller, controller_param); - } else { - ZEPHIR_INIT_VAR(controller); - ZVAL_EMPTY_STRING(controller); - } - if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(action_param) == IS_STRING)) { - zephir_get_strval(action, action_param); - } else { - ZEPHIR_INIT_VAR(action); - ZVAL_EMPTY_STRING(action); - } - - - isRoute = 0; - ZEPHIR_INIT_VAR(methods); - ZVAL_NULL(methods); - ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); - zephir_check_call_status(); - do { - if (ZEPHIR_IS_STRING(name, "Route")) { - isRoute = 1; - break; - } - if (ZEPHIR_IS_STRING(name, "Get")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "GET", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Post")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "POST", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Put")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "PUT", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Delete")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "DELETE", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Options")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "OPTIONS", 1); - break; - } - } while(0); - - if (isRoute == 1) { - ZEPHIR_INIT_VAR(_0$$9); - _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_2$$9); - ZVAL_STRING(&_2$$9, "", 0); - zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); - ZEPHIR_INIT_VAR(actionName); - zephir_fast_strtolower(actionName, _0$$9); - ZEPHIR_OBS_VAR(routePrefix); - zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_3$$9); - ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(paths) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(paths); - array_init(paths); - } - if (!(ZEPHIR_IS_EMPTY(module))) { - zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); - } - if (!(ZEPHIR_IS_EMPTY(namespaceName))) { - zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_LONG(_3$$9, 0); - ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(value) != IS_NULL) { - if (!ZEPHIR_IS_STRING(value, "/")) { - ZEPHIR_INIT_VAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, value); - } else { - if (Z_TYPE_P(routePrefix) != IS_NULL) { - ZEPHIR_CPY_WRT(uri, routePrefix); - } else { - ZEPHIR_CPY_WRT(uri, value); - } - } - } else { - ZEPHIR_INIT_NVAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); - } - ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); - zephir_check_call_status(); - if (Z_TYPE_P(methods) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(_4$$20); - ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); - zephir_check_temp_parameter(_4$$20); - zephir_check_call_status(); - _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; - if (!(_5$$20)) { - _5$$20 = Z_TYPE_P(methods) == IS_STRING; - } - if (_5$$20) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); - for ( - ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS - ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) - ) { - ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); - ZEPHIR_GET_HVALUE(convert, _8$$22); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); - for ( - ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS - ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) - ) { - ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); - ZEPHIR_GET_HVALUE(convert, _12$$24); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; - if (!(_14$$9)) { - _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; - } - if (_14$$9) { - ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(routeName) == IS_STRING) { - ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); - zephir_check_call_status(); - } - RETURN_MM_BOOL(1); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { - - zval *controllerSuffix_param = NULL; - zval *controllerSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &controllerSuffix_param); - - if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { - zephir_get_strval(controllerSuffix, controllerSuffix_param); - } else { - ZEPHIR_INIT_VAR(controllerSuffix); - ZVAL_EMPTY_STRING(controllerSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { - - zval *actionSuffix_param = NULL; - zval *actionSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &actionSuffix_param); - - if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { - zephir_get_strval(actionSuffix, actionSuffix_param); - } else { - ZEPHIR_INIT_VAR(actionSuffix); - ZVAL_EMPTY_STRING(actionSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { - - - - RETURN_MEMBER(this_ptr, "_handlers"); - -} - -zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { - - zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; - - ZEPHIR_MM_GROW(); - - { - zval *this_ptr = NULL; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); - if (Z_TYPE_P(_0) == IS_NULL) { - ZEPHIR_INIT_VAR(_1$$3); - array_init(_1$$3); - zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); - } - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); - if (Z_TYPE_P(_2) == IS_NULL) { - ZEPHIR_INIT_VAR(_3$$4); - array_init(_3$$4); - zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); - } - _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); - if (Z_TYPE_P(_4) == IS_NULL) { - ZEPHIR_INIT_VAR(_5$$5); - array_init(_5$$5); - zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJVAL_P(this_ptr); - } - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *paths = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - _0 = Z_TYPE_P(paths) == IS_ARRAY; - if (!(_0)) { - _0 = Z_TYPE_P(paths) == IS_STRING; - } - if (_0) { - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - } - if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - zephir_get_strval(hostname, hostname_param); - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - zephir_get_strval(prefix, prefix_param); - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { - - - - RETURN_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { - - zval *beforeMatch; - - zephir_fetch_params(0, 1, 0, &beforeMatch); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { - - zval *paths; - - zephir_fetch_params(0, 1, 0, &paths); - - - - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { - - - - RETURN_MEMBER(this_ptr, "_routes"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - - zval *_0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - array_init(_0); - zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(defaultPaths); - zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); - if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(processedPaths, paths); - } - if (Z_TYPE_P(processedPaths) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedPaths); - zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); - } - } else { - ZEPHIR_CPY_WRT(mergedPaths, paths); - } - ZEPHIR_INIT_VAR(route); - object_init_ex(route, phalcon_mvc_router_route_ce); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_2); - ZEPHIR_CONCAT_VV(_2, _1, pattern); - ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 384, this_ptr); - zephir_check_call_status(); - RETURN_CCTOR(route); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - ZEPHIR_OBS_VAR(uniqueId); - zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); - if (Z_TYPE_P(uniqueId) == IS_NULL) { - ZEPHIR_INIT_NVAR(uniqueId); - ZVAL_LONG(uniqueId, 0); - } - ZEPHIR_CPY_WRT(routeId, uniqueId); - zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { - - zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { - ZEPHIR_INIT_VAR(idPattern); - ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); - if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { - ZEPHIR_INIT_VAR(_0$$4); - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_STRING(&_1$$4, "/:module", 0); - zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _0$$4); - } - if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { - ZEPHIR_INIT_VAR(_2$$5); - ZEPHIR_SINIT_VAR(_3$$5); - ZVAL_STRING(&_3$$5, "/:controller", 0); - zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _2$$5); - } - if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_SINIT_VAR(_5$$6); - ZVAL_STRING(&_5$$6, "/:namespace", 0); - zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _4$$6); - } - if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_SINIT_VAR(_7$$7); - ZVAL_STRING(&_7$$7, "/:action", 0); - zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _6$$7); - } - if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { - ZEPHIR_INIT_VAR(_8$$8); - ZEPHIR_SINIT_VAR(_9$$8); - ZVAL_STRING(&_9$$8, "/:params", 0); - ZEPHIR_SINIT_VAR(_10$$8); - ZVAL_STRING(&_10$$8, "(/.*)*", 0); - zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); - zephir_get_strval(pattern, _8$$8); - } - if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_SINIT_VAR(_12$$9); - ZVAL_STRING(&_12$$9, "/:int", 0); - ZEPHIR_SINIT_VAR(_13$$9); - ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); - zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); - zephir_get_strval(pattern, _11$$9); - } - } - if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - RETURN_CTOR(pattern); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { - - long _0, _5$$11, _26$$19; - zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; - int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; - char ch = 0, prevCh; - zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; - zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - prevCh = '\0'; - bracketCount = 0; - parenthesesCount = 0; - foundPattern = 0; - intermediate = 0; - numberMatches = 0; - if (zephir_fast_strlen_ev(pattern) <= 0) { - RETURN_MM_BOOL(0); - } - ZEPHIR_INIT_VAR(matches); - array_init(matches); - ZEPHIR_INIT_VAR(route); - ZVAL_EMPTY_STRING(route); - for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { - cursor = _0; - ch = ZEPHIR_STRING_OFFSET(pattern, _0); - if (parenthesesCount == 0) { - if (ch == '{') { - if (bracketCount == 0) { - marker = (cursor + 1); - intermediate = 0; - notValid = 0; - } - bracketCount++; - } else { - if (ch == '}') { - bracketCount--; - if (intermediate > 0) { - if (bracketCount == 0) { - numberMatches++; - ZEPHIR_INIT_NVAR(variable); - ZVAL_EMPTY_STRING(variable); - ZEPHIR_INIT_NVAR(regexp); - ZVAL_EMPTY_STRING(regexp); - ZEPHIR_SINIT_NVAR(_1$$11); - ZVAL_LONG(&_1$$11, marker); - ZEPHIR_SINIT_NVAR(_2$$11); - ZVAL_LONG(&_2$$11, (cursor - marker)); - ZEPHIR_INIT_NVAR(_3$$11); - zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); - zephir_get_strval(_4$$11, _3$$11); - ZEPHIR_CPY_WRT(item, _4$$11); - for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { - cursorVar = _5$$11; - ch = ZEPHIR_STRING_OFFSET(item, _5$$11); - if (ch == '\0') { - break; - } - _6$$12 = cursorVar == 0; - if (_6$$12) { - _7$$12 = ch >= 'a'; - if (_7$$12) { - _7$$12 = ch <= 'z'; - } - _8$$12 = _7$$12; - if (!(_8$$12)) { - _9$$12 = ch >= 'A'; - if (_9$$12) { - _9$$12 = ch <= 'Z'; - } - _8$$12 = _9$$12; - } - _6$$12 = !(_8$$12); - } - if (_6$$12) { - notValid = 1; - break; - } - _10$$12 = ch >= 'a'; - if (_10$$12) { - _10$$12 = ch <= 'z'; - } - _11$$12 = _10$$12; - if (!(_11$$12)) { - _12$$12 = ch >= 'A'; - if (_12$$12) { - _12$$12 = ch <= 'Z'; - } - _11$$12 = _12$$12; - } - _13$$12 = _11$$12; - if (!(_13$$12)) { - _14$$12 = ch >= '0'; - if (_14$$12) { - _14$$12 = ch <= '9'; - } - _13$$12 = _14$$12; - } - _15$$12 = _13$$12; - if (!(_15$$12)) { - _15$$12 = ch == '-'; - } - _16$$12 = _15$$12; - if (!(_16$$12)) { - _16$$12 = ch == '_'; - } - _17$$12 = _16$$12; - if (!(_17$$12)) { - _17$$12 = ch == ':'; - } - if (_17$$12) { - if (ch == ':') { - ZEPHIR_SINIT_NVAR(_18$$16); - ZVAL_LONG(&_18$$16, 0); - ZEPHIR_SINIT_NVAR(_19$$16); - ZVAL_LONG(&_19$$16, cursorVar); - ZEPHIR_INIT_NVAR(_20$$16); - zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); - zephir_get_strval(_21$$16, _20$$16); - ZEPHIR_CPY_WRT(variable, _21$$16); - ZEPHIR_SINIT_NVAR(_22$$16); - ZVAL_LONG(&_22$$16, (cursorVar + 1)); - ZEPHIR_INIT_NVAR(_23$$16); - zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_get_strval(_24$$16, _23$$16); - ZEPHIR_CPY_WRT(regexp, _24$$16); - break; - } - } else { - notValid = 1; - break; - } - } - if (!(notValid)) { - tmp = numberMatches; - _25$$18 = zephir_is_true(variable); - if (_25$$18) { - _25$$18 = zephir_is_true(regexp); - } - if (_25$$18) { - foundPattern = 0; - for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { - ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); - if (ch == '\0') { - break; - } - if (!(foundPattern)) { - if (ch == '(') { - foundPattern = 1; - } - } else { - if (ch == ')') { - foundPattern = 2; - break; - } - } - } - if (foundPattern != 2) { - ZEPHIR_INIT_LNVAR(_27$$26); - ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); - zephir_concat_self(&route, _27$$26 TSRMLS_CC); - } else { - zephir_concat_self(&route, regexp TSRMLS_CC); - } - ZEPHIR_INIT_NVAR(_28$$19); - ZVAL_LONG(_28$$19, tmp); - zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_29$$28); - ZVAL_LONG(_29$$28, tmp); - zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_LNVAR(_30$$29); - ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); - zephir_concat_self(&route, _30$$29 TSRMLS_CC); - } - continue; - } - } - } - } - } - if (bracketCount == 0) { - if (ch == '(') { - parenthesesCount++; - } else { - if (ch == ')') { - parenthesesCount--; - if (parenthesesCount == 0) { - numberMatches++; - } - } - } - } - if (bracketCount > 0) { - intermediate++; - } else { - _31$$36 = parenthesesCount == 0; - if (_31$$36) { - _31$$36 = prevCh != '\\'; - } - if (_31$$36) { - _32$$37 = ch == '.'; - if (!(_32$$37)) { - _32$$37 = ch == '+'; - } - _33$$37 = _32$$37; - if (!(_33$$37)) { - _33$$37 = ch == '|'; - } - _34$$37 = _33$$37; - if (!(_34$$37)) { - _34$$37 = ch == '#'; - } - if (_34$$37) { - zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); - } - } - zephir_concat_self_char(&route, ch TSRMLS_CC); - prevCh = ch; - } - } - zephir_create_array(return_value, 2, 0 TSRMLS_CC); - zephir_array_fast_append(return_value, route); - zephir_array_fast_append(return_value, matches); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); - zephir_check_call_status(); - if (!(zephir_start_with_str(pattern, SL("#")))) { - if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { - ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(pcrePattern); - zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_VAR(_0$$4); - zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); - zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); - ZEPHIR_CPY_WRT(routePaths, _0$$4); - } else { - ZEPHIR_CPY_WRT(pcrePattern, pattern); - } - ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(compiledPattern, pattern); - } - zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { - - int _0$$4; - zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(paths) != IS_NULL) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_INIT_VAR(moduleName); - ZVAL_NULL(moduleName); - ZEPHIR_INIT_VAR(controllerName); - ZVAL_NULL(controllerName); - ZEPHIR_INIT_VAR(actionName); - ZVAL_NULL(actionName); - ZEPHIR_INIT_VAR(parts); - zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); - do { - _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); - if (_0$$4 == 3) { - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); - break; - } - if (_0$$4 == 2) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); - break; - } - if (_0$$4 == 1) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); - break; - } - } while(0); - - ZEPHIR_INIT_VAR(routePaths); - array_init(routePaths); - if (Z_TYPE_P(moduleName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(controllerName) != IS_NULL) { - if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { - ZEPHIR_INIT_VAR(realClassName); - zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(namespaceName); - zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); - if (zephir_is_true(namespaceName)) { - zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(realClassName, controllerName); - } - ZEPHIR_INIT_VAR(_1$$9); - zephir_uncamelize(_1$$9, realClassName, NULL ); - zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(actionName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(routePaths, paths); - } - } else { - ZEPHIR_INIT_NVAR(routePaths); - array_init(routePaths); - } - if (Z_TYPE_P(routePaths) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); - return; - } - RETURN_CCTOR(routePaths); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { - - - - RETURN_MEMBER(this_ptr, "_name"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { - - zval *name_param = NULL; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - zephir_get_strval(name, name_param); - - - zephir_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { - - - - RETURN_MEMBER(this_ptr, "_match"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { - - - - RETURN_MEMBER(this_ptr, "_id"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { - - - - RETURN_MEMBER(this_ptr, "_pattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { - - - - RETURN_MEMBER(this_ptr, "_compiledPattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { - - HashTable *_2; - HashPosition _1; - zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(reversed); - array_init(reversed); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); - zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HMKEY(path, _2, _1); - ZEPHIR_GET_HVALUE(position, _3); - zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); - } - RETURN_CCTOR(reversed); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { - - - - RETURN_MEMBER(this_ptr, "_methods"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { - zephir_get_strval(hostname, hostname_param); - } else { - ZEPHIR_INIT_VAR(hostname); - ZVAL_EMPTY_STRING(hostname); - } - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { - - zval *group; - - zephir_fetch_params(0, 1, 0, &group); - - - - zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { - - - - RETURN_MEMBER(this_ptr, "_group"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { - - zval *name_param = NULL, *converter; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &converter); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { - - - - RETURN_MEMBER(this_ptr, "_converters"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { - - - - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - - -#ifdef HAVE_CONFIG_H -#endif - - - -#if PHP_VERSION_ID < 70000 -#else -#endif - - -static void phalcon_get_uri(zval *return_value, zval *path) -{ - int i, found = 0, mark = 0; - char *cursor, *str, ch; - - if (Z_TYPE_P(path) != IS_STRING) { - RETURN_EMPTY_STRING(); - } - - if (Z_STRLEN_P(path) > 0) { - cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; - for (i = Z_STRLEN_P(path); i > 0; i--) { - ch = *cursor; - if (ch == '/' || ch == '\\') { - found++; - if (found == 1) { - mark = i - 1; - } else { - str = emalloc(mark - i + 1); - memcpy(str, Z_STRVAL_P(path) + i, mark - i); - str[mark - i] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, str, mark - i, 0); -#else - ZVAL_STRINGL(return_value, str, mark - i); -#endif - return; - } - } - cursor--; - } - } - - RETURN_EMPTY_STRING(); -} - -zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) -{ - unsigned int length = 0, variable_length, ch, j; - char *item = NULL, *cursor_var, *variable = NULL; - int not_valid = 0; -#if PHP_VERSION_ID < 70000 - int result = FAILURE; - zval **zv, **tmp; -#else - zval *zv, *tmp; -#endif - - if (named) { - length = cursor - marker - 1; - item = estrndup(marker + 1, length); - cursor_var = item; - marker = item; - for (j = 0; j < length; j++) { - ch = *cursor_var; - if (ch == '\0') { - not_valid = 1; - break; - } - if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ - not_valid = 1; - break; - } - if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { - if (ch == ':') { - variable_length = cursor_var - marker; - variable = estrndup(marker, variable_length); - break; - } - } else { - not_valid = 1; - break; - } - cursor_var++; - } - } - - if (!not_valid) { - - if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { - if (named) { - if (variable) { - efree(item); - item = variable; - length = variable_length; - } -#if PHP_VERSION_ID < 70000 - if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { - efree(item); - (*position)++; - return *zv; - } - } -#else - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { - if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { - efree(item); - (*position)++; - return zv; - } - } -#endif - } else { -#if PHP_VERSION_ID < 70000 - if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { - if (Z_TYPE_PP(zv) == IS_STRING) { - if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { - (*position)++; - return *tmp; - } - } - } - } -#else - if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { - if (Z_TYPE_P(zv) == IS_STRING) { - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { - if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { - (*position)++; - return tmp; - } - } - } - } -#endif - } - } - - (*position)++; - } - - if (item) { - efree(item); - } - - return NULL; -} - -static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) -{ - - char *cursor, *marker = NULL; - unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; - unsigned char ch; - smart_str route_str = {0}; - ulong position = 1; - int i; - zval *replace, replace_copy; - int use_copy, looking_placeholder = 0; - - if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { - ZVAL_NULL(return_value); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); - return; - } - - if (Z_STRLEN_P(pattern) <= 0) { - ZVAL_FALSE(return_value); - return; - } - - cursor = Z_STRVAL_P(pattern); - if (*cursor == '/') { - ++cursor; - i = 1; - } - else { - i = 0; - } - - if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); -#else - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); -#endif - return; - } - - for (; i < Z_STRLEN_P(pattern); ++i) { - - ch = *cursor; - if (ch == '\0') { - break; - } - - if (parentheses_count == 0 && !looking_placeholder) { - if (ch == '{') { - if (bracket_count == 0) { - marker = cursor; - intermediate = 0; - } - bracket_count++; - } else { - if (ch == '}') { - bracket_count--; - if (intermediate > 0) { - if (bracket_count == 0) { - replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && !looking_placeholder) { - if (ch == '(') { - if (parentheses_count == 0) { - marker = cursor; - intermediate = 0; - } - parentheses_count++; - } else { - if (ch == ')') { - parentheses_count--; - if (intermediate > 0) { - if (parentheses_count == 0) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && parentheses_count == 0) { - if (looking_placeholder) { - if (intermediate > 0) { - if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - looking_placeholder = 0; - continue; - } - } - } else { - if (ch == ':') { - looking_placeholder = 1; - marker = cursor; - intermediate = 0; - } - } - } - - if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { - intermediate++; - } else { - smart_str_appendc(&route_str, ch); - } - - cursor++; - } - smart_str_0(&route_str); - -#if PHP_VERSION_ID < 70000 - if (route_str.len) { - RETURN_STRINGL(route_str.c, route_str.len, 0); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#else - if (route_str.s) { - RETURN_STR(route_str.s); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#endif -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { - - zval *view, *dependencyInjector = NULL; - - zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); - - if (!dependencyInjector) { - dependencyInjector = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { - - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *_0; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { - - - - RETURN_MEMBER(this_ptr, "_view"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { - - - - RETURN_MEMBER(this_ptr, "_registeredEngines"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &options_param); - - if (!options_param) { - ZEPHIR_INIT_VAR(options); - array_init(options); - } else { - zephir_get_arrval(options, options_param); - } - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { - - zval *viewsDir_param = NULL; - zval *viewsDir = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewsDir_param); - - if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { - zephir_get_strval(viewsDir, viewsDir_param); - } else { - ZEPHIR_INIT_VAR(viewsDir); - ZVAL_EMPTY_STRING(viewsDir); - } - - - zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { - - - - RETURN_MEMBER(this_ptr, "_viewsDir"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { - - zval *engines_param = NULL; - zval *engines = NULL; - - zephir_fetch_params(0, 1, 0, &engines_param); - - engines = engines_param; - - - zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(engines); - array_init(engines); - ZEPHIR_OBS_VAR(registeredEngines); - zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); - if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); - zephir_check_call_status(); - zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); - } else { - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); - return; - } - ZEPHIR_INIT_VAR(arguments); - zephir_create_array(arguments, 2, 0 TSRMLS_CC); - zephir_array_fast_append(arguments, this_ptr); - zephir_array_fast_append(arguments, dependencyInjector); - zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(engineService, _3$$5); - if (Z_TYPE_P(engineService) == IS_OBJECT) { - if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_NVAR(engineObject); - ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(engineObject, engineService); - } - } else { - if (Z_TYPE_P(engineService) == IS_STRING) { - ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_5$$13); - object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_LNVAR(_6$$13); - ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); - ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); - } - } - zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - } - RETURN_CCTOR(engines); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { - - HashTable *_4; - HashPosition _3; - zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; - zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - - - ZEPHIR_OBS_VAR(eventsManager); - zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_1$$4); - ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { - RETURN_MM_NULL(); - } - } - notExists = 1; - mustClean = 1; - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(viewsDirPath); - ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); - ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); - for ( - ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS - ; zephir_hash_move_forward_ex(_4, &_3) - ) { - ZEPHIR_GET_HMKEY(extension, _4, _3); - ZEPHIR_GET_HVALUE(engine, _5); - ZEPHIR_INIT_LNVAR(_6$$6); - ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); - if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); - } else { - _7$$8 = zephir_is_true(extension); - if (_7$$8) { - ZEPHIR_SINIT_NVAR(_8$$8); - ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); - ZEPHIR_INIT_NVAR(_9$$8); - zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); - _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); - } - _10$$8 = _7$$8; - if (_10$$8) { - _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); - } - if (_10$$8) { - ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); - } else { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZVAL_STRING(viewEnginePath, "", 1); - } - } - if (zephir_is_true(viewEnginePath)) { - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_12$$12); - ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); - zephir_check_temp_parameter(_12$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { - continue; - } - } - ZEPHIR_INIT_NVAR(_14$$11); - if (mustClean) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); - zephir_check_call_status(); - notExists = 0; - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_15$$14); - ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); - zephir_check_temp_parameter(_15$$14); - zephir_check_call_status(); - } - break; - } - } - if (notExists == 1) { - ZEPHIR_INIT_VAR(_17$$15); - object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_18$$15); - ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); - ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_19$$16); - ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); - zephir_check_temp_parameter(_19$$16); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { - - zend_bool _3$$12; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { - ZEPHIR_INIT_VAR(key); - ZVAL_NULL(key); - ZEPHIR_INIT_VAR(lifetime); - ZVAL_NULL(lifetime); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(key); - zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); - } - if (Z_TYPE_P(key) == IS_NULL) { - ZEPHIR_INIT_NVAR(key); - zephir_md5(key, path); - } - ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); - zephir_check_call_status(); - if (Z_TYPE_P(content) != IS_NULL) { - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_CCTOR(content); - } - } - } - ZEPHIR_INIT_VAR(_1); - zephir_create_symbol_table(TSRMLS_C); - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(params) == IS_ARRAY) { - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - } else { - ZEPHIR_CPY_WRT(mergedParams, viewParams); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, path, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_2$$12); - if (_3$$12) { - ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_4$$12); - } - if (_3$$12) { - ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - RETURN_MM_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_INIT_VAR(_0$$3); - zephir_create_symbol_table(TSRMLS_C); - - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, partialPath, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); - zend_print_zval(_1, 0); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - - zephir_get_arrval(options, options_param); - - - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { - - - - RETURN_MEMBER(this_ptr, "_cacheOptions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { - - zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); - return; - } - ZEPHIR_INIT_VAR(cacheService); - ZVAL_STRING(cacheService, "viewCache", 1); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - if (zephir_array_isset_string(cacheOptions, SS("service"))) { - ZEPHIR_OBS_NVAR(cacheService); - zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); - } - } - ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(viewCache, _0); - if (Z_TYPE_P(viewCache) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); - return; - } - RETURN_CCTOR(viewCache); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { - - zend_bool _1; - zval *_0, *_2, *_3$$3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = zephir_is_true(_0); - if (_1) { - ZEPHIR_OBS_VAR(_2); - zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = Z_TYPE_P(_2) != IS_OBJECT; - } - if (_1) { - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); - } - RETURN_MM_MEMBER(this_ptr, "_cache"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { - - zval *options = NULL; - - zephir_fetch_params(0, 0, 1, &options); - - if (!options) { - options = ZEPHIR_GLOBAL(global_true); - } - - - if (Z_TYPE_P(options) == IS_ARRAY) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - } else { - if (zephir_is_true(options)) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } else { - if (0) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { - - zend_bool merge, _0; - zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; - zval *params = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); - - params = params_param; - if (!merge_param) { - merge = 1; - } else { - merge = zephir_get_boolval(merge_param); - } - - - _0 = merge; - if (_0) { - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); - _0 = Z_TYPE_P(_1) == IS_ARRAY; - } - if (_0) { - ZEPHIR_INIT_VAR(_2$$3); - _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); - } - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { - - - - RETURN_MEMBER(this_ptr, "_viewParams"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { - - zval *content_param = NULL; - zval *content = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &content_param); - - if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(content_param) == IS_STRING)) { - zephir_get_strval(content, content_param); - } else { - ZEPHIR_INIT_VAR(content); - ZVAL_EMPTY_STRING(content); - } - - - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { - - - - RETURN_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { - - - - RETURN_MEMBER(this_ptr, "_activeRenderPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean == 1) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean == 1) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { - - zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(compiler); - zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); - if (Z_TYPE_P(compiler) != IS_OBJECT) { - ZEPHIR_INIT_NVAR(compiler); - object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 389, _0$$3); - zephir_check_call_status(); - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); - if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 390, dependencyInjector); - zephir_check_call_status(); - } - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 391, options); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); - } - RETURN_CCTOR(compiler); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *item; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); - - - - _0 = Z_TYPE_P(item) == IS_OBJECT; - if (!(_0)) { - _0 = Z_TYPE_P(item) == IS_ARRAY; - } - if (_0) { - RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 382, item); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_MM_LONG(zephir_fast_strlen_ev(item)); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &needle, &haystack); - - - - if (Z_TYPE_P(haystack) == IS_ARRAY) { - RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); - } - if (Z_TYPE_P(haystack) == IS_STRING) { - if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 392, haystack, needle); - zephir_check_call_status(); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); - } - ZEPHIR_INIT_VAR(_1$$4); - zephir_fast_strpos(_1$$4, haystack, needle, 0 ); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { - - zend_bool _0, _1; - int ZEPHIR_LAST_CALL_STATUS; - zval *text_param = NULL, *from_param = NULL, *to_param = NULL; - zval *text = NULL, *from = NULL, *to = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); - - zephir_get_strval(text, text_param); - if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(from_param) == IS_STRING)) { - zephir_get_strval(from, from_param); - } else { - ZEPHIR_INIT_VAR(from); - ZVAL_EMPTY_STRING(from); - } - if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(to_param) == IS_STRING)) { - zephir_get_strval(to, to_param); - } else { - ZEPHIR_INIT_VAR(to); - ZVAL_EMPTY_STRING(to); - } - - - _0 = ZEPHIR_IS_STRING(from, "latin1"); - if (!(_0)) { - _0 = ZEPHIR_IS_STRING(to, "utf8"); - } - if (_0) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 393, text); - zephir_check_call_status(); - RETURN_MM(); - } - _1 = ZEPHIR_IS_STRING(to, "latin1"); - if (!(_1)) { - _1 = ZEPHIR_IS_STRING(from, "utf8"); - } - if (_1) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 394, text); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 395, from, to, text); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { - - zend_bool _1$$5; - zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; - int start, ZEPHIR_LAST_CALL_STATUS, position = 0; - zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &value, &start_param, &end); - - if (!start_param) { - start = 0; - } else { - start = zephir_get_intval(start_param); - } - if (!end) { - ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(end); - } - - - if (Z_TYPE_P(value) == IS_OBJECT) { - if (Z_TYPE_P(end) == IS_NULL) { - ZEPHIR_INIT_NVAR(end); - ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); - } - position = 0; - ZEPHIR_INIT_VAR(slice); - array_init(slice); - ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0$$3))) { - break; - } - _1$$5 = position >= start; - if (_1$$5) { - _1$$5 = ZEPHIR_GE_LONG(end, position); - } - if (_1$$5) { - ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); - zephir_check_call_status(); - zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); - } - ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); - zephir_check_call_status(); - position++; - } - RETURN_CCTOR(slice); - } - ZEPHIR_INIT_VAR(length); - if (Z_TYPE_P(end) != IS_NULL) { - ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); - } else { - ZVAL_NULL(length); - } - if (Z_TYPE_P(value) == IS_ARRAY) { - ZEPHIR_SINIT_VAR(_5$$9); - ZVAL_LONG(&_5$$9, start); - ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 396, value, &_5$$9, length); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_6$$11); - ZVAL_LONG(&_6$$11, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_6$$11, length); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_8$$10); - ZVAL_LONG(&_8$$10, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_8$$10); - zephir_check_call_status(); - RETURN_MM(); - } - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_9$$12); - ZVAL_LONG(&_9$$12, start); - zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, start); - zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *value_param = NULL; - zval *value = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value_param); - - zephir_get_arrval(value, value_param); - - - ZEPHIR_MAKE_REF(value); - ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 398, value); - ZEPHIR_UNREF(value); - zephir_check_call_status(); - RETURN_CTOR(value); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *arguments = NULL; - zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; - zval *name = NULL, *_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments_param) { - ZEPHIR_INIT_VAR(arguments); - array_init(arguments); - } else { - zephir_get_arrval(arguments, arguments_param); - } - - - ZEPHIR_OBS_VAR(macro); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_1$$3); - object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_2$$3); - ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 399, macro, arguments); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - - -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ - - phvolt_parser_token *pToken; - - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ - - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); - - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; - - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} - -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ - - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); - } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); - } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); - } - - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); -} - -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif - - ZVAL_NULL(result); - -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif - - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; - } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; - } - - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; - } - - return 1; -} - -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { - - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; - - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } - - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; - } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; - } - - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; - - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; - - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; - - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); - } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; - } - } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); - } else { - efree(token.value); - } - break; - - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; - - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; - - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; - - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; - - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; - - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; - - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; - - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; - - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; - - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; - - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; - - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; - - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; - - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; - - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; - - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; - - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; - - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; - } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; - } - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); -#endif - efree(parser_status->syntax_error); - } - } - - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { - - zval *view = NULL; - - zephir_fetch_params(0, 0, 1, &view); - - if (!view) { - view = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(view) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { - - zval *option_param = NULL, *value; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &option_param, &value); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { - - zval *option_param = NULL, *value = NULL, *_0; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &option_param); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { - - zval *_3$$6 = NULL, *_4$$7 = NULL; - HashTable *_1$$3; - HashPosition _0$$3; - int ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments) { - arguments = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(extension, _2$$3); - if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(arguments) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_3$$6); - zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$6, extension); - zephir_array_fast_append(_3$$6, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_4$$7); - zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_4$$7, extension); - zephir_array_fast_append(_4$$7, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC(status, _4$$7); - zephir_check_call_status(); - } - if (Z_TYPE_P(status) == IS_STRING) { - RETURN_CCTOR(status); - } - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *extension; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &extension); - - - - if (Z_TYPE_P(extension) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); - return; - } - if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); - zephir_check_call_status(); - } - zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { - - - - RETURN_MEMBER(this_ptr, "_extensions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { - - - - RETURN_MEMBER(this_ptr, "_functions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { - - - - RETURN_MEMBER(this_ptr, "_filters"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { - - zval *_7$$5; - zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - ZEPHIR_INIT_VAR(_1$$3); - _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); - zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(_3); - zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_3) == IS_OBJECT) { - ZEPHIR_OBS_VAR(_4$$4); - zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_5$$5); - _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_7$$5); - zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_7$$5, this_ptr); - ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); - } - } - ZEPHIR_OBS_VAR(_8); - zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_8) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); - return; - } - RETURN_MM_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { - - zend_bool _3$$5, _8$$8; - zephir_fcall_cache_entry *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; - zval *expr = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - ZEPHIR_OBS_VAR(left); - zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); - zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 265)) { - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); - if (ZEPHIR_IS_STRING(variable, "loop")) { - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); - zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); - } else { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; - if (_3$$5) { - ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); - zephir_check_call_status(); - _3$$5 = zephir_is_true(_4$$5); - } - if (_3$$5) { - ZEPHIR_INIT_VAR(_5$$6); - ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); - zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_CONCAT_SV(_6$$7, "$", variable); - zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); - } - } - } else { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(leftType); - zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); - _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); - if (_8$$8) { - _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); - } - if (_8$$8) { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } else { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } - } - zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); - ZEPHIR_OBS_VAR(right); - zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); - zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_9, 265)) { - zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); - zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); - } else { - ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); - } - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { - - zend_bool _8$$5; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; - zval *expr = NULL, *_1$$6, *_3$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(arguments); - ZVAL_STRING(arguments, "", 1); - } - ZEPHIR_OBS_VAR(nameExpr); - zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_VAR(nameType); - zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - if (ZEPHIR_IS_LONG(nameType, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_1$$6); - zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_1$$6, name); - zephir_array_fast_append(_1$$6, arguments); - zephir_array_fast_append(_1$$6, funcArguments); - ZEPHIR_INIT_VAR(_2$$6); - ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _2$$6, _1$$6); - zephir_check_temp_parameter(_2$$6); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(functions); - zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); - if (Z_TYPE_P(functions) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_3$$12); - zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$12, arguments); - zephir_array_fast_append(_3$$12, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_4$$9); - object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); - zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$9); - ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); - ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); - if (!(_8$$5)) { - _8$$5 = ZEPHIR_IS_STRING(name, "content"); - } - if (_8$$5) { - RETURN_MM_STRING("$this->getContent()", 1); - } - if (ZEPHIR_IS_STRING(name, "partial")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "super")) { - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { - ZEPHIR_OBS_VAR(currentBlock); - zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(block); - if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { - ZEPHIR_OBS_VAR(exprLevel); - zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 402, block); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, code); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, code TSRMLS_CC); - } - } else { - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, block); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, block TSRMLS_CC); - } - } - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - RETURN_CCTOR(escapedCode); - } - ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); - RETURN_MM(); - } - } - RETURN_MM_STRING("''", 1); - } - ZEPHIR_INIT_VAR(_9$$5); - zephir_camelize(_9$$5, name, NULL ); - ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(className); - ZVAL_STRING(className, "Phalcon\\Tag", 1); - if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { - ZEPHIR_OBS_VAR(arrayHelpers); - zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); - if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(arrayHelpers); - zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); - zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); - } - if (zephir_array_isset(arrayHelpers, name)) { - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "static_url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "date")) { - ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "time")) { - RETURN_MM_STRING("time()", 1); - } - if (ZEPHIR_IS_STRING(name, "dump")) { - ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "version")) { - RETURN_MM_STRING("Phalcon\\Version::get()", 1); - } - if (ZEPHIR_IS_STRING(name, "version_id")) { - RETURN_MM_STRING("Phalcon\\Version::getId()", 1); - } - if (ZEPHIR_IS_STRING(name, "constant")) { - ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 400, nameExpr); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { - - zephir_fcall_cache_entry *_2 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; - zval *test = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &test_param, &left_param); - - test = test_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); - if (ZEPHIR_IS_STRING(name, "empty")) { - ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "even")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "odd")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "numeric")) { - ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "scalar")) { - ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "iterable")) { - ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); - RETURN_MM(); - } - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_OBS_VAR(testName); - zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { - if (ZEPHIR_IS_STRING(name, "divisibleby")) { - zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 400, _1$$12); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sameas")) { - zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 400, _4$$13); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "type")) { - zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 400, _6$$14); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); - RETURN_MM(); - } - } - } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 400, test); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { - - zend_bool _13, _14, _15; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; - zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &filter_param, &left_param); - - filter = filter_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); - } else { - if (!ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_INIT_VAR(_0$$5); - object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); - ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_VAR(functionName); - zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_INIT_VAR(arguments); - ZVAL_NULL(arguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { - if (!ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_OBS_VAR(file); - zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_OBS_VAR(line); - zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_INIT_VAR(_4$$7); - zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); - add_assoc_long_ex(_5$$7, SS("type"), 364); - zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - ZEPHIR_MAKE_REF(funcArguments); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, funcArguments, _4$$7); - ZEPHIR_UNREF(funcArguments); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(arguments, left); - } - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_6$$9, name); - zephir_array_fast_append(_6$$9, arguments); - zephir_array_fast_append(_6$$9, funcArguments); - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _7$$9, _6$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(filters); - zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); - if (Z_TYPE_P(filters) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_8$$15); - zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_8$$15, arguments); - zephir_array_fast_append(_8$$15, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_9$$12); - object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); - zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$12); - ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - if (ZEPHIR_IS_STRING(name, "length")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); - RETURN_MM(); - } - _13 = ZEPHIR_IS_STRING(name, "e"); - if (!(_13)) { - _13 = ZEPHIR_IS_STRING(name, "escape"); - } - if (_13) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_css")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_js")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_attr")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "trim")) { - ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "left_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "right_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "striptags")) { - ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slashes")) { - ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "stripslashes")) { - ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "nl2br")) { - ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "keys")) { - ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "join")) { - ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); - RETURN_MM(); - } - _14 = ZEPHIR_IS_STRING(name, "lower"); - if (!(_14)) { - _14 = ZEPHIR_IS_STRING(name, "lowercase"); - } - if (_14) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); - RETURN_MM(); - } - _15 = ZEPHIR_IS_STRING(name, "upper"); - if (!(_15)) { - _15 = ZEPHIR_IS_STRING(name, "uppercase"); - } - if (_15) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "capitalize")) { - ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sort")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_decode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "format")) { - ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "abs")) { - ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slice")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "convert_encoding")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_16); - object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_INIT_VAR(_19); - ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); - ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); - zephir_check_call_status(); - zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { - - HashTable *_4$$6; - HashPosition _3$$6; - zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; - zval *expr = NULL, *_0$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - while (1) { - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_0$$4); - zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_0$$4, expr); - ZEPHIR_INIT_NVAR(_1$$4); - ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 401, _1$$4, _0$$4); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (Z_TYPE_P(exprCode) == IS_STRING) { - break; - } - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(items); - array_init(items); - zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); - for ( - ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) - ) { - ZEPHIR_GET_HVALUE(singleExpr, _5$$6); - zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 400, _6$$7); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_LNVAR(_8$$8); - ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); - zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); - } else { - zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); - } - } - ZEPHIR_INIT_NVAR(exprCode); - zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, '.')) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(left); - if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - } - if (ZEPHIR_IS_LONG(type, 311)) { - zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 124)) { - zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 404, _12$$13, leftCode); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(right); - if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_NULL(exprCode); - do { - if (ZEPHIR_IS_LONG(type, '!')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '*')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '+')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '-')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '/')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 37)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '<')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 61)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 62)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 126)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 278)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 360)) { - ZEPHIR_INIT_NVAR(exprCode); - if (zephir_array_isset_string(expr, SS("left"))) { - ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); - } else { - ZVAL_STRING(exprCode, "[]", 1); - } - break; - } - if (ZEPHIR_IS_LONG(type, 258)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 259)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 260)) { - ZEPHIR_INIT_NVAR(_14$$31); - zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); - ZEPHIR_SINIT_NVAR(_16$$31); - ZVAL_STRING(&_16$$31, "'", 0); - ZEPHIR_SINIT_NVAR(_17$$31); - ZVAL_STRING(&_17$$31, "\\'", 0); - zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); - break; - } - if (ZEPHIR_IS_LONG(type, 261)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "null", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 262)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "false", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 263)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "true", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 265)) { - zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); - break; - } - if (ZEPHIR_IS_LONG(type, 266)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 267)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 270)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 271)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 272)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 273)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 274)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 275)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 276)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 356)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 361)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); - break; - } - if (ZEPHIR_IS_LONG(type, 365)) { - ZEPHIR_OBS_NVAR(start); - if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 400, start); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(startCode); - ZVAL_STRING(startCode, "null", 1); - } - ZEPHIR_OBS_NVAR(end); - if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 400, end); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(endCode); - ZVAL_STRING(endCode, "null", 1); - } - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 362)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 363)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 392)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 386)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 393)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 387)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 394)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 388)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 395)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 389)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 396)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 390)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 397)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 391)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 367)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 366)) { - zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 400, _21$$69); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 368)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 369)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 364)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); - break; - } - ZEPHIR_INIT_NVAR(_22$$73); - object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_25$$73); - ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); - ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); - zephir_check_call_status(); - zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - break; - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { - - HashTable *_1$$4; - HashPosition _0$$4; - zend_bool isStatementList = 0; - int ZEPHIR_LAST_CALL_STATUS; - zval *statements, *statement = NULL, **_2$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statements); - - - - if (Z_TYPE_P(statements) != IS_ARRAY) { - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - } - isStatementList = 1; - if (!(zephir_array_isset_string(statements, SS("type")))) { - zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(statement, _2$$4); - if (Z_TYPE_P(statement) != IS_ARRAY) { - isStatementList = 0; - break; - } - } - } - if (isStatementList == 1) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 405, statements); - zephir_check_call_status(); - RETURN_MM(); - } - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { - - HashTable *_2$$4; - HashPosition _1$$4; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_array_isset_string(statement, SS("expr")))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "", 1); - ZEPHIR_INIT_VAR(forElse); - ZVAL_NULL(forElse); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(prefixLevel); - ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); - ZEPHIR_OBS_VAR(expr); - zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(blockStatements); - zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); - ZEPHIR_INIT_NVAR(forElse); - ZVAL_BOOL(forElse, 0); - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); - for ( - ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) - ) { - ZEPHIR_GET_HVALUE(bstatement, _3$$4); - if (Z_TYPE_P(bstatement) != IS_ARRAY) { - break; - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_INIT_LNVAR(_4$$8); - ZEPHIR_CONCAT_SVS(_4$$8, ""); - zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); - ZEPHIR_CPY_WRT(forElse, prefixLevel); - zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); - break; - } - } - } - ZEPHIR_INIT_VAR(_5); - if (extendsMode) { - ZVAL_BOOL(_5, 1); - } else { - ZVAL_BOOL(_5, 0); - } - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 405, blockStatements, _5); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(loopContext); - zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_6$$9); - ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); - zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_10$$9); - ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); - zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); - zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$9); - ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); - zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_13$$9); - ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); - zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_14$$9); - ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); - zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(iterator); - ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); - } else { - ZEPHIR_CPY_WRT(iterator, exprCode); - } - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); - ZEPHIR_OBS_VAR(key); - if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_15$$11); - ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); - zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_16$$12); - ZEPHIR_CONCAT_SVSVS(_16$$12, ""); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); - } - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_19$$15); - ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); - zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_20$$15); - ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); - zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$15); - ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_22$$15); - ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_23$$15); - ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_24$$15); - ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); - zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - ZEPHIR_INIT_VAR(_25$$16); - ZEPHIR_CONCAT_SVS(_25$$16, ""); - zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); - } - zephir_concat_self(&compilation, code TSRMLS_CC); - if (zephir_array_isset_string(statement, SS("if_expr"))) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } else { - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_26$$20); - ZEPHIR_CONCAT_SVS(_26$$20, ""); - zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { - - zval *level = NULL, *prefix = NULL, *_0, *_1$$3; - - - level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(_1$$3, level)) { - ZEPHIR_CONCAT_SVSVS(return_value, ""); - return; - } - ZEPHIR_CONCAT_SVS(return_value, ""); - return; - } - RETURN_STRING("", 1); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { - - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3); - if (extendsMode) { - ZVAL_BOOL(_3, 1); - } else { - ZVAL_BOOL(_3, 0); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 405, _2, _3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVSV(compilation, "", _1); - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_6$$4); - if (extendsMode) { - ZVAL_BOOL(_6$$4, 1); - } else { - ZVAL_BOOL(_6$$4, 0); - } - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 405, blockStatements, _6$$4); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_7$$4); - ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); - zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); - } - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { - - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); - ZEPHIR_OBS_VAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); - zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); - zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_3$$4, 265)) { - zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$5); - ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); - zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$6); - ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); - zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); - } - } else { - ZEPHIR_INIT_VAR(_8$$7); - ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); - zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_9); - ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); - zephir_concat_self(&compilation, _9 TSRMLS_CC); - zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12); - if (extendsMode) { - ZVAL_BOOL(_12, 1); - } else { - ZVAL_BOOL(_12, 0); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 405, _11, _12); - zephir_check_call_status(); - zephir_concat_self(&compilation, _10 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_13$$8, 265)) { - zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); - ZEPHIR_INIT_VAR(_15$$9); - ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); - zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); - ZEPHIR_INIT_VAR(_17$$10); - ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); - zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_18$$8); - ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_19$$11); - ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { - - HashTable *_1; - HashPosition _0; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(assignments); - if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(autoescape); - if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); - return; - } - ZEPHIR_OBS_VAR(oldAutoescape); - zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 405, _0, _1); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 350)) { - zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); - zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_1$$4, 265)) { - zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); - if (ZEPHIR_IS_STRING(_2$$5, "super")) { - RETURN_CCTOR(exprCode); - } - } - } - _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); - if (zephir_is_true(_3)) { - ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - - zephir_fcall_cache_entry *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(pathExpr); - if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); - return; - } - zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 260)) { - if (!(zephir_array_isset_string(statement, SS("params")))) { - ZEPHIR_OBS_VAR(path); - zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_1$$5); - ZVAL_BOOL(_1$$5, 0); - ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(compilation); - zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - } - } - ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 400, pathExpr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(params); - if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { - ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 400, params); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { - - HashTable *_6$$6; - HashPosition _5$$6; - zephir_fcall_cache_entry *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(name); - if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (zephir_array_isset(_0, name)) { - ZEPHIR_INIT_VAR(_1$$4); - object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); - ZEPHIR_INIT_VAR(macroName); - ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); - ZEPHIR_INIT_VAR(code); - ZVAL_STRING(code, ""); - zephir_concat_self(&code, _3$$5 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); - zephir_concat_self(&code, _4$$6 TSRMLS_CC); - zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); - for ( - ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) - ) { - ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); - ZEPHIR_GET_HVALUE(parameter, _7$$6); - ZEPHIR_OBS_NVAR(variableName); - zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_8$$7); - ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); - zephir_concat_self(&code, _8$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_9$$7); - ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); - zephir_concat_self(&code, _9$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_10$$7); - ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); - zephir_concat_self(&code, _10$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_11$$7); - ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); - zephir_concat_self(&code, _11$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_OBS_NVAR(defaultValue); - if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 400, defaultValue); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_14$$8); - ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); - zephir_concat_self(&code, _14$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_LNVAR(_15$$9); - ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); - zephir_concat_self(&code, _15$$9 TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); - } - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_17$$10); - if (extendsMode) { - ZVAL_BOOL(_17$$10, 1); - } else { - ZVAL_BOOL(_17$$10, 0); - } - ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 405, blockStatements, _17$$10); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_18$$10); - ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); - zephir_concat_self(&code, _19 TSRMLS_CC); - RETURN_CCTOR(code); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL; - zval *statement = NULL; - - zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { - - HashTable *_2; - HashPosition _1; - zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode, _0; - zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; - zval *statements = NULL, *_9$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - - statements = statements_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_fast_count_int(statements TSRMLS_CC))) { - RETURN_MM_STRING("", 1); - } - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - _0 = zephir_is_true(extended); - if (!(_0)) { - _0 = extendsMode; - } - ZEPHIR_INIT_VAR(blockMode); - ZVAL_BOOL(blockMode, _0); - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HVALUE(statement, _3); - if (Z_TYPE_P(statement) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); - return; - } - if (!(zephir_array_isset_string(statement, SS("type")))) { - ZEPHIR_INIT_NVAR(_4$$7); - object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_7$$7); - ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); - ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_9$$8); - zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_9$$8, statement); - ZEPHIR_INIT_NVAR(_10$$8); - ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 401, _10$$8, _9$$8); - zephir_check_temp_parameter(_10$$8); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_STRING) { - zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); - continue; - } - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); - do { - if (ZEPHIR_IS_LONG(type, 357)) { - zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); - zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_INIT_NVAR(_14$$11); - if (extendsMode) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); - zephir_check_call_status(); - zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 302)) { - ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 304)) { - ZEPHIR_INIT_NVAR(_19$$13); - if (extendsMode) { - ZVAL_BOOL(_19$$13, 1); - } else { - ZVAL_BOOL(_19$$13, 0); - } - ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); - zephir_check_call_status(); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 359)) { - ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 307)) { - ZEPHIR_OBS_NVAR(blockName); - zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blockStatements); - zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - if (zephir_is_true(blockMode)) { - if (Z_TYPE_P(blocks) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(blocks); - array_init(blocks); - } - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); - ZEPHIR_INIT_NVAR(compilation); - ZVAL_NULL(compilation); - } - zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); - } else { - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_26$$21); - if (extendsMode) { - ZVAL_BOOL(_26$$21, 1); - } else { - ZVAL_BOOL(_26$$21, 0); - } - ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 405, blockStatements, _26$$21); - zephir_check_call_status(); - zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); - } - } - break; - } - if (ZEPHIR_IS_LONG(type, 310)) { - ZEPHIR_OBS_NVAR(path); - zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); - zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(extended); - ZVAL_BOOL(extended, 1); - ZEPHIR_INIT_NVAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(tempCompilation); - zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); - ZEPHIR_CPY_WRT(blockMode, extended); - break; - } - if (ZEPHIR_IS_LONG(type, 313)) { - ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 314)) { - ZEPHIR_INIT_NVAR(_34$$25); - if (extendsMode) { - ZVAL_BOOL(_34$$25, 1); - } else { - ZVAL_BOOL(_34$$25, 0); - } - ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); - zephir_check_call_status(); - zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 316)) { - ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 327)) { - ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 317)) { - ZEPHIR_INIT_NVAR(_41$$28); - if (extendsMode) { - ZVAL_BOOL(_41$$28, 1); - } else { - ZVAL_BOOL(_41$$28, 0); - } - ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); - zephir_check_call_status(); - zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 319)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 320)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); - zephir_check_call_status(); - zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 322)) { - ZEPHIR_INIT_NVAR(_46$$32); - if (extendsMode) { - ZVAL_BOOL(_46$$32, 1); - } else { - ZVAL_BOOL(_46$$32, 0); - } - ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); - zephir_check_call_status(); - zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 325)) { - ZEPHIR_INIT_NVAR(_49$$33); - if (extendsMode) { - ZVAL_BOOL(_49$$33, 1); - } else { - ZVAL_BOOL(_49$$33, 0); - } - ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); - zephir_check_call_status(); - zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 358)) { - break; - } - ZEPHIR_INIT_NVAR(_51$$35); - object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_54$$35); - ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); - ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); - zephir_check_call_status(); - zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - } - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); - if (ZEPHIR_IS_LONG(level, 1)) { - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - - HashTable *_3$$7; - HashPosition _2$$7; - zephir_fcall_cache_entry *_1 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(currentPath); - zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_OBS_VAR(autoescape); - if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { - if (Z_TYPE_P(autoescape) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); - return; - } - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(intermediate); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(intermediate) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); - return; - } - ZEPHIR_INIT_VAR(_0); - if (extendsMode) { - ZVAL_BOOL(_0, 1); - } else { - ZVAL_BOOL(_0, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 405, intermediate, _0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { - ZEPHIR_INIT_VAR(finalCompilation); - if (extendsMode == 1) { - array_init(finalCompilation); - } else { - ZVAL_NULL(finalCompilation); - } - ZEPHIR_OBS_VAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); - for ( - ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) - ) { - ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); - ZEPHIR_GET_HVALUE(block, _4$$7); - if (Z_TYPE_P(name) == IS_STRING) { - if (zephir_array_isset(blocks, name)) { - ZEPHIR_OBS_NVAR(localBlock); - zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, localBlock); - zephir_check_call_status(); - } else { - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, block); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(blockCompilation, block); - } - } - if (extendsMode == 1) { - zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); - } - } else { - if (extendsMode == 1) { - zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); - } else { - zephir_concat_self(&finalCompilation, block TSRMLS_CC); - } - } - } - RETURN_CCTOR(finalCompilation); - } - if (extendsMode == 1) { - RETURN_MM_MEMBER(this_ptr, "_blocks"); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_STRING(_0, "eval code", 1); - zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; - zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { - zephir_get_strval(compiledPath, compiledPath_param); - } else { - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_EMPTY_STRING(compiledPath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (ZEPHIR_IS_EQUAL(path, compiledPath)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); - return; - } - if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_1$$4); - ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(viewCode); - zephir_file_get_contents(viewCode, path TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { - ZEPHIR_INIT_VAR(_2$$5); - object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); - ZEPHIR_INIT_VAR(_4); - if (extendsMode) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_ARRAY) { - ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(finalCompilation, compilation); - } - ZEPHIR_INIT_VAR(_5); - zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); - return; - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - - zval *_2$$23; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (0) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(stat); - ZVAL_BOOL(stat, 1); - ZEPHIR_INIT_VAR(compileAlways); - ZVAL_BOOL(compileAlways, 0); - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_STRING(compiledPath, "", 1); - ZEPHIR_INIT_VAR(prefix); - ZVAL_NULL(prefix); - ZEPHIR_INIT_VAR(compiledSeparator); - ZVAL_STRING(compiledSeparator, "%%", 1); - ZEPHIR_INIT_VAR(compiledExtension); - ZVAL_STRING(compiledExtension, ".php", 1); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (zephir_array_isset_string(options, SS("compileAlways"))) { - ZEPHIR_OBS_NVAR(compileAlways); - zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); - if (Z_TYPE_P(compileAlways) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); - return; - } - } - if (zephir_array_isset_string(options, SS("prefix"))) { - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); - if (Z_TYPE_P(prefix) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledPath"))) { - ZEPHIR_OBS_NVAR(compiledPath); - zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); - if (Z_TYPE_P(compiledPath) != IS_STRING) { - if (Z_TYPE_P(compiledPath) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); - return; - } - } - } - if (zephir_array_isset_string(options, SS("compiledSeparator"))) { - ZEPHIR_OBS_NVAR(compiledSeparator); - zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); - if (Z_TYPE_P(compiledSeparator) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledExtension"))) { - ZEPHIR_OBS_NVAR(compiledExtension); - zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); - if (Z_TYPE_P(compiledExtension) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); - return; - } - } - if (zephir_array_isset_string(options, SS("stat"))) { - ZEPHIR_OBS_NVAR(stat); - zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); - } - } - if (Z_TYPE_P(compiledPath) == IS_STRING) { - if (!(ZEPHIR_IS_EMPTY(compiledPath))) { - ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(templateSepPath); - zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(templateSepPath, templatePath); - } - ZEPHIR_INIT_VAR(compiledTemplatePath); - if (extendsMode == 1) { - ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); - } else { - ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); - } - } else { - if (Z_TYPE_P(compiledPath) == IS_OBJECT) { - if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$23); - zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$23, templatePath); - zephir_array_fast_append(_2$$23, options); - ZEPHIR_INIT_VAR(_3$$23); - ZVAL_BOOL(_3$$23, extendsMode); - zephir_array_fast_append(_2$$23, _3$$23); - ZEPHIR_INIT_NVAR(compiledTemplatePath); - ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); - zephir_check_call_status(); - if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); - return; - } - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); - return; - } - } - } - ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); - if (zephir_is_true(compileAlways)) { - ZEPHIR_INIT_VAR(_4$$26); - if (extendsMode) { - ZVAL_BOOL(_4$$26, 1); - } else { - ZVAL_BOOL(_4$$26, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); - zephir_check_call_status(); - } else { - if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { - if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_VAR(_6$$29); - if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_7$$30); - if (extendsMode) { - ZVAL_BOOL(_7$$30, 1); - } else { - ZVAL_BOOL(_7$$30, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); - zephir_check_call_status(); - } else { - if (extendsMode == 1) { - ZEPHIR_INIT_VAR(blocksCode); - zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { - ZEPHIR_INIT_VAR(_8$$33); - object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_9$$33); - ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); - zephir_check_call_status(); - zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (zephir_is_true(blocksCode)) { - ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(compilation); - array_init(compilation); - } - } - } - } else { - ZEPHIR_INIT_VAR(_10$$36); - if (extendsMode) { - ZVAL_BOOL(_10$$36, 1); - } else { - ZVAL_BOOL(_10$$36, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); - zephir_check_call_status(); - } - } else { - if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_11$$38); - object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_12$$38); - ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); - zephir_check_call_status(); - zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - } - zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_currentPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *viewCode_param = NULL, *currentPath = NULL; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewCode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - - - ZEPHIR_INIT_VAR(currentPath); - ZVAL_STRING(currentPath, "eval code", 1); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &path_param); - - zephir_get_strval(path, path_param); - - - ZEPHIR_OBS_VAR(view); - zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); - if (Z_TYPE_P(view) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { - zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(viewsDir, _2$$4); - ZEPHIR_INIT_LNVAR(_3$$5); - ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); - if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } - } - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } else { - ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); - RETURN_MM(); - } - } - RETURN_CTOR(path); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -%% -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -%% -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval* vv40; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; + } +// 562 "scanner.re" -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ + } -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; + return status; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; +#ifdef HAVE_CONFIG_H #endif -} -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); + return SUCCESS; + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 155 "parser.php5.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); - } - efree((vvpminor->vv0)); +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { + + zval *success_param = NULL, *model = NULL; + zend_bool success; + + zephir_fetch_params(0, 1, 1, &success_param, &model); + + success = zephir_get_boolval(success_param); + if (!model) { + model = ZEPHIR_GLOBAL(global_null); } -} -// 1133 "parser.php5.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 172 "parser.php5.lemon" -{ -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(vvpminor->vv40)); -#endif -} -// 1175 "parser.php5.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; -} + if (success) { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} + + + RETURN_MEMBER(this_ptr, "_model"); -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *model = NULL; + int ZEPHIR_LAST_CALL_STATUS; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 164 "parser.php5.lemon" -{ - status->ret = vvmsp[0].minor.vv40; -} -// 1544 "parser.php5.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 168 "parser.php5.lemon" -{ - vvgotominor.vv40 = vvmsp[0].minor.vv40; -} -// 1572 "parser.php5.c" - break; - case 2: -// 178 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); -} -// 1579 "parser.php5.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 182 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); -} -// 1590 "parser.php5.c" - break; - case 24: -// 278 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1603 "parser.php5.c" - break; - case 25: -// 282 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1616 "parser.php5.c" - break; - case 26: -// 286 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1632 "parser.php5.c" - break; - case 27: -// 290 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1648 "parser.php5.c" - break; - case 28: -// 294 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1664 "parser.php5.c" - break; - case 29: -// 304 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1674 "parser.php5.c" - break; - case 30: -// 314 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1684 "parser.php5.c" - break; - case 31: -// 324 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1698 "parser.php5.c" - break; - case 32: -// 328 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1713 "parser.php5.c" - break; - case 33: -// 332 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1728 "parser.php5.c" - break; - case 34: -// 336 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1744 "parser.php5.c" - break; - case 35: -// 346 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1754 "parser.php5.c" - break; - case 36: - case 48: - case 134: - case 141: -// 356 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); - vv_destructor(2,&vvmsp[-1].minor); -} -// 1765 "parser.php5.c" - break; - case 38: -// 370 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); -} -// 1773 "parser.php5.c" - break; - case 39: -// 374 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); -} -// 1781 "parser.php5.c" - break; - case 40: -// 378 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); -} -// 1789 "parser.php5.c" - break; - case 41: -// 382 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); -} -// 1797 "parser.php5.c" - break; - case 42: -// 386 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); -} -// 1805 "parser.php5.c" - break; - case 43: - case 67: - case 133: - case 145: -// 390 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); -} -// 1815 "parser.php5.c" - break; - case 44: - case 127: -// 394 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); -} -// 1825 "parser.php5.c" - break; - case 45: - case 116: -// 398 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); } -// 1834 "parser.php5.c" - break; - case 46: -// 408 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { + + + + RETURN_MEMBER(this_ptr, "_success"); + } -// 1849 "parser.php5.c" - break; - case 47: -// 412 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); + + return SUCCESS; + } -// 1864 "parser.php5.c" - break; - case 50: -// 436 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); + return SUCCESS; + } -// 1871 "parser.php5.c" - break; - case 51: -// 440 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnTypes, *result = NULL, *cache = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); + + if (!result) { + result = ZEPHIR_GLOBAL(global_null); + } + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1879 "parser.php5.c" - break; - case 52: - case 66: - case 132: - case 146: -// 444 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { + + zend_class_entry *_13$$15; + HashTable *_3, *_6$$11; + HashPosition _2, _5$$11; + zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; + zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; + int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); + RETURN_CCTOR(row); + } + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_INIT_NVAR(activeRow); + object_init_ex(activeRow, phalcon_mvc_model_row_ce); + if (zephir_has_constructor(activeRow TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); + zephir_check_call_status(); + } + break; + } + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + ZEPHIR_INIT_NVAR(activeRow); + array_init(activeRow); + break; + } + ZEPHIR_INIT_NVAR(activeRow); + object_init(activeRow); + break; + } while(0); + + dirtyState = 0; + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); + zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HMKEY(alias, _3, _2); + ZEPHIR_GET_HVALUE(column, _4); + if (Z_TYPE_P(column) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); + return; + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); + if (ZEPHIR_IS_STRING(type, "object")) { + ZEPHIR_OBS_NVAR(source); + zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); + ZEPHIR_OBS_NVAR(attributes); + zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); + ZEPHIR_OBS_NVAR(columnMap); + zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); + ZEPHIR_INIT_NVAR(rowModel); + array_init(rowModel); + zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); + for ( + ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) + ) { + ZEPHIR_GET_HVALUE(attribute, _7$$11); + ZEPHIR_OBS_NVAR(columnValue); + ZEPHIR_INIT_LNVAR(_8$$12); + ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); + zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); + zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); + } + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_OBS_NVAR(keepSnapshots); + if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(keepSnapshots); + ZVAL_BOOL(keepSnapshots, 0); + } + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_NVAR(_9$$15); + zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); + if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { + zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); + ZEPHIR_INIT_NVAR(modelName); + zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_12$$15); + ZVAL_LONG(_12$$15, dirtyState); + _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); + zephir_check_call_status(); + } else { + zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_16$$18); + ZVAL_LONG(_16$$18, dirtyState); + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + ZEPHIR_OBS_NVAR(attribute); + zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(sqlAlias); + if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { + ZEPHIR_OBS_NVAR(value); + zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(value); + zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); + } + if (zephir_array_isset_string(column, SS("balias"))) { + ZEPHIR_CPY_WRT(attribute, alias); + } else { + ZEPHIR_SINIT_NVAR(_18$$24); + ZVAL_STRING(&_18$$24, "_", 0); + ZEPHIR_SINIT_NVAR(_19$$24); + ZVAL_STRING(&_19$$24, "", 0); + ZEPHIR_INIT_NVAR(attribute); + zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); + } + } + if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { + do { + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); + break; + } + zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); + break; + } while(0); + + } + } + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1889 "parser.php5.c" - break; - case 53: - case 147: -// 448 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { + + zval *records = NULL, *current = NULL, *_0 = NULL; + zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(records); + array_init(records); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0))) { + break; + } + ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 338); + zephir_check_call_status(); + zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); + zephir_check_call_status(); + } + RETURN_CCTOR(records); + } -// 1897 "parser.php5.c" - break; - case 54: - case 148: -// 452 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { + + zval *_0; + zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(cache); + zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnTypes); + zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 4, 0 TSRMLS_CC); + zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_CCTOR(serialized); + } -// 1905 "parser.php5.c" - break; - case 55: - case 149: -// 456 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + if (1) { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_2); + ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); + zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1914 "parser.php5.c" - break; - case 56: - case 150: -// 460 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 1923 "parser.php5.c" - break; - case 57: - case 151: -// 464 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); + + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + if (!keepSnapshots) { + keepSnapshots = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1932 "parser.php5.c" - break; - case 58: -// 474 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { + + zend_class_entry *_5$$6; + zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_VAR(_0$$6); + zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); + if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { + _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(modelName); + zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_4$$6); + ZVAL_LONG(_4$$6, 0); + _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); + zephir_check_call_status(); + } else { + _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_9$$9); + ZVAL_LONG(_9$$9, 0); + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 339, _7$$9, row, columnMap, _9$$9, _8$$9); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 340, row, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1947 "parser.php5.c" - break; - case 59: -// 478 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { + + HashTable *_2$$7, *_5$$8; + HashPosition _1$$7, _4$$8; + zephir_fcall_cache_entry *_9 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; + zend_bool renameColumns; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &renameColumns_param); + + if (!renameColumns_param) { + renameColumns = 1; + } else { + renameColumns = zephir_get_boolval(renameColumns_param); + } + + + ZEPHIR_OBS_VAR(records); + zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); + if (Z_TYPE_P(records) != IS_ARRAY) { + ZEPHIR_OBS_VAR(result); + zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(_0$$3) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); + } + if (renameColumns) { + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + RETURN_CCTOR(records); + } + ZEPHIR_INIT_VAR(renamedRecords); + array_init(renamedRecords); + if (Z_TYPE_P(records) == IS_ARRAY) { + zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); + for ( + ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) + ) { + ZEPHIR_GET_HVALUE(record, _3$$7); + ZEPHIR_INIT_NVAR(renamed); + array_init(renamed); + zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); + for ( + ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS + ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) + ) { + ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); + ZEPHIR_GET_HVALUE(value, _6$$8); + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(renamedKey) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_10$$12); + object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_11$$12); + ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); + } + zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); + } + } + RETURN_CCTOR(renamedRecords); + } + RETURN_CCTOR(records); + } -// 1962 "parser.php5.c" - break; - case 60: -// 488 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { + + zval *_1 = NULL, *_2 = NULL, *_3; + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 6, 0 TSRMLS_CC); + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 0); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); + zephir_check_call_status(); + zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1971 "parser.php5.c" - break; - case 61: -// 498 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); + zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_3); + ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); + zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); + zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1980 "parser.php5.c" - break; - case 62: -// 508 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1993 "parser.php5.c" - break; - case 63: -// 512 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2006 "parser.php5.c" - break; - case 64: -// 522 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *message_param = NULL, *record = NULL; + zval *message = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &record); + + if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(message, message_param); + } else { + ZEPHIR_INIT_VAR(message); + ZVAL_EMPTY_STRING(message); + } + if (!record) { + record = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2019 "parser.php5.c" - break; - case 65: -// 526 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { + + zval *record = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(record); + zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); + if (Z_TYPE_P(record) != IS_NULL) { + ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2032 "parser.php5.c" - break; - case 68: -// 550 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { + + + + RETURN_MEMBER(this_ptr, "_record"); + } -// 2045 "parser.php5.c" - break; - case 69: -// 560 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2055 "parser.php5.c" - break; - case 70: -// 570 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *dependencyInjector = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &dependencyInjector); + + if (!dependencyInjector) { + ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(dependencyInjector); + } + + + if (!(zephir_is_true(dependencyInjector))) { + ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); + return; + } + ZEPHIR_MM_RESTORE(); + } -// 2065 "parser.php5.c" - break; - case 71: -// 574 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2076 "parser.php5.c" - break; - case 72: -// 584 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2086 "parser.php5.c" - break; - case 73: -// 594 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { + + zval *service_param = NULL; + zval *service = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &service_param); + + if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(service_param) == IS_STRING)) { + zephir_get_strval(service, service_param); + } else { + ZEPHIR_INIT_VAR(service); + ZVAL_EMPTY_STRING(service); + } + + + zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); + RETURN_THIS(); + } -// 2096 "parser.php5.c" - break; - case 74: -// 604 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { + + + + RETURN_MEMBER(this_ptr, "_service"); + } -// 2110 "parser.php5.c" - break; - case 75: -// 608 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { + + zval *rollbackPendent_param = NULL; + zend_bool rollbackPendent; + + zephir_fetch_params(0, 1, 0, &rollbackPendent_param); + + rollbackPendent = zephir_get_boolval(rollbackPendent_param); + + + if (rollbackPendent) { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_THISW(); + } -// 2124 "parser.php5.c" - break; - case 76: -// 618 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { + + + + RETURN_MEMBER(this_ptr, "_rollbackPendent"); + } -// 2134 "parser.php5.c" - break; - case 77: -// 628 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { + + zval *_0; + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); + } -// 2144 "parser.php5.c" - break; - case 78: -// 638 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { + + zval *_2$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); + if (zephir_is_true(_1$$3)) { + ZEPHIR_INIT_VAR(_2$$4); + zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$4, this_ptr); + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "rollbackPendent", 1); + zephir_array_fast_append(_2$$4, _3$$4); + ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 343, _2$$4); + zephir_check_call_status(); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(_4); + if (autoBegin) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); + zephir_check_call_status(); + RETURN_MM(); + } -// 2151 "parser.php5.c" - break; - case 79: -// 648 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { + + HashTable *_2$$5; + HashPosition _1$$5; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(transaction, _3$$5); + if (Z_TYPE_P(transaction) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_BOOL(_4$$7, 0); + ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); + zephir_check_call_status(); + RETURN_CCTOR(transaction); + } + } + } + } + ZEPHIR_INIT_NVAR(transaction); + object_init_ex(transaction, phalcon_mvc_model_transaction_ce); + _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_6); + if (autoBegin) { + ZVAL_BOOL(_6, 1); + } else { + ZVAL_BOOL(_6, 0); + } + ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 344, dependencyInjector, _6, _5); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 345, this_ptr); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); + RETURN_CCTOR(transaction); + } -// 2159 "parser.php5.c" - break; - case 80: -// 652 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { + + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2167 "parser.php5.c" - break; - case 81: -// 656 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2175 "parser.php5.c" - break; - case 82: -// 660 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { + + HashTable *_1$$3; + HashPosition _0$$3; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &collect); + + if (!collect) { + collect = ZEPHIR_GLOBAL(global_true); + } + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); + zephir_check_call_status(); + } + if (zephir_is_true(collect)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2183 "parser.php5.c" - break; - case 83: -// 664 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2191 "parser.php5.c" - break; - case 84: -// 668 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2200 "parser.php5.c" - break; - case 85: -// 672 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(newTransactions); + array_init(newTransactions); + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); + if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { + zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); + } else { + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + } + zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2208 "parser.php5.c" - break; - case 86: -// 676 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { + + HashTable *_2$$3; + HashPosition _1$$3; + zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_0$$3); + zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); + for ( + ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) + ) { + ZEPHIR_GET_HVALUE(_0$$3, _3$$3); + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2217 "parser.php5.c" - break; - case 87: -// 680 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); + + return SUCCESS; + } -// 2225 "parser.php5.c" - break; - case 88: -// 684 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); + + return SUCCESS; + } -// 2233 "parser.php5.c" - break; - case 89: -// 688 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 274); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2241 "parser.php5.c" - break; - case 90: -// 692 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); + + return SUCCESS; + } -// 2249 "parser.php5.c" - break; - case 91: -// 696 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { + + zval *_5$$7; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if (zephir_fast_in_array(value, domain TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4$$7); + ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_4$$7); + zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2257 "parser.php5.c" - break; - case 92: -// 700 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); + + return SUCCESS; + } -// 2265 "parser.php5.c" - break; - case 93: -// 704 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { + + zval *_8$$9; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(strict); + ZVAL_BOOL(strict, 0); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_4)) { + if (Z_TYPE_P(strict) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); + return; + } + ZEPHIR_INIT_VAR(_5$$7); + ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); + zephir_check_temp_parameter(_5$$7); + zephir_check_call_status(); + } + ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 346, value, domain, strict); + zephir_check_call_status(); + if (!(zephir_is_true(_6))) { + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_8$$9); + zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_7$$9); + zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_7$$9); + ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2273 "parser.php5.c" - break; - case 94: -// 708 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); + + return SUCCESS; + } -// 2282 "parser.php5.c" - break; - case 95: -// 712 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { + + zval *_6, *_12$$5; + zend_bool _5; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, (1048576 | 2097152)); + ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_2)) { + ZEPHIR_INIT_VAR(allowPrivate); + ZVAL_LONG(allowPrivate, 0); + } else { + ZEPHIR_INIT_NVAR(allowPrivate); + ZVAL_LONG(allowPrivate, 8388608); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_3)) { + ZEPHIR_INIT_VAR(allowReserved); + ZVAL_LONG(allowReserved, 0); + } else { + ZEPHIR_INIT_NVAR(allowReserved); + ZVAL_LONG(allowReserved, 4194304); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_NVAR(_1); + ZVAL_BOOL(_1, 0); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _5 = zephir_is_true(_4); + if (_5) { + _5 = ZEPHIR_IS_EMPTY(value); + } + if (_5) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(options); + zephir_create_array(options, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_6); + zephir_create_array(_6, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_VAR(_7); + zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); + ZEPHIR_INIT_VAR(_8); + zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); + zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_NVAR(_7); + ZVAL_LONG(&_7, 275); + ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); + zephir_check_call_status(); + if (!(zephir_is_true(_9))) { + ZEPHIR_INIT_VAR(_10$$5); + ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_11$$5); + ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_temp_parameter(_11$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_12$$5); + zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2291 "parser.php5.c" - break; - case 96: -// 716 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); + + return SUCCESS; + +} + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { + + zval *_4$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + if (!(zephir_is_numeric(value))) { + ZEPHIR_INIT_VAR(_3$$5); + ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field :field must be numeric", 1); + } + ZEPHIR_INIT_VAR(_4$$5); + zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$5); + ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2300 "parser.php5.c" - break; - case 97: -// 720 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); + + return SUCCESS; + } -// 2309 "parser.php5.c" - break; - case 98: -// 724 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { + + zval *_4$$4; + zend_bool _1, _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + _1 = Z_TYPE_P(value) == IS_NULL; + if (!(_1)) { + _2 = Z_TYPE_P(value) == IS_STRING; + if (_2) { + _2 = !(zephir_fast_strlen_ev(value)); + } + _1 = _2; + } + if (_1) { + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "':field' is required", 1); + } + ZEPHIR_INIT_VAR(_4$$4); + zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$4); + ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2318 "parser.php5.c" - break; - case 99: -// 728 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); + + return SUCCESS; + } -// 2327 "parser.php5.c" - break; - case 100: -// 732 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { + + zval *_6$$8; + zend_bool failed = 0, _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (!(zephir_is_true(_1))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + failed = 0; + ZEPHIR_INIT_VAR(matches); + ZVAL_NULL(matches); + ZEPHIR_INIT_NVAR(_0); + zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); + if (zephir_is_true(_0)) { + zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); + failed = !ZEPHIR_IS_EQUAL(_4$$6, value); + } else { + failed = 1; + } + if (failed == 1) { + ZEPHIR_INIT_VAR(_5$$8); + ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); + } + ZEPHIR_INIT_VAR(_6$$8); + zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$8); + ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2336 "parser.php5.c" - break; - case 101: -// 736 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); + + return SUCCESS; + } -// 2345 "parser.php5.c" - break; - case 102: -// 740 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { + + zval *_6$$9, *_11$$12; + zend_bool _1, _3; + zephir_fcall_cache_entry *_8 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _1 = !zephir_is_true(isSetMin); + if (_1) { + _1 = !zephir_is_true(isSetMax); + } + if (_1) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 347, value); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(length); + ZVAL_LONG(length, zephir_fast_strlen_ev(value)); + } + if (zephir_is_true(isSetMax)) { + ZEPHIR_INIT_VAR(_4$$8); + ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); + zephir_check_temp_parameter(_4$$8); + zephir_check_call_status(); + if (ZEPHIR_GT(length, maximum)) { + ZEPHIR_INIT_VAR(_5$$9); + ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); + } + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$9); + ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + if (zephir_is_true(isSetMin)) { + ZEPHIR_INIT_VAR(_9$$11); + ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); + zephir_check_temp_parameter(_9$$11); + zephir_check_call_status(); + if (ZEPHIR_LT(length, minimum)) { + ZEPHIR_INIT_VAR(_10$$12); + ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); + } + ZEPHIR_INIT_VAR(_11$$12); + zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$12); + ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + RETURN_MM_BOOL(1); + } -// 2354 "parser.php5.c" - break; - case 103: -// 744 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); + + return SUCCESS; + } -// 2363 "parser.php5.c" - break; - case 104: -// 748 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { + + HashTable *_2$$5, *_22$$16; + HashPosition _1$$5, _21$$16; + zend_class_entry *_33; + zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; + int ZEPHIR_LAST_CALL_STATUS, number = 0; + zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(bindTypes); + array_init(bindTypes); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_INIT_VAR(conditions); + array_init(conditions); + ZEPHIR_INIT_VAR(bindParams); + array_init(bindParams); + number = 0; + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(composeField, _3$$5); + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_4$$8); + object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_5$$8); + ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, composeField); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_SINIT_NVAR(_9$$6); + ZVAL_LONG(&_9$$6, number); + ZEPHIR_INIT_LNVAR(_10$$6); + ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); + zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); + ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); + number++; + } + } else { + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_13$$13); + object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_14$$13); + ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, field); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_15$$15); + object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_16$$15); + ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(_17$$11); + ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); + zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); + ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); + number++; + } + ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(_19, 2)) { + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); + zephir_check_call_status(); + zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) + ) { + ZEPHIR_GET_HVALUE(primaryField, _23$$16); + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_24$$20); + object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_25$$20); + ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); + zephir_check_call_status(); + zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(attributeField); + if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_26$$22); + object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_27$$22); + ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); + zephir_check_call_status(); + zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(attributeField, primaryField); + } + ZEPHIR_SINIT_NVAR(_28$$19); + ZVAL_LONG(&_28$$19, number); + ZEPHIR_INIT_LNVAR(_29$$19); + ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); + zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); + ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); + number++; + } + } + ZEPHIR_INIT_VAR(params); + array_init(params); + zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_0); + zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); + zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(className); + zephir_get_class(className, record, 0 TSRMLS_CC); + _33 = zephir_fetch_class(className TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); + zephir_check_call_status(); + if (!ZEPHIR_IS_LONG(_32, 0)) { + ZEPHIR_INIT_VAR(_34$$24); + ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(replacePairs); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_35$$25); + zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); + } + } else { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); + } + } + ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_34$$24); + ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2372 "parser.php5.c" - break; - case 105: -// 752 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); + + return SUCCESS; + } -// 2381 "parser.php5.c" - break; - case 106: -// 756 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 273); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, ":field does not have a valid url format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2390 "parser.php5.c" - break; - case 107: -// 760 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; + return SUCCESS; + } -// 2399 "parser.php5.c" - break; - case 108: -// 764 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { + + zval *_0; + zval *handler_param = NULL, *prefix_param = NULL; + zval *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2407 "parser.php5.c" - break; - case 109: -// 768 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { + + zval *_0; + zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; + zval *module = NULL, *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_array_fast_append(_0, module); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2415 "parser.php5.c" - break; - case 110: -// 772 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { + + zend_bool _5$$6; + HashTable *_3, *_9$$14, *_13$$16, *_17$$18; + HashPosition _2, _8$$14, _12$$16, _16$$18; + zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; + zval *uri = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &uri_param); + + if (!uri_param) { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } else { + if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(uri, uri_param); + } else { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } + } + + + if (!(!(!uri) && Z_STRLEN_P(uri))) { + ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(realUri, uri); + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); + return; + } + ZEPHIR_INIT_VAR(_1); + ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); + zephir_check_temp_parameter(_1); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(handlers); + zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(controllerSuffix); + zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); + zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HVALUE(scope, _4); + if (Z_TYPE_P(scope) != IS_ARRAY) { + continue; + } + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); + _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); + if (_5$$6) { + _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); + } + if (_5$$6) { + continue; + } + ZEPHIR_OBS_NVAR(handler); + zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); + if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { + ZEPHIR_INIT_NVAR(controllerName); + zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(namespaceName); + zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(controllerName, handler); + ZEPHIR_OBS_NVAR(namespaceName); + zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); + } + zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(sufixed); + ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); + if (Z_TYPE_P(namespaceName) != IS_NULL) { + ZEPHIR_INIT_LNVAR(_6$$11); + ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); + ZEPHIR_CPY_WRT(sufixed, _6$$11); + } + ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); + zephir_check_call_status(); + if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(annotations) == IS_ARRAY) { + zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); + for ( + ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) + ) { + ZEPHIR_GET_HVALUE(annotation, _10$$14); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); + zephir_check_call_status(); + } + } + } + ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(lowerControllerName); + zephir_uncamelize(lowerControllerName, controllerName, NULL ); + zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); + for ( + ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) + ) { + ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); + ZEPHIR_GET_HVALUE(collection, _14$$16); + if (Z_TYPE_P(collection) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS + ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) + ) { + ZEPHIR_GET_HVALUE(annotation, _18$$18); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); + zephir_check_call_status(); + } + } + } + } + } + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 348, realUri); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2423 "parser.php5.c" - break; - case 111: -// 776 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; + zval *handler = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &handler_param, &annotation); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + + + ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { + ZEPHIR_INIT_VAR(_2$$3); + ZVAL_LONG(_2$$3, 0); + ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2431 "parser.php5.c" - break; - case 112: -// 780 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { + + HashTable *_7$$22, *_11$$24; + HashPosition _6$$22, _10$$24; + zend_bool isRoute = 0, _14$$9, _5$$20; + zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; + zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { + zephir_get_strval(namespaceName, namespaceName_param); + } else { + ZEPHIR_INIT_VAR(namespaceName); + ZVAL_EMPTY_STRING(namespaceName); + } + if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { + zephir_get_strval(controller, controller_param); + } else { + ZEPHIR_INIT_VAR(controller); + ZVAL_EMPTY_STRING(controller); + } + if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(action_param) == IS_STRING)) { + zephir_get_strval(action, action_param); + } else { + ZEPHIR_INIT_VAR(action); + ZVAL_EMPTY_STRING(action); + } + + + isRoute = 0; + ZEPHIR_INIT_VAR(methods); + ZVAL_NULL(methods); + ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); + zephir_check_call_status(); + do { + if (ZEPHIR_IS_STRING(name, "Route")) { + isRoute = 1; + break; + } + if (ZEPHIR_IS_STRING(name, "Get")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "GET", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Post")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "POST", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Put")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "PUT", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Delete")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "DELETE", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Options")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "OPTIONS", 1); + break; + } + } while(0); + + if (isRoute == 1) { + ZEPHIR_INIT_VAR(_0$$9); + _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); + ZEPHIR_SINIT_VAR(_2$$9); + ZVAL_STRING(&_2$$9, "", 0); + zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); + ZEPHIR_INIT_VAR(actionName); + zephir_fast_strtolower(actionName, _0$$9); + ZEPHIR_OBS_VAR(routePrefix); + zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_3$$9); + ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(paths) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(paths); + array_init(paths); + } + if (!(ZEPHIR_IS_EMPTY(module))) { + zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); + } + if (!(ZEPHIR_IS_EMPTY(namespaceName))) { + zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_LONG(_3$$9, 0); + ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(value) != IS_NULL) { + if (!ZEPHIR_IS_STRING(value, "/")) { + ZEPHIR_INIT_VAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, value); + } else { + if (Z_TYPE_P(routePrefix) != IS_NULL) { + ZEPHIR_CPY_WRT(uri, routePrefix); + } else { + ZEPHIR_CPY_WRT(uri, value); + } + } + } else { + ZEPHIR_INIT_NVAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); + } + ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); + zephir_check_call_status(); + if (Z_TYPE_P(methods) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(_4$$20); + ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); + zephir_check_temp_parameter(_4$$20); + zephir_check_call_status(); + _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; + if (!(_5$$20)) { + _5$$20 = Z_TYPE_P(methods) == IS_STRING; + } + if (_5$$20) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); + for ( + ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS + ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) + ) { + ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); + ZEPHIR_GET_HVALUE(convert, _8$$22); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); + for ( + ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS + ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) + ) { + ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); + ZEPHIR_GET_HVALUE(convert, _12$$24); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; + if (!(_14$$9)) { + _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; + } + if (_14$$9) { + ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(routeName) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); + zephir_check_call_status(); + } + RETURN_MM_BOOL(1); + } + ZEPHIR_MM_RESTORE(); + } -// 2439 "parser.php5.c" - break; - case 113: -// 784 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { + + zval *controllerSuffix_param = NULL; + zval *controllerSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &controllerSuffix_param); + + if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { + zephir_get_strval(controllerSuffix, controllerSuffix_param); + } else { + ZEPHIR_INIT_VAR(controllerSuffix); + ZVAL_EMPTY_STRING(controllerSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2447 "parser.php5.c" - break; - case 114: -// 788 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { + + zval *actionSuffix_param = NULL; + zval *actionSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &actionSuffix_param); + + if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { + zephir_get_strval(actionSuffix, actionSuffix_param); + } else { + ZEPHIR_INIT_VAR(actionSuffix); + ZVAL_EMPTY_STRING(actionSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2455 "parser.php5.c" - break; - case 115: -// 792 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { + + + + RETURN_MEMBER(this_ptr, "_handlers"); + } -// 2463 "parser.php5.c" - break; - case 117: -// 800 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { + + zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; + + ZEPHIR_MM_GROW(); + + { + zval *this_ptr = NULL; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); + if (Z_TYPE_P(_0) == IS_NULL) { + ZEPHIR_INIT_VAR(_1$$3); + array_init(_1$$3); + zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); + } + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); + if (Z_TYPE_P(_2) == IS_NULL) { + ZEPHIR_INIT_VAR(_3$$4); + array_init(_3$$4); + zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); + } + _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); + if (Z_TYPE_P(_4) == IS_NULL) { + ZEPHIR_INIT_VAR(_5$$5); + array_init(_5$$5); + zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJVAL_P(this_ptr); + } + } -// 2471 "parser.php5.c" - break; - case 118: -// 804 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2480 "parser.php5.c" - break; - case 119: -// 808 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); + return SUCCESS; + } -// 2488 "parser.php5.c" - break; - case 120: -// 812 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *paths = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + _0 = Z_TYPE_P(paths) == IS_ARRAY; + if (!(_0)) { + _0 = Z_TYPE_P(paths) == IS_STRING; + } + if (_0) { + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + } + if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2496 "parser.php5.c" - break; - case 121: -// 816 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + zephir_get_strval(hostname, hostname_param); + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 2504 "parser.php5.c" - break; - case 122: -// 820 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 2513 "parser.php5.c" - break; - case 123: -// 824 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + zephir_get_strval(prefix, prefix_param); + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2522 "parser.php5.c" - break; - case 124: -// 828 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { + + + + RETURN_MEMBER(this_ptr, "_prefix"); + } -// 2531 "parser.php5.c" - break; - case 125: -// 832 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { + + zval *beforeMatch; + + zephir_fetch_params(0, 1, 0, &beforeMatch); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); + RETURN_THISW(); + } -// 2540 "parser.php5.c" - break; - case 126: -// 836 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 2549 "parser.php5.c" - break; - case 128: -// 844 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { + + zval *paths; + + zephir_fetch_params(0, 1, 0, &paths); + + + + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + RETURN_THISW(); + } -// 2558 "parser.php5.c" - break; - case 129: -// 848 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 2568 "parser.php5.c" - break; - case 130: -// 852 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { + + + + RETURN_MEMBER(this_ptr, "_routes"); + } -// 2578 "parser.php5.c" - break; - case 131: -// 856 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); + zephir_check_call_status(); + RETURN_MM(); + } -// 2588 "parser.php5.c" - break; - case 136: - case 144: -// 894 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2597 "parser.php5.c" - break; - case 137: - case 143: -// 898 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2605 "parser.php5.c" - break; - case 139: -// 912 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2614 "parser.php5.c" - break; - case 140: -// 916 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2623 "parser.php5.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php5.lemon" +static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - { + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + zval *_0; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + ZEPHIR_INIT_VAR(_0); + array_init(_0); + zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); - } +} - } else { +static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; + zval *pattern = NULL; - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } - } - } + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } - smart_str_0(&error_str); -#if PHP_VERSION_ID < 70000 - if (error_str.len) { - status->syntax_error = error_str.c; - status->syntax_error_len = error_str.len; + ZEPHIR_OBS_VAR(defaultPaths); + zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); + if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); + zephir_check_call_status(); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(processedPaths, paths); } -#else - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); + if (Z_TYPE_P(processedPaths) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedPaths); + zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); } -#endif + } else { + ZEPHIR_CPY_WRT(mergedPaths, paths); } + ZEPHIR_INIT_VAR(route); + object_init_ex(route, phalcon_mvc_router_route_ce); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_2); + ZEPHIR_CONCAT_VV(_2, _1, pattern); + ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); + ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 349, this_ptr); + zephir_check_call_status(); + RETURN_CCTOR(route); - status->status = PHVOLT_PARSING_FAILED; - -// 2774 "parser.php5.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } +#ifdef HAVE_CONFIG_H #endif - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); + + return SUCCESS; + } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php7.lemon" +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval vv146; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; -} -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; + + +#ifdef HAVE_CONFIG_H #endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); + return SUCCESS; + } -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; +static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + ZEPHIR_OBS_VAR(uniqueId); + zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); + if (Z_TYPE_P(uniqueId) == IS_NULL) { + ZEPHIR_INIT_NVAR(uniqueId); + ZVAL_LONG(uniqueId, 0); + } + ZEPHIR_CPY_WRT(routeId, uniqueId); + zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 146 "parser.php7.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); +static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { + + zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { + ZEPHIR_INIT_VAR(idPattern); + ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); + if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { + ZEPHIR_INIT_VAR(_0$$4); + ZEPHIR_SINIT_VAR(_1$$4); + ZVAL_STRING(&_1$$4, "/:module", 0); + zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _0$$4); + } + if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { + ZEPHIR_INIT_VAR(_2$$5); + ZEPHIR_SINIT_VAR(_3$$5); + ZVAL_STRING(&_3$$5, "/:controller", 0); + zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _2$$5); + } + if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_SINIT_VAR(_5$$6); + ZVAL_STRING(&_5$$6, "/:namespace", 0); + zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _4$$6); + } + if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_SINIT_VAR(_7$$7); + ZVAL_STRING(&_7$$7, "/:action", 0); + zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _6$$7); + } + if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { + ZEPHIR_INIT_VAR(_8$$8); + ZEPHIR_SINIT_VAR(_9$$8); + ZVAL_STRING(&_9$$8, "/:params", 0); + ZEPHIR_SINIT_VAR(_10$$8); + ZVAL_STRING(&_10$$8, "(/.*)*", 0); + zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); + zephir_get_strval(pattern, _8$$8); + } + if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_SINIT_VAR(_12$$9); + ZVAL_STRING(&_12$$9, "/:int", 0); + ZEPHIR_SINIT_VAR(_13$$9); + ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); + zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); + zephir_get_strval(pattern, _11$$9); } - efree((vvpminor->vv0)); } -} -// 1133 "parser.php7.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 163 "parser.php7.lemon" -{ - zval_ptr_dtor(&(vvpminor->vv146)); -} -// 1173 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } + if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + RETURN_CTOR(pattern); + } -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; +static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; } -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); +static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { + + long _0, _5$$11, _26$$19; + zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; + int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; + char ch = 0, prevCh; + zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; + zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + prevCh = '\0'; + bracketCount = 0; + parenthesesCount = 0; + foundPattern = 0; + intermediate = 0; + numberMatches = 0; + if (zephir_fast_strlen_ev(pattern) <= 0) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(matches); + array_init(matches); + ZEPHIR_INIT_VAR(route); + ZVAL_EMPTY_STRING(route); + for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { + cursor = _0; + ch = ZEPHIR_STRING_OFFSET(pattern, _0); + if (parenthesesCount == 0) { + if (ch == '{') { + if (bracketCount == 0) { + marker = (cursor + 1); + intermediate = 0; + notValid = 0; + } + bracketCount++; + } else { + if (ch == '}') { + bracketCount--; + if (intermediate > 0) { + if (bracketCount == 0) { + numberMatches++; + ZEPHIR_INIT_NVAR(variable); + ZVAL_EMPTY_STRING(variable); + ZEPHIR_INIT_NVAR(regexp); + ZVAL_EMPTY_STRING(regexp); + ZEPHIR_SINIT_NVAR(_1$$11); + ZVAL_LONG(&_1$$11, marker); + ZEPHIR_SINIT_NVAR(_2$$11); + ZVAL_LONG(&_2$$11, (cursor - marker)); + ZEPHIR_INIT_NVAR(_3$$11); + zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); + zephir_get_strval(_4$$11, _3$$11); + ZEPHIR_CPY_WRT(item, _4$$11); + for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { + cursorVar = _5$$11; + ch = ZEPHIR_STRING_OFFSET(item, _5$$11); + if (ch == '\0') { + break; + } + _6$$12 = cursorVar == 0; + if (_6$$12) { + _7$$12 = ch >= 'a'; + if (_7$$12) { + _7$$12 = ch <= 'z'; + } + _8$$12 = _7$$12; + if (!(_8$$12)) { + _9$$12 = ch >= 'A'; + if (_9$$12) { + _9$$12 = ch <= 'Z'; + } + _8$$12 = _9$$12; + } + _6$$12 = !(_8$$12); + } + if (_6$$12) { + notValid = 1; + break; + } + _10$$12 = ch >= 'a'; + if (_10$$12) { + _10$$12 = ch <= 'z'; + } + _11$$12 = _10$$12; + if (!(_11$$12)) { + _12$$12 = ch >= 'A'; + if (_12$$12) { + _12$$12 = ch <= 'Z'; + } + _11$$12 = _12$$12; + } + _13$$12 = _11$$12; + if (!(_13$$12)) { + _14$$12 = ch >= '0'; + if (_14$$12) { + _14$$12 = ch <= '9'; + } + _13$$12 = _14$$12; + } + _15$$12 = _13$$12; + if (!(_15$$12)) { + _15$$12 = ch == '-'; + } + _16$$12 = _15$$12; + if (!(_16$$12)) { + _16$$12 = ch == '_'; + } + _17$$12 = _16$$12; + if (!(_17$$12)) { + _17$$12 = ch == ':'; + } + if (_17$$12) { + if (ch == ':') { + ZEPHIR_SINIT_NVAR(_18$$16); + ZVAL_LONG(&_18$$16, 0); + ZEPHIR_SINIT_NVAR(_19$$16); + ZVAL_LONG(&_19$$16, cursorVar); + ZEPHIR_INIT_NVAR(_20$$16); + zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); + zephir_get_strval(_21$$16, _20$$16); + ZEPHIR_CPY_WRT(variable, _21$$16); + ZEPHIR_SINIT_NVAR(_22$$16); + ZVAL_LONG(&_22$$16, (cursorVar + 1)); + ZEPHIR_INIT_NVAR(_23$$16); + zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_get_strval(_24$$16, _23$$16); + ZEPHIR_CPY_WRT(regexp, _24$$16); + break; + } + } else { + notValid = 1; + break; + } + } + if (!(notValid)) { + tmp = numberMatches; + _25$$18 = zephir_is_true(variable); + if (_25$$18) { + _25$$18 = zephir_is_true(regexp); + } + if (_25$$18) { + foundPattern = 0; + for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { + ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); + if (ch == '\0') { + break; + } + if (!(foundPattern)) { + if (ch == '(') { + foundPattern = 1; + } + } else { + if (ch == ')') { + foundPattern = 2; + break; + } + } + } + if (foundPattern != 2) { + ZEPHIR_INIT_LNVAR(_27$$26); + ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); + zephir_concat_self(&route, _27$$26 TSRMLS_CC); + } else { + zephir_concat_self(&route, regexp TSRMLS_CC); + } + ZEPHIR_INIT_NVAR(_28$$19); + ZVAL_LONG(_28$$19, tmp); + zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_29$$28); + ZVAL_LONG(_29$$28, tmp); + zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_INIT_LNVAR(_30$$29); + ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); + zephir_concat_self(&route, _30$$29 TSRMLS_CC); + } + continue; + } + } + } + } + } + if (bracketCount == 0) { + if (ch == '(') { + parenthesesCount++; + } else { + if (ch == ')') { + parenthesesCount--; + if (parenthesesCount == 0) { + numberMatches++; + } + } + } + } + if (bracketCount > 0) { + intermediate++; + } else { + _31$$36 = parenthesesCount == 0; + if (_31$$36) { + _31$$36 = prevCh != '\\'; + } + if (_31$$36) { + _32$$37 = ch == '.'; + if (!(_32$$37)) { + _32$$37 = ch == '+'; + } + _33$$37 = _32$$37; + if (!(_33$$37)) { + _33$$37 = ch == '|'; + } + _34$$37 = _33$$37; + if (!(_34$$37)) { + _34$$37 = ch == '#'; + } + if (_34$$37) { + zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); + } + } + zephir_concat_self_char(&route, ch TSRMLS_CC); + prevCh = ch; + } + } + zephir_create_array(return_value, 2, 0 TSRMLS_CC); + zephir_array_fast_append(return_value, route); + zephir_array_fast_append(return_value, matches); + RETURN_MM(); + } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); + zephir_check_call_status(); + if (!(zephir_start_with_str(pattern, SL("#")))) { + if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { + ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(pcrePattern); + zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_VAR(_0$$4); + zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); + zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); + ZEPHIR_CPY_WRT(routePaths, _0$$4); + } else { + ZEPHIR_CPY_WRT(pcrePattern, pattern); + } + ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(compiledPattern, pattern); + } + zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { + + int _0$$4; + zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(paths) != IS_NULL) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_INIT_VAR(moduleName); + ZVAL_NULL(moduleName); + ZEPHIR_INIT_VAR(controllerName); + ZVAL_NULL(controllerName); + ZEPHIR_INIT_VAR(actionName); + ZVAL_NULL(actionName); + ZEPHIR_INIT_VAR(parts); + zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); + do { + _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); + if (_0$$4 == 3) { + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); + break; + } + if (_0$$4 == 2) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); + break; + } + if (_0$$4 == 1) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); + break; + } + } while(0); + + ZEPHIR_INIT_VAR(routePaths); + array_init(routePaths); + if (Z_TYPE_P(moduleName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(controllerName) != IS_NULL) { + if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { + ZEPHIR_INIT_VAR(realClassName); + zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(namespaceName); + zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); + if (zephir_is_true(namespaceName)) { + zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(realClassName, controllerName); + } + ZEPHIR_INIT_VAR(_1$$9); + zephir_uncamelize(_1$$9, realClassName, NULL ); + zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(actionName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(routePaths, paths); + } + } else { + ZEPHIR_INIT_NVAR(routePaths); + array_init(routePaths); + } + if (Z_TYPE_P(routePaths) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); + return; + } + RETURN_CCTOR(routePaths); + } -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif +static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { + + + + RETURN_MEMBER(this_ptr, "_name"); + } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *name_param = NULL; + zval *name = NULL; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 155 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); -} -// 1542 "parser.php7.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 159 "parser.php7.lemon" -{ - vvgotominor.vv146 = vvmsp[0].minor.vv146; -} -// 1570 "parser.php7.c" - break; - case 2: -// 167 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); -} -// 1577 "parser.php7.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 171 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); -} -// 1588 "parser.php7.c" - break; - case 24: -// 263 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1601 "parser.php7.c" - break; - case 25: -// 267 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1614 "parser.php7.c" - break; - case 26: -// 271 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1630 "parser.php7.c" - break; - case 27: -// 275 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1646 "parser.php7.c" - break; - case 28: -// 279 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1662 "parser.php7.c" - break; - case 29: -// 287 "parser.php7.lemon" -{ - phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1672 "parser.php7.c" - break; - case 30: -// 295 "parser.php7.lemon" -{ - phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); } -// 1682 "parser.php7.c" - break; - case 31: -// 303 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1696 "parser.php7.c" - break; - case 32: -// 307 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 1711 "parser.php7.c" - break; - case 33: -// 311 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1726 "parser.php7.c" - break; - case 34: -// 315 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { + + + + RETURN_MEMBER(this_ptr, "_match"); + } -// 1742 "parser.php7.c" - break; - case 35: -// 323 "parser.php7.lemon" -{ - phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { + + + + RETURN_MEMBER(this_ptr, "_id"); + } -// 1752 "parser.php7.c" - break; - case 36: - case 48: - case 134: - case 141: -// 331 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); - vv_destructor(2,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { + + + + RETURN_MEMBER(this_ptr, "_pattern"); + } -// 1763 "parser.php7.c" - break; - case 38: -// 343 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { + + + + RETURN_MEMBER(this_ptr, "_compiledPattern"); + } -// 1771 "parser.php7.c" - break; - case 39: -// 347 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 1779 "parser.php7.c" - break; - case 40: -// 351 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { + + HashTable *_2; + HashPosition _1; + zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(reversed); + array_init(reversed); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); + zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HMKEY(path, _2, _1); + ZEPHIR_GET_HVALUE(position, _3); + zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); + } + RETURN_CCTOR(reversed); + } -// 1787 "parser.php7.c" - break; - case 41: -// 355 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); + } -// 1795 "parser.php7.c" - break; - case 42: -// 359 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { + + + + RETURN_MEMBER(this_ptr, "_methods"); + } -// 1803 "parser.php7.c" - break; - case 43: - case 67: - case 133: - case 145: -// 363 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { + zephir_get_strval(hostname, hostname_param); + } else { + ZEPHIR_INIT_VAR(hostname); + ZVAL_EMPTY_STRING(hostname); + } + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 1813 "parser.php7.c" - break; - case 44: - case 127: -// 367 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 1823 "parser.php7.c" - break; - case 45: - case 116: -// 371 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { + + zval *group; + + zephir_fetch_params(0, 1, 0, &group); + + + + zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); + RETURN_THISW(); + } -// 1832 "parser.php7.c" - break; - case 46: -// 379 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { + + + + RETURN_MEMBER(this_ptr, "_group"); + } -// 1847 "parser.php7.c" - break; - case 47: -// 383 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { + + zval *name_param = NULL, *converter; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &converter); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); + RETURN_THIS(); + } -// 1862 "parser.php7.c" - break; - case 50: -// 403 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { + + + + RETURN_MEMBER(this_ptr, "_converters"); + } -// 1869 "parser.php7.c" - break; - case 51: -// 407 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { + + + + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } -// 1877 "parser.php7.c" - break; - case 52: - case 66: - case 132: - case 146: -// 411 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); + + return SUCCESS; + } -// 1887 "parser.php7.c" - break; - case 53: - case 147: -// 415 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1895 "parser.php7.c" - break; - case 54: - case 148: -// 419 "parser.php7.lemon" + + + + + +#ifdef HAVE_CONFIG_H +#endif + + + +#if PHP_VERSION_ID < 70000 +#else +#endif + + +static void phalcon_get_uri(zval *return_value, zval *path) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + int i, found = 0, mark = 0; + char *cursor, *str, ch; + + if (Z_TYPE_P(path) != IS_STRING) { + RETURN_EMPTY_STRING(); + } + + if (Z_STRLEN_P(path) > 0) { + cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; + for (i = Z_STRLEN_P(path); i > 0; i--) { + ch = *cursor; + if (ch == '/' || ch == '\\') { + found++; + if (found == 1) { + mark = i - 1; + } else { + str = emalloc(mark - i + 1); + memcpy(str, Z_STRVAL_P(path) + i, mark - i); + str[mark - i] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, str, mark - i, 0); +#else + ZVAL_STRINGL(return_value, str, mark - i); +#endif + return; + } + } + cursor--; + } + } + + RETURN_EMPTY_STRING(); } -// 1903 "parser.php7.c" - break; - case 55: - case 149: -// 423 "parser.php7.lemon" + +zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + unsigned int length = 0, variable_length, ch, j; + char *item = NULL, *cursor_var, *variable = NULL; + int not_valid = 0; +#if PHP_VERSION_ID < 70000 + int result = FAILURE; + zval **zv, **tmp; +#else + zval *zv, *tmp; +#endif + + if (named) { + length = cursor - marker - 1; + item = estrndup(marker + 1, length); + cursor_var = item; + marker = item; + for (j = 0; j < length; j++) { + ch = *cursor_var; + if (ch == '\0') { + not_valid = 1; + break; + } + if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ + not_valid = 1; + break; + } + if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { + if (ch == ':') { + variable_length = cursor_var - marker; + variable = estrndup(marker, variable_length); + break; + } + } else { + not_valid = 1; + break; + } + cursor_var++; + } + } + + if (!not_valid) { + + if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { + if (named) { + if (variable) { + efree(item); + item = variable; + length = variable_length; + } +#if PHP_VERSION_ID < 70000 + if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { + efree(item); + (*position)++; + return *zv; + } + } +#else + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { + if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { + efree(item); + (*position)++; + return zv; + } + } +#endif + } else { +#if PHP_VERSION_ID < 70000 + if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { + if (Z_TYPE_PP(zv) == IS_STRING) { + if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { + (*position)++; + return *tmp; + } + } + } + } +#else + if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { + if (Z_TYPE_P(zv) == IS_STRING) { + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { + (*position)++; + return tmp; + } + } + } + } +#endif + } + } + + (*position)++; + } + + if (item) { + efree(item); + } + + return NULL; } -// 1912 "parser.php7.c" - break; - case 56: - case 150: -// 427 "parser.php7.lemon" + +static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + char *cursor, *marker = NULL; + unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; + unsigned char ch; + smart_str route_str = {0}; + ulong position = 1; + int i; + zval *replace, replace_copy; + int use_copy, looking_placeholder = 0; + + if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { + ZVAL_NULL(return_value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); + return; + } + + if (Z_STRLEN_P(pattern) <= 0) { + ZVAL_FALSE(return_value); + return; + } + + cursor = Z_STRVAL_P(pattern); + if (*cursor == '/') { + ++cursor; + i = 1; + } + else { + i = 0; + } + + if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); +#else + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); +#endif + return; + } + + for (; i < Z_STRLEN_P(pattern); ++i) { + + ch = *cursor; + if (ch == '\0') { + break; + } + + if (parentheses_count == 0 && !looking_placeholder) { + if (ch == '{') { + if (bracket_count == 0) { + marker = cursor; + intermediate = 0; + } + bracket_count++; + } else { + if (ch == '}') { + bracket_count--; + if (intermediate > 0) { + if (bracket_count == 0) { + replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && !looking_placeholder) { + if (ch == '(') { + if (parentheses_count == 0) { + marker = cursor; + intermediate = 0; + } + parentheses_count++; + } else { + if (ch == ')') { + parentheses_count--; + if (intermediate > 0) { + if (parentheses_count == 0) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && parentheses_count == 0) { + if (looking_placeholder) { + if (intermediate > 0) { + if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + looking_placeholder = 0; + continue; + } + } + } else { + if (ch == ':') { + looking_placeholder = 1; + marker = cursor; + intermediate = 0; + } + } + } + + if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { + intermediate++; + } else { + smart_str_appendc(&route_str, ch); + } + + cursor++; + } + smart_str_0(&route_str); + +#if PHP_VERSION_ID < 70000 + if (route_str.len) { + RETURN_STRINGL(route_str.c, route_str.len, 0); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#else + if (route_str.s) { + RETURN_STR(route_str.s); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#endif } -// 1921 "parser.php7.c" - break; - case 57: - case 151: -// 431 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1930 "parser.php7.c" - break; - case 58: -// 439 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1945 "parser.php7.c" - break; - case 59: -// 443 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1960 "parser.php7.c" - break; - case 60: -// 451 "parser.php7.lemon" -{ - phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); + return SUCCESS; + } -// 1969 "parser.php7.c" - break; - case 61: -// 459 "parser.php7.lemon" -{ - phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { + + zval *view, *dependencyInjector = NULL; + + zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); + + if (!dependencyInjector) { + dependencyInjector = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 1978 "parser.php7.c" - break; - case 62: -// 467 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { + + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1991 "parser.php7.c" - break; - case 63: -// 471 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *_0; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); + zephir_check_call_status(); + RETURN_MM(); + } -// 2004 "parser.php7.c" - break; - case 64: -// 479 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { + + + + RETURN_MEMBER(this_ptr, "_view"); + } -// 2017 "parser.php7.c" - break; - case 65: -// 483 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); + + return SUCCESS; + } -// 2030 "parser.php7.c" - break; - case 68: -// 503 "parser.php7.lemon" -{ - phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2043 "parser.php7.c" - break; - case 69: -// 511 "parser.php7.lemon" -{ - phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); + return SUCCESS; + } -// 2053 "parser.php7.c" - break; - case 70: -// 519 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { + + + + RETURN_MEMBER(this_ptr, "_registeredEngines"); + } -// 2063 "parser.php7.c" - break; - case 71: -// 523 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &options_param); + + if (!options_param) { + ZEPHIR_INIT_VAR(options); + array_init(options); + } else { + zephir_get_arrval(options, options_param); + } + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2074 "parser.php7.c" - break; - case 72: -// 531 "parser.php7.lemon" -{ - phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { + + zval *viewsDir_param = NULL; + zval *viewsDir = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewsDir_param); + + if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { + zephir_get_strval(viewsDir, viewsDir_param); + } else { + ZEPHIR_INIT_VAR(viewsDir); + ZVAL_EMPTY_STRING(viewsDir); + } + + + zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2084 "parser.php7.c" - break; - case 73: -// 539 "parser.php7.lemon" -{ - phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { + + + + RETURN_MEMBER(this_ptr, "_viewsDir"); + } -// 2094 "parser.php7.c" - break; - case 74: -// 547 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { + + zval *engines_param = NULL; + zval *engines = NULL; + + zephir_fetch_params(0, 1, 0, &engines_param); + + engines = engines_param; + + + zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); + } -// 2108 "parser.php7.c" - break; - case 75: -// 551 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { + + HashTable *_2$$5; + HashPosition _1$$5; + zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(engines); + array_init(engines); + ZEPHIR_OBS_VAR(registeredEngines); + zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); + if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); + zephir_check_call_status(); + zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); + return; + } + ZEPHIR_INIT_VAR(arguments); + zephir_create_array(arguments, 2, 0 TSRMLS_CC); + zephir_array_fast_append(arguments, this_ptr); + zephir_array_fast_append(arguments, dependencyInjector); + zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(engineService, _3$$5); + if (Z_TYPE_P(engineService) == IS_OBJECT) { + if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_NVAR(engineObject); + ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(engineObject, engineService); + } + } else { + if (Z_TYPE_P(engineService) == IS_STRING) { + ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_5$$13); + object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_LNVAR(_6$$13); + ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); + ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); + } + } + zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + } + RETURN_CCTOR(engines); + } -// 2122 "parser.php7.c" - break; - case 76: -// 559 "parser.php7.lemon" -{ - phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { + + HashTable *_4; + HashPosition _3; + zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; + zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + + + ZEPHIR_OBS_VAR(eventsManager); + zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { + RETURN_MM_NULL(); + } + } + notExists = 1; + mustClean = 1; + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(viewsDirPath); + ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); + ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); + for ( + ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS + ; zephir_hash_move_forward_ex(_4, &_3) + ) { + ZEPHIR_GET_HMKEY(extension, _4, _3); + ZEPHIR_GET_HVALUE(engine, _5); + ZEPHIR_INIT_LNVAR(_6$$6); + ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); + if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); + } else { + _7$$8 = zephir_is_true(extension); + if (_7$$8) { + ZEPHIR_SINIT_NVAR(_8$$8); + ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); + ZEPHIR_INIT_NVAR(_9$$8); + zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); + _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); + } + _10$$8 = _7$$8; + if (_10$$8) { + _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); + } + if (_10$$8) { + ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); + } else { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZVAL_STRING(viewEnginePath, "", 1); + } + } + if (zephir_is_true(viewEnginePath)) { + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_12$$12); + ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); + zephir_check_temp_parameter(_12$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { + continue; + } + } + ZEPHIR_INIT_NVAR(_14$$11); + if (mustClean) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); + zephir_check_call_status(); + notExists = 0; + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_15$$14); + ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); + zephir_check_temp_parameter(_15$$14); + zephir_check_call_status(); + } + break; + } + } + if (notExists == 1) { + ZEPHIR_INIT_VAR(_17$$15); + object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_18$$15); + ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); + ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_19$$16); + ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); + zephir_check_temp_parameter(_19$$16); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2132 "parser.php7.c" - break; - case 77: -// 567 "parser.php7.lemon" -{ - phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { + + zend_bool _3$$12; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { + ZEPHIR_INIT_VAR(key); + ZVAL_NULL(key); + ZEPHIR_INIT_VAR(lifetime); + ZVAL_NULL(lifetime); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(key); + zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); + } + if (Z_TYPE_P(key) == IS_NULL) { + ZEPHIR_INIT_NVAR(key); + zephir_md5(key, path); + } + ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); + zephir_check_call_status(); + if (Z_TYPE_P(content) != IS_NULL) { + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_CCTOR(content); + } + } + } + ZEPHIR_INIT_VAR(_1); + zephir_create_symbol_table(TSRMLS_C); + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(params) == IS_ARRAY) { + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + } else { + ZEPHIR_CPY_WRT(mergedParams, viewParams); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, path, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_2$$12); + if (_3$$12) { + ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_4$$12); + } + if (_3$$12) { + ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + RETURN_MM_MEMBER(this_ptr, "_content"); + +} + +static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_INIT_VAR(_0$$3); + zephir_create_symbol_table(TSRMLS_C); + + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, partialPath, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); + zend_print_zval(_1, 0); + ZEPHIR_MM_RESTORE(); + } -// 2142 "parser.php7.c" - break; - case 78: -// 575 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &options_param); + + zephir_get_arrval(options, options_param); + + + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + RETURN_THIS(); + } -// 2149 "parser.php7.c" - break; - case 79: -// 583 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { + + + + RETURN_MEMBER(this_ptr, "_cacheOptions"); + } -// 2157 "parser.php7.c" - break; - case 80: -// 587 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { + + zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); + return; + } + ZEPHIR_INIT_VAR(cacheService); + ZVAL_STRING(cacheService, "viewCache", 1); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + if (zephir_array_isset_string(cacheOptions, SS("service"))) { + ZEPHIR_OBS_NVAR(cacheService); + zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); + } + } + ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(viewCache, _0); + if (Z_TYPE_P(viewCache) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); + return; + } + RETURN_CCTOR(viewCache); + } -// 2165 "parser.php7.c" - break; - case 81: -// 591 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { + + zend_bool _1; + zval *_0, *_2, *_3$$3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = zephir_is_true(_0); + if (_1) { + ZEPHIR_OBS_VAR(_2); + zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = Z_TYPE_P(_2) != IS_OBJECT; + } + if (_1) { + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); + } + RETURN_MM_MEMBER(this_ptr, "_cache"); + } -// 2173 "parser.php7.c" - break; - case 82: -// 595 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { + + zval *options = NULL; + + zephir_fetch_params(0, 0, 1, &options); + + if (!options) { + options = ZEPHIR_GLOBAL(global_true); + } + + + if (Z_TYPE_P(options) == IS_ARRAY) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + } else { + if (zephir_is_true(options)) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } else { + if (0) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + } + RETURN_THISW(); + } -// 2181 "parser.php7.c" - break; - case 83: -// 599 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2189 "parser.php7.c" - break; - case 84: -// 603 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { + + zend_bool merge, _0; + zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; + zval *params = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); + + params = params_param; + if (!merge_param) { + merge = 1; + } else { + merge = zephir_get_boolval(merge_param); + } + + + _0 = merge; + if (_0) { + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); + _0 = Z_TYPE_P(_1) == IS_ARRAY; + } + if (_0) { + ZEPHIR_INIT_VAR(_2$$3); + _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); + } + RETURN_THIS(); + } -// 2198 "parser.php7.c" - break; - case 85: -// 607 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2206 "parser.php7.c" - break; - case 86: -// 611 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2215 "parser.php7.c" - break; - case 87: -// 615 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { + + + + RETURN_MEMBER(this_ptr, "_viewParams"); + } -// 2223 "parser.php7.c" - break; - case 88: -// 619 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { + + zval *content_param = NULL; + zval *content = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &content_param); + + if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(content_param) == IS_STRING)) { + zephir_get_strval(content, content_param); + } else { + ZEPHIR_INIT_VAR(content); + ZVAL_EMPTY_STRING(content); + } + + + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_THIS(); + } -// 2231 "parser.php7.c" - break; - case 89: -// 623 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { + + + + RETURN_MEMBER(this_ptr, "_content"); + } -// 2239 "parser.php7.c" - break; - case 90: -// 627 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { + + + + RETURN_MEMBER(this_ptr, "_activeRenderPath"); + } -// 2247 "parser.php7.c" - break; - case 91: -// 631 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2255 "parser.php7.c" - break; - case 92: -// 635 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2263 "parser.php7.c" - break; - case 93: -// 639 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); + + return SUCCESS; + } -// 2271 "parser.php7.c" - break; - case 94: -// 643 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean == 1) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean == 1) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2280 "parser.php7.c" - break; - case 95: -// 647 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2289 "parser.php7.c" - break; - case 96: -// 651 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2298 "parser.php7.c" - break; - case 97: -// 655 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2307 "parser.php7.c" - break; - case 98: -// 659 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { + + zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(compiler); + zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); + if (Z_TYPE_P(compiler) != IS_OBJECT) { + ZEPHIR_INIT_NVAR(compiler); + object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 354, _0$$3); + zephir_check_call_status(); + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); + if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 355, dependencyInjector); + zephir_check_call_status(); + } + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 356, options); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); + } + RETURN_CCTOR(compiler); + } -// 2316 "parser.php7.c" - break; - case 99: -// 663 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *templatePath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2325 "parser.php7.c" - break; - case 100: -// 667 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *item; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &item); + + + + _0 = Z_TYPE_P(item) == IS_OBJECT; + if (!(_0)) { + _0 = Z_TYPE_P(item) == IS_ARRAY; + } + if (_0) { + RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 347, item); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_MM_LONG(zephir_fast_strlen_ev(item)); + } -// 2334 "parser.php7.c" - break; - case 101: -// 671 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &needle, &haystack); + + + + if (Z_TYPE_P(haystack) == IS_ARRAY) { + RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); + } + if (Z_TYPE_P(haystack) == IS_STRING) { + if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 357, haystack, needle); + zephir_check_call_status(); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); + } + ZEPHIR_INIT_VAR(_1$$4); + zephir_fast_strpos(_1$$4, haystack, needle, 0 ); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); + return; + } -// 2343 "parser.php7.c" - break; - case 102: -// 675 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { + + zend_bool _0, _1; + int ZEPHIR_LAST_CALL_STATUS; + zval *text_param = NULL, *from_param = NULL, *to_param = NULL; + zval *text = NULL, *from = NULL, *to = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); + + zephir_get_strval(text, text_param); + if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(from_param) == IS_STRING)) { + zephir_get_strval(from, from_param); + } else { + ZEPHIR_INIT_VAR(from); + ZVAL_EMPTY_STRING(from); + } + if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(to_param) == IS_STRING)) { + zephir_get_strval(to, to_param); + } else { + ZEPHIR_INIT_VAR(to); + ZVAL_EMPTY_STRING(to); + } + + + _0 = ZEPHIR_IS_STRING(from, "latin1"); + if (!(_0)) { + _0 = ZEPHIR_IS_STRING(to, "utf8"); + } + if (_0) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 358, text); + zephir_check_call_status(); + RETURN_MM(); + } + _1 = ZEPHIR_IS_STRING(to, "latin1"); + if (!(_1)) { + _1 = ZEPHIR_IS_STRING(from, "utf8"); + } + if (_1) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 359, text); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 360, from, to, text); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); + return; + } -// 2352 "parser.php7.c" - break; - case 103: -// 679 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { + + zend_bool _1$$5; + zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; + int start, ZEPHIR_LAST_CALL_STATUS, position = 0; + zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &value, &start_param, &end); + + if (!start_param) { + start = 0; + } else { + start = zephir_get_intval(start_param); + } + if (!end) { + ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(end); + } + + + if (Z_TYPE_P(value) == IS_OBJECT) { + if (Z_TYPE_P(end) == IS_NULL) { + ZEPHIR_INIT_NVAR(end); + ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); + } + position = 0; + ZEPHIR_INIT_VAR(slice); + array_init(slice); + ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0$$3))) { + break; + } + _1$$5 = position >= start; + if (_1$$5) { + _1$$5 = ZEPHIR_GE_LONG(end, position); + } + if (_1$$5) { + ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); + zephir_check_call_status(); + zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); + } + ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); + zephir_check_call_status(); + position++; + } + RETURN_CCTOR(slice); + } + ZEPHIR_INIT_VAR(length); + if (Z_TYPE_P(end) != IS_NULL) { + ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); + } else { + ZVAL_NULL(length); + } + if (Z_TYPE_P(value) == IS_ARRAY) { + ZEPHIR_SINIT_VAR(_5$$9); + ZVAL_LONG(&_5$$9, start); + ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 361, value, &_5$$9, length); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_6$$11); + ZVAL_LONG(&_6$$11, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_6$$11, length); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_8$$10); + ZVAL_LONG(&_8$$10, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_8$$10); + zephir_check_call_status(); + RETURN_MM(); + } + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_9$$12); + ZVAL_LONG(&_9$$12, start); + zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_10); + ZVAL_LONG(&_10, start); + zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); + RETURN_MM(); + } -// 2361 "parser.php7.c" - break; - case 104: -// 683 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *value_param = NULL; + zval *value = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &value_param); + + zephir_get_arrval(value, value_param); + + + ZEPHIR_MAKE_REF(value); + ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 363, value); + ZEPHIR_UNREF(value); + zephir_check_call_status(); + RETURN_CTOR(value); + } -// 2370 "parser.php7.c" - break; - case 105: -// 687 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *arguments = NULL; + zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; + zval *name = NULL, *_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments_param) { + ZEPHIR_INIT_VAR(arguments); + array_init(arguments); + } else { + zephir_get_arrval(arguments, arguments_param); + } + + + ZEPHIR_OBS_VAR(macro); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_1$$3); + object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_2$$3); + ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 364, macro, arguments); + zephir_check_call_status(); + RETURN_MM(); + +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2379 "parser.php7.c" - break; - case 106: -// 691 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { + + zval *view = NULL; + + zephir_fetch_params(0, 0, 1, &view); + + if (!view) { + view = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(view) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + } + } -// 2388 "parser.php7.c" - break; - case 107: -// 695 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2397 "parser.php7.c" - break; - case 108: -// 699 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2405 "parser.php7.c" - break; - case 109: -// 703 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2413 "parser.php7.c" - break; - case 110: -// 707 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { + + zval *option_param = NULL, *value; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &option_param, &value); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2421 "parser.php7.c" - break; - case 111: -// 711 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { + + zval *option_param = NULL, *value = NULL, *_0; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &option_param); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2429 "parser.php7.c" - break; - case 112: -// 715 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2437 "parser.php7.c" - break; - case 113: -// 719 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { + + zval *_3$$6 = NULL, *_4$$7 = NULL; + HashTable *_1$$3; + HashPosition _0$$3; + int ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments) { + arguments = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(extension, _2$$3); + if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(arguments) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_3$$6); + zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$6, extension); + zephir_array_fast_append(_3$$6, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_4$$7); + zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_4$$7, extension); + zephir_array_fast_append(_4$$7, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC(status, _4$$7); + zephir_check_call_status(); + } + if (Z_TYPE_P(status) == IS_STRING) { + RETURN_CCTOR(status); + } + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2445 "parser.php7.c" - break; - case 114: -// 723 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *extension; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &extension); + + + + if (Z_TYPE_P(extension) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); + return; + } + if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); + zephir_check_call_status(); + } + zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); + RETURN_THIS(); + } -// 2453 "parser.php7.c" - break; - case 115: -// 727 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { + + + + RETURN_MEMBER(this_ptr, "_extensions"); + } -// 2461 "parser.php7.c" - break; - case 117: -// 735 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2469 "parser.php7.c" - break; - case 118: -// 739 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { + + + + RETURN_MEMBER(this_ptr, "_functions"); + } -// 2478 "parser.php7.c" - break; - case 119: -// 743 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2486 "parser.php7.c" - break; - case 120: -// 747 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { + + + + RETURN_MEMBER(this_ptr, "_filters"); + } -// 2494 "parser.php7.c" - break; - case 121: -// 751 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2502 "parser.php7.c" - break; - case 122: -// 755 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { + + zval *_7$$5; + zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + ZEPHIR_INIT_VAR(_1$$3); + _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); + zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_OBS_VAR(_3); + zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_3) == IS_OBJECT) { + ZEPHIR_OBS_VAR(_4$$4); + zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_5$$5); + _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_7$$5); + zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_7$$5, this_ptr); + ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); + } + } + ZEPHIR_OBS_VAR(_8); + zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_8) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); + return; + } + RETURN_MM_MEMBER(this_ptr, "_prefix"); + } -// 2511 "parser.php7.c" - break; - case 123: -// 759 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { + + zend_bool _3$$5, _8$$8; + zephir_fcall_cache_entry *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; + zval *expr = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + ZEPHIR_OBS_VAR(left); + zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); + zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 265)) { + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); + if (ZEPHIR_IS_STRING(variable, "loop")) { + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); + zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); + } else { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; + if (_3$$5) { + ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); + zephir_check_call_status(); + _3$$5 = zephir_is_true(_4$$5); + } + if (_3$$5) { + ZEPHIR_INIT_VAR(_5$$6); + ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); + zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_CONCAT_SV(_6$$7, "$", variable); + zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); + } + } + } else { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(leftType); + zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); + _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); + if (_8$$8) { + _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); + } + if (_8$$8) { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } else { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } + } + zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); + ZEPHIR_OBS_VAR(right); + zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); + zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_9, 265)) { + zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); + zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); + } else { + ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); + } + RETURN_CCTOR(exprCode); + } -// 2520 "parser.php7.c" - break; - case 124: -// 763 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { + + zend_bool _8$$5; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; + zval *expr = NULL, *_1$$6, *_3$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(arguments); + ZVAL_STRING(arguments, "", 1); + } + ZEPHIR_OBS_VAR(nameExpr); + zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_VAR(nameType); + zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + if (ZEPHIR_IS_LONG(nameType, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_1$$6); + zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_1$$6, name); + zephir_array_fast_append(_1$$6, arguments); + zephir_array_fast_append(_1$$6, funcArguments); + ZEPHIR_INIT_VAR(_2$$6); + ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _2$$6, _1$$6); + zephir_check_temp_parameter(_2$$6); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(functions); + zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); + if (Z_TYPE_P(functions) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_3$$12); + zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$12, arguments); + zephir_array_fast_append(_3$$12, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_4$$9); + object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); + zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$9); + ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); + ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); + if (!(_8$$5)) { + _8$$5 = ZEPHIR_IS_STRING(name, "content"); + } + if (_8$$5) { + RETURN_MM_STRING("$this->getContent()", 1); + } + if (ZEPHIR_IS_STRING(name, "partial")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "super")) { + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { + ZEPHIR_OBS_VAR(currentBlock); + zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(block); + if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { + ZEPHIR_OBS_VAR(exprLevel); + zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 367, block); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, code); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, code TSRMLS_CC); + } + } else { + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, block); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, block TSRMLS_CC); + } + } + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + RETURN_CCTOR(escapedCode); + } + ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); + RETURN_MM(); + } + } + RETURN_MM_STRING("''", 1); + } + ZEPHIR_INIT_VAR(_9$$5); + zephir_camelize(_9$$5, name, NULL ); + ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(className); + ZVAL_STRING(className, "Phalcon\\Tag", 1); + if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { + ZEPHIR_OBS_VAR(arrayHelpers); + zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); + if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(arrayHelpers); + zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); + zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); + } + if (zephir_array_isset(arrayHelpers, name)) { + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "static_url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "date")) { + ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "time")) { + RETURN_MM_STRING("time()", 1); + } + if (ZEPHIR_IS_STRING(name, "dump")) { + ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "version")) { + RETURN_MM_STRING("Phalcon\\Version::get()", 1); + } + if (ZEPHIR_IS_STRING(name, "version_id")) { + RETURN_MM_STRING("Phalcon\\Version::getId()", 1); + } + if (ZEPHIR_IS_STRING(name, "constant")) { + ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 365, nameExpr); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); + RETURN_MM(); + } -// 2529 "parser.php7.c" - break; - case 125: -// 767 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { + + zephir_fcall_cache_entry *_2 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; + zval *test = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &test_param, &left_param); + + test = test_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); + if (ZEPHIR_IS_STRING(name, "empty")) { + ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "even")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "odd")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "numeric")) { + ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "scalar")) { + ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "iterable")) { + ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); + RETURN_MM(); + } + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_OBS_VAR(testName); + zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { + if (ZEPHIR_IS_STRING(name, "divisibleby")) { + zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 365, _1$$12); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sameas")) { + zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 365, _4$$13); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "type")) { + zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 365, _6$$14); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); + RETURN_MM(); + } + } + } + ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 365, test); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); + RETURN_MM(); + } -// 2538 "parser.php7.c" - break; - case 126: -// 771 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { + + zend_bool _13, _14, _15; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; + zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &filter_param, &left_param); + + filter = filter_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); + } else { + if (!ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_INIT_VAR(_0$$5); + object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); + ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_VAR(functionName); + zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_INIT_VAR(arguments); + ZVAL_NULL(arguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { + if (!ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_OBS_VAR(file); + zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_OBS_VAR(line); + zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_INIT_VAR(_4$$7); + zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); + add_assoc_long_ex(_5$$7, SS("type"), 364); + zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + ZEPHIR_MAKE_REF(funcArguments); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, funcArguments, _4$$7); + ZEPHIR_UNREF(funcArguments); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(arguments, left); + } + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_6$$9, name); + zephir_array_fast_append(_6$$9, arguments); + zephir_array_fast_append(_6$$9, funcArguments); + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _7$$9, _6$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(filters); + zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); + if (Z_TYPE_P(filters) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_8$$15); + zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_8$$15, arguments); + zephir_array_fast_append(_8$$15, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_9$$12); + object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); + zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$12); + ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + if (ZEPHIR_IS_STRING(name, "length")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); + RETURN_MM(); + } + _13 = ZEPHIR_IS_STRING(name, "e"); + if (!(_13)) { + _13 = ZEPHIR_IS_STRING(name, "escape"); + } + if (_13) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_css")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_js")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_attr")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "trim")) { + ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "left_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "right_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "striptags")) { + ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slashes")) { + ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "stripslashes")) { + ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "nl2br")) { + ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "keys")) { + ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "join")) { + ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); + RETURN_MM(); + } + _14 = ZEPHIR_IS_STRING(name, "lower"); + if (!(_14)) { + _14 = ZEPHIR_IS_STRING(name, "lowercase"); + } + if (_14) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); + RETURN_MM(); + } + _15 = ZEPHIR_IS_STRING(name, "upper"); + if (!(_15)) { + _15 = ZEPHIR_IS_STRING(name, "uppercase"); + } + if (_15) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "capitalize")) { + ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sort")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_decode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "format")) { + ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "abs")) { + ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slice")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "convert_encoding")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_16); + object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_INIT_VAR(_19); + ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); + ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); + zephir_check_call_status(); + zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } -// 2547 "parser.php7.c" - break; - case 128: -// 779 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { + + HashTable *_4$$6; + HashPosition _3$$6; + zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; + zval *expr = NULL, *_0$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + while (1) { + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_0$$4); + zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_0$$4, expr); + ZEPHIR_INIT_NVAR(_1$$4); + ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 366, _1$$4, _0$$4); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (Z_TYPE_P(exprCode) == IS_STRING) { + break; + } + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(items); + array_init(items); + zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); + for ( + ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) + ) { + ZEPHIR_GET_HVALUE(singleExpr, _5$$6); + zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 365, _6$$7); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_LNVAR(_8$$8); + ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); + zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); + } else { + zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); + } + } + ZEPHIR_INIT_NVAR(exprCode); + zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, '.')) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(left); + if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + } + if (ZEPHIR_IS_LONG(type, 311)) { + zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 124)) { + zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 369, _12$$13, leftCode); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(right); + if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_NULL(exprCode); + do { + if (ZEPHIR_IS_LONG(type, '!')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '*')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '+')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '-')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '/')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 37)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '<')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 61)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 62)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 126)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 278)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 360)) { + ZEPHIR_INIT_NVAR(exprCode); + if (zephir_array_isset_string(expr, SS("left"))) { + ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); + } else { + ZVAL_STRING(exprCode, "[]", 1); + } + break; + } + if (ZEPHIR_IS_LONG(type, 258)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 259)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 260)) { + ZEPHIR_INIT_NVAR(_14$$31); + zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); + ZEPHIR_SINIT_NVAR(_16$$31); + ZVAL_STRING(&_16$$31, "'", 0); + ZEPHIR_SINIT_NVAR(_17$$31); + ZVAL_STRING(&_17$$31, "\\'", 0); + zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); + break; + } + if (ZEPHIR_IS_LONG(type, 261)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "null", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 262)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "false", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 263)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "true", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 265)) { + zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); + break; + } + if (ZEPHIR_IS_LONG(type, 266)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 267)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 270)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 271)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 272)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 273)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 274)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 275)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 276)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 356)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 361)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); + break; + } + if (ZEPHIR_IS_LONG(type, 365)) { + ZEPHIR_OBS_NVAR(start); + if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 365, start); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(startCode); + ZVAL_STRING(startCode, "null", 1); + } + ZEPHIR_OBS_NVAR(end); + if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 365, end); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(endCode); + ZVAL_STRING(endCode, "null", 1); + } + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 362)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 363)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 392)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 386)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 393)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 387)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 394)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 388)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 395)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 389)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 396)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 390)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 397)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 391)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 309)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 367)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 366)) { + zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 365, _21$$69); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 368)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 369)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 364)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); + break; + } + ZEPHIR_INIT_NVAR(_22$$73); + object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_25$$73); + ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); + ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); + zephir_check_call_status(); + zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); + + break; + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + RETURN_CCTOR(exprCode); + } -// 2556 "parser.php7.c" - break; - case 129: -// 783 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { + + HashTable *_1$$4; + HashPosition _0$$4; + zend_bool isStatementList = 0; + int ZEPHIR_LAST_CALL_STATUS; + zval *statements, *statement = NULL, **_2$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statements); + + + + if (Z_TYPE_P(statements) != IS_ARRAY) { + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } + isStatementList = 1; + if (!(zephir_array_isset_string(statements, SS("type")))) { + zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(statement, _2$$4); + if (Z_TYPE_P(statement) != IS_ARRAY) { + isStatementList = 0; + break; + } + } + } + if (isStatementList == 1) { + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 370, statements); + zephir_check_call_status(); + RETURN_MM(); + } + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } -// 2566 "parser.php7.c" - break; - case 130: -// 787 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { + + HashTable *_2$$4; + HashPosition _1$$4; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + if (!(zephir_array_isset_string(statement, SS("expr")))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "", 1); + ZEPHIR_INIT_VAR(forElse); + ZVAL_NULL(forElse); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(prefixLevel); + ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); + ZEPHIR_OBS_VAR(expr); + zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(blockStatements); + zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); + ZEPHIR_INIT_NVAR(forElse); + ZVAL_BOOL(forElse, 0); + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); + for ( + ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) + ) { + ZEPHIR_GET_HVALUE(bstatement, _3$$4); + if (Z_TYPE_P(bstatement) != IS_ARRAY) { + break; + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_INIT_LNVAR(_4$$8); + ZEPHIR_CONCAT_SVS(_4$$8, ""); + zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); + ZEPHIR_CPY_WRT(forElse, prefixLevel); + zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); + break; + } + } + } + ZEPHIR_INIT_VAR(_5); + if (extendsMode) { + ZVAL_BOOL(_5, 1); + } else { + ZVAL_BOOL(_5, 0); + } + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 370, blockStatements, _5); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(loopContext); + zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_6$$9); + ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); + zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_10$$9); + ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); + zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); + zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$9); + ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); + zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_13$$9); + ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); + zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_14$$9); + ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); + zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(iterator); + ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); + } else { + ZEPHIR_CPY_WRT(iterator, exprCode); + } + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); + ZEPHIR_OBS_VAR(key); + if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_15$$11); + ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); + zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_16$$12); + ZEPHIR_CONCAT_SVSVS(_16$$12, ""); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); + } + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_19$$15); + ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); + zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_20$$15); + ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); + zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_21$$15); + ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_22$$15); + ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_23$$15); + ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_24$$15); + ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); + zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + ZEPHIR_INIT_VAR(_25$$16); + ZEPHIR_CONCAT_SVS(_25$$16, ""); + zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); + } + zephir_concat_self(&compilation, code TSRMLS_CC); + if (zephir_array_isset_string(statement, SS("if_expr"))) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } else { + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_26$$20); + ZEPHIR_CONCAT_SVS(_26$$20, ""); + zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + RETURN_CCTOR(compilation); + } -// 2576 "parser.php7.c" - break; - case 131: -// 791 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { + + zval *level = NULL, *prefix = NULL, *_0, *_1$$3; + + + level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(_1$$3, level)) { + ZEPHIR_CONCAT_SVSVS(return_value, ""); + return; + } + ZEPHIR_CONCAT_SVS(return_value, ""); + return; + } + RETURN_STRING("", 1); + } -// 2586 "parser.php7.c" - break; - case 136: - case 144: -// 823 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { + + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3); + if (extendsMode) { + ZVAL_BOOL(_3, 1); + } else { + ZVAL_BOOL(_3, 0); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 370, _2, _3); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVSV(compilation, "", _1); + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_6$$4); + if (extendsMode) { + ZVAL_BOOL(_6$$4, 1); + } else { + ZVAL_BOOL(_6$$4, 0); + } + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 370, blockStatements, _6$$4); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_7$$4); + ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); + zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); + } + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2595 "parser.php7.c" - break; - case 137: - case 143: -// 827 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -// 2603 "parser.php7.c" - break; - case 139: -// 839 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { + + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); + ZEPHIR_OBS_VAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); + zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); + zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_3$$4, 265)) { + zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$5); + ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); + zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$6); + ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); + zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); + } + } else { + ZEPHIR_INIT_VAR(_8$$7); + ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); + zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_9); + ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); + zephir_concat_self(&compilation, _9 TSRMLS_CC); + zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12); + if (extendsMode) { + ZVAL_BOOL(_12, 1); + } else { + ZVAL_BOOL(_12, 0); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 370, _11, _12); + zephir_check_call_status(); + zephir_concat_self(&compilation, _10 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_13$$8, 265)) { + zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); + ZEPHIR_INIT_VAR(_15$$9); + ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); + zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); + ZEPHIR_INIT_VAR(_17$$10); + ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); + zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_18$$8); + ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_19$$11); + ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); + } + RETURN_CCTOR(compilation); + } -// 2612 "parser.php7.c" - break; - case 140: -// 843 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { + + HashTable *_1; + HashPosition _0; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(assignments); + if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2621 "parser.php7.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php7.lemon" +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - { + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; + zval *statement = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_OBS_VAR(autoescape); + if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); + return; + } + ZEPHIR_OBS_VAR(oldAutoescape); + zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 370, _0, _1); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); + RETURN_CCTOR(compilation); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; + zval *statement = NULL; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + statement = statement_param; - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 350)) { + zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); + zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_1$$4, 265)) { + zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); + if (ZEPHIR_IS_STRING(_2$$5, "super")) { + RETURN_CCTOR(exprCode); } + } + } + _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); + if (zephir_is_true(_3)) { + ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); - } else { +} - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + zephir_fcall_cache_entry *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; + zval *statement = NULL; - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(pathExpr); + if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); + return; + } + zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 260)) { + if (!(zephir_array_isset_string(statement, SS("params")))) { + ZEPHIR_OBS_VAR(path); + zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_1$$5); + ZVAL_BOOL(_1$$5, 0); + ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(compilation); + zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); } + RETURN_CCTOR(compilation); } + } + ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 365, pathExpr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(params); + if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { + ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 365, params); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); + RETURN_MM(); - smart_str_0(&error_str); +} - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { + + HashTable *_6$$6; + HashPosition _5$$6; + zephir_fcall_cache_entry *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); + + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); + + + ZEPHIR_OBS_VAR(name); + if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (zephir_array_isset(_0, name)) { + ZEPHIR_INIT_VAR(_1$$4); + object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); + ZEPHIR_INIT_VAR(macroName); + ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); + ZEPHIR_INIT_VAR(code); + ZVAL_STRING(code, ""); + zephir_concat_self(&code, _3$$5 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); + zephir_concat_self(&code, _4$$6 TSRMLS_CC); + zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); + for ( + ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) + ) { + ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); + ZEPHIR_GET_HVALUE(parameter, _7$$6); + ZEPHIR_OBS_NVAR(variableName); + zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_8$$7); + ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); + zephir_concat_self(&code, _8$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_9$$7); + ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); + zephir_concat_self(&code, _9$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_10$$7); + ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); + zephir_concat_self(&code, _10$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_11$$7); + ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); + zephir_concat_self(&code, _11$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_OBS_NVAR(defaultValue); + if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 365, defaultValue); + zephir_check_call_status(); + ZEPHIR_INIT_LNVAR(_14$$8); + ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); + zephir_concat_self(&code, _14$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_LNVAR(_15$$9); + ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); + zephir_concat_self(&code, _15$$9 TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); + } + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_17$$10); + if (extendsMode) { + ZVAL_BOOL(_17$$10, 1); } else { - status->syntax_error = NULL; + ZVAL_BOOL(_17$$10, 0); } + ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 370, blockStatements, _17$$10); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_18$$10); + ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); + zephir_concat_self(&code, _19 TSRMLS_CC); + RETURN_CCTOR(code); - status->status = PHVOLT_PARSING_FAILED; - -// 2763 "parser.php7.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL; + zval *statement = NULL; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } -#endif + zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; -} -#endif + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); } -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + HashTable *_2; + HashPosition _1; + zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode, _0; + zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; + zval *statements = NULL, *_9$$8 = NULL; - phvolt_parser_token *pToken; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; + statements = statements_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - token->value = NULL; - token->len = 0; -} + if (!(zephir_fast_count_int(statements TSRMLS_CC))) { + RETURN_MM_STRING("", 1); + } + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + _0 = zephir_is_true(extended); + if (!(_0)) { + _0 = extendsMode; + } + ZEPHIR_INIT_VAR(blockMode); + ZVAL_BOOL(blockMode, _0); + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HVALUE(statement, _3); + if (Z_TYPE_P(statement) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); + return; + } + if (!(zephir_array_isset_string(statement, SS("type")))) { + ZEPHIR_INIT_NVAR(_4$$7); + object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_7$$7); + ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); + ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_9$$8); + zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_9$$8, statement); + ZEPHIR_INIT_NVAR(_10$$8); + ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 366, _10$$8, _9$$8); + zephir_check_temp_parameter(_10$$8); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_STRING) { + zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); + continue; + } + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); + do { + if (ZEPHIR_IS_LONG(type, 357)) { + zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); + zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 300)) { + ZEPHIR_INIT_NVAR(_14$$11); + if (extendsMode) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); + zephir_check_call_status(); + zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 302)) { + ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 304)) { + ZEPHIR_INIT_NVAR(_19$$13); + if (extendsMode) { + ZVAL_BOOL(_19$$13, 1); + } else { + ZVAL_BOOL(_19$$13, 0); + } + ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); + zephir_check_call_status(); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 306)) { + ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 359)) { + ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 307)) { + ZEPHIR_OBS_NVAR(blockName); + zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blockStatements); + zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + if (zephir_is_true(blockMode)) { + if (Z_TYPE_P(blocks) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(blocks); + array_init(blocks); + } + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); + ZEPHIR_INIT_NVAR(compilation); + ZVAL_NULL(compilation); + } + zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); + } else { + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_26$$21); + if (extendsMode) { + ZVAL_BOOL(_26$$21, 1); + } else { + ZVAL_BOOL(_26$$21, 0); + } + ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 370, blockStatements, _26$$21); + zephir_check_call_status(); + zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); + } + } + break; + } + if (ZEPHIR_IS_LONG(type, 310)) { + ZEPHIR_OBS_NVAR(path); + zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); + zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(extended); + ZVAL_BOOL(extended, 1); + ZEPHIR_INIT_NVAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(tempCompilation); + zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); + ZEPHIR_CPY_WRT(blockMode, extended); + break; + } + if (ZEPHIR_IS_LONG(type, 313)) { + ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 314)) { + ZEPHIR_INIT_NVAR(_34$$25); + if (extendsMode) { + ZVAL_BOOL(_34$$25, 1); + } else { + ZVAL_BOOL(_34$$25, 0); + } + ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); + zephir_check_call_status(); + zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 316)) { + ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 327)) { + ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 317)) { + ZEPHIR_INIT_NVAR(_41$$28); + if (extendsMode) { + ZVAL_BOOL(_41$$28, 1); + } else { + ZVAL_BOOL(_41$$28, 0); + } + ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); + zephir_check_call_status(); + zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 319)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 320)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); + zephir_check_call_status(); + zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 322)) { + ZEPHIR_INIT_NVAR(_46$$32); + if (extendsMode) { + ZVAL_BOOL(_46$$32, 1); + } else { + ZVAL_BOOL(_46$$32, 0); + } + ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); + zephir_check_call_status(); + zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 325)) { + ZEPHIR_INIT_NVAR(_49$$33); + if (extendsMode) { + ZVAL_BOOL(_49$$33, 1); + } else { + ZVAL_BOOL(_49$$33, 0); + } + ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); + zephir_check_call_status(); + zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 358)) { + break; + } + ZEPHIR_INIT_NVAR(_51$$35); + object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_54$$35); + ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); + ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + } + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); + if (ZEPHIR_IS_LONG(level, 1)) { + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); + RETURN_CCTOR(compilation); - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); +} - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} + HashTable *_3$$7; + HashPosition _2$$7; + zephir_fcall_cache_entry *_1 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; + zval *viewCode = NULL; -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); + ZEPHIR_OBS_VAR(currentPath); + zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_OBS_VAR(autoescape); + if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { + if (Z_TYPE_P(autoescape) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); + return; + } + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(intermediate); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(intermediate) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); + return; + } + ZEPHIR_INIT_VAR(_0); + if (extendsMode) { + ZVAL_BOOL(_0, 1); + } else { + ZVAL_BOOL(_0, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 370, intermediate, _0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { + ZEPHIR_INIT_VAR(finalCompilation); + if (extendsMode == 1) { + array_init(finalCompilation); } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + ZVAL_NULL(finalCompilation); + } + ZEPHIR_OBS_VAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); + for ( + ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) + ) { + ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); + ZEPHIR_GET_HVALUE(block, _4$$7); + if (Z_TYPE_P(name) == IS_STRING) { + if (zephir_array_isset(blocks, name)) { + ZEPHIR_OBS_NVAR(localBlock); + zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, localBlock); + zephir_check_call_status(); + } else { + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, block); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(blockCompilation, block); + } + } + if (extendsMode == 1) { + zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); + } + } else { + if (extendsMode == 1) { + zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); + } else { + zephir_concat_self(&finalCompilation, block TSRMLS_CC); + } + } } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + RETURN_CCTOR(finalCompilation); } + if (extendsMode == 1) { + RETURN_MM_MEMBER(this_ptr, "_blocks"); + } + RETURN_CCTOR(compilation); - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); } -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - ZVAL_NULL(result); + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; + zval *viewCode = NULL; -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_STRING(_0, "eval code", 1); + zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); + zephir_check_call_status(); + RETURN_MM(); - return 1; } -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; + zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { + zephir_get_strval(compiledPath, compiledPath_param); + } else { + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_EMPTY_STRING(compiledPath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; + if (ZEPHIR_IS_EQUAL(path, compiledPath)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); + return; + } + if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_1$$4); + ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(viewCode); + zephir_file_get_contents(viewCode, path TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { + ZEPHIR_INIT_VAR(_2$$5); + object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); + ZEPHIR_INIT_VAR(_4); + if (extendsMode) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_ARRAY) { + ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(finalCompilation, compilation); + } + ZEPHIR_INIT_VAR(_5); + zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); + return; + } + RETURN_CCTOR(compilation); - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; +} - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; + zval *_2$$23; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; + zval *templatePath = NULL; - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + if (0) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + if (0) { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(stat); + ZVAL_BOOL(stat, 1); + ZEPHIR_INIT_VAR(compileAlways); + ZVAL_BOOL(compileAlways, 0); + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_STRING(compiledPath, "", 1); + ZEPHIR_INIT_VAR(prefix); + ZVAL_NULL(prefix); + ZEPHIR_INIT_VAR(compiledSeparator); + ZVAL_STRING(compiledSeparator, "%%", 1); + ZEPHIR_INIT_VAR(compiledExtension); + ZVAL_STRING(compiledExtension, ".php", 1); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + if (zephir_array_isset_string(options, SS("compileAlways"))) { + ZEPHIR_OBS_NVAR(compileAlways); + zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); + if (Z_TYPE_P(compileAlways) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); + return; + } + } + if (zephir_array_isset_string(options, SS("prefix"))) { + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); + if (Z_TYPE_P(prefix) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledPath"))) { + ZEPHIR_OBS_NVAR(compiledPath); + zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); + if (Z_TYPE_P(compiledPath) != IS_STRING) { + if (Z_TYPE_P(compiledPath) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); + return; } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } + } + if (zephir_array_isset_string(options, SS("compiledSeparator"))) { + ZEPHIR_OBS_NVAR(compiledSeparator); + zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); + if (Z_TYPE_P(compiledSeparator) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledExtension"))) { + ZEPHIR_OBS_NVAR(compiledExtension); + zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); + if (Z_TYPE_P(compiledExtension) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); + return; + } + } + if (zephir_array_isset_string(options, SS("stat"))) { + ZEPHIR_OBS_NVAR(stat); + zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); + } + } + if (Z_TYPE_P(compiledPath) == IS_STRING) { + if (!(ZEPHIR_IS_EMPTY(compiledPath))) { + ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(templateSepPath); + zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(templateSepPath, templatePath); + } + ZEPHIR_INIT_VAR(compiledTemplatePath); + if (extendsMode == 1) { + ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); + } else { + ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); + } + } else { + if (Z_TYPE_P(compiledPath) == IS_OBJECT) { + if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$23); + zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$23, templatePath); + zephir_array_fast_append(_2$$23, options); + ZEPHIR_INIT_VAR(_3$$23); + ZVAL_BOOL(_3$$23, extendsMode); + zephir_array_fast_append(_2$$23, _3$$23); + ZEPHIR_INIT_NVAR(compiledTemplatePath); + ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); + zephir_check_call_status(); + if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); + return; } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } else { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); + return; + } + } + } + ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); + if (zephir_is_true(compileAlways)) { + ZEPHIR_INIT_VAR(_4$$26); + if (extendsMode) { + ZVAL_BOOL(_4$$26, 1); + } else { + ZVAL_BOOL(_4$$26, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); + zephir_check_call_status(); + } else { + if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { + if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_VAR(_6$$29); + if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_7$$30); + if (extendsMode) { + ZVAL_BOOL(_7$$30, 1); + } else { + ZVAL_BOOL(_7$$30, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); + zephir_check_call_status(); } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; + if (extendsMode == 1) { + ZEPHIR_INIT_VAR(blocksCode); + zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { + ZEPHIR_INIT_VAR(_8$$33); + object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_9$$33); + ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); + zephir_check_call_status(); + zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; + if (zephir_is_true(blocksCode)) { + ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(compilation); + array_init(compilation); } } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } + } else { + ZEPHIR_INIT_VAR(_10$$36); + if (extendsMode) { + ZVAL_BOOL(_10$$36, 1); } else { - efree(token.value); + ZVAL_BOOL(_10$$36, 0); } - break; + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); + zephir_check_call_status(); + } + } else { + if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_11$$38); + object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_12$$38); + ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); + zephir_check_call_status(); + zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); + RETURN_CCTOR(compilation); - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; +} - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; + - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_currentPath"); - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; +} - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; + - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; +} - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; + int ZEPHIR_LAST_CALL_STATUS; + zval *viewCode_param = NULL, *currentPath = NULL; + zval *viewCode = NULL; - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewCode_param); - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; + ZEPHIR_INIT_VAR(currentPath); + ZVAL_STRING(currentPath, "eval code", 1); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; +} - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; + zval *path = NULL; - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &path_param); - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; + zephir_get_strval(path, path_param); - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; + ZEPHIR_OBS_VAR(view); + zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); + if (Z_TYPE_P(view) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { + zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(viewsDir, _2$$4); + ZEPHIR_INIT_LNVAR(_3$$5); + ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); + if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; + } + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); + } else { + ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); + RETURN_MM(); } + } + RETURN_CTOR(path); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } +} - state->end = state->start; - } - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); +#ifdef HAVE_CONFIG_H #endif - efree(parser_status->syntax_error); - } - } - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - efree(parser_status); - efree(state); - return status; + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); + + return SUCCESS; + } + +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php5.lemon" +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -157009,58 +126883,58 @@ static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *temp #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval* yy40; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval* vv40; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -157070,46 +126944,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -157342,7 +127216,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -157575,8 +127449,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -157613,8 +127487,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -157651,7 +127525,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -157688,7 +127562,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -157700,10 +127574,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -157717,43 +127591,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -157791,7 +127665,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -157949,8 +127823,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -157960,21 +127834,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -158069,14 +127943,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 155 "parser.php5.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php5.c" break; case 88: case 89: @@ -158112,136 +127988,138 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 172 "parser.php5.lemon" { #if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(yypminor->yy40)); + zval_ptr_dtor(&(vvpminor->vv40)); #endif } +// 1175 "parser.php5.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -158250,9 +128128,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -158407,40 +128285,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 164 "parser.php5.lemon" { - status->ret = yymsp[0].minor.yy40; + status->ret = vvmsp[0].minor.vv40; } +// 1544 "parser.php5.c" break; case 1: case 4: @@ -158464,881 +128344,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 168 "parser.php5.lemon" { - yygotominor.yy40 = yymsp[0].minor.yy40; + vvgotominor.vv40 = vvmsp[0].minor.vv40; } +// 1572 "parser.php5.c" break; case 2: +// 178 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-1].minor.yy40, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); } +// 1579 "parser.php5.c" break; case 3: case 37: case 49: case 135: case 142: +// 182 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(NULL, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); } +// 1590 "parser.php5.c" break; case 24: +// 278 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1603 "parser.php5.c" break; case 25: +// 282 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-4].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1616 "parser.php5.c" break; case 26: +// 286 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-9].minor.yy40, yymsp[-7].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1632 "parser.php5.c" break; case 27: +// 290 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1648 "parser.php5.c" break; case 28: +// 294 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-7].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1664 "parser.php5.c" break; case 29: +// 304 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elseif_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1674 "parser.php5.c" break; case 30: +// 314 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elsefor_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1684 "parser.php5.c" break; case 31: +// 324 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, NULL, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1698 "parser.php5.c" break; case 32: +// 328 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, NULL, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1713 "parser.php5.c" break; case 33: +// 332 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1728 "parser.php5.c" break; case 34: +// 336 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1744 "parser.php5.c" break; case 35: +// 346 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_statement(yymsp[-1].minor.yy40); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1754 "parser.php5.c" break; case 36: case 48: case 134: case 141: +// 356 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-2].minor.yy40, yymsp[0].minor.yy40); - yy_destructor(2,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); + vv_destructor(2,&vvmsp[-1].minor); } +// 1765 "parser.php5.c" break; case 38: +// 370 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1773 "parser.php5.c" break; case 39: +// 374 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ADD_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1781 "parser.php5.c" break; case 40: +// 378 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_SUB_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1789 "parser.php5.c" break; case 41: +// 382 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_MUL_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1797 "parser.php5.c" break; case 42: +// 386 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_DIV_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1805 "parser.php5.c" break; case 43: case 67: case 133: case 145: +// 390 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1815 "parser.php5.c" break; case 44: case 127: +// 394 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1825 "parser.php5.c" break; case 45: case 116: +// 398 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DOT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1834 "parser.php5.c" break; case 46: +// 408 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-7].minor.yy0, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1849 "parser.php5.c" break; case 47: +// 412 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-8].minor.yy0, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1864 "parser.php5.c" break; case 50: +// 436 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[0].minor.yy0, NULL, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1871 "parser.php5.c" break; case 51: +// 440 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1879 "parser.php5.c" break; case 52: case 66: case 132: case 146: +// 444 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1889 "parser.php5.c" break; case 53: case 147: +// 448 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1897 "parser.php5.c" break; case 54: case 148: +// 452 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1905 "parser.php5.c" break; case 55: case 149: +// 456 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1914 "parser.php5.c" break; case 56: case 150: +// 460 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1923 "parser.php5.c" break; case 57: case 151: +// 464 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1932 "parser.php5.c" break; case 58: +// 474 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1947 "parser.php5.c" break; case 59: +// 478 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-6].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1962 "parser.php5.c" break; case 60: +// 488 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_empty_statement(status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1971 "parser.php5.c" break; case 61: +// 498 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_echo_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1980 "parser.php5.c" break; case 62: +// 508 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-5].minor.yy0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1993 "parser.php5.c" break; case 63: +// 512 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2006 "parser.php5.c" break; case 64: +// 522 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2019 "parser.php5.c" break; case 65: +// 526 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-6].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2032 "parser.php5.c" break; case 68: +// 550 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_raw_statement(yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2045 "parser.php5.c" break; case 69: +// 560 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_extends_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2055 "parser.php5.c" break; case 70: +// 570 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2065 "parser.php5.c" break; case 71: +// 574 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2076 "parser.php5.c" break; case 72: +// 584 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_do_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2086 "parser.php5.c" break; case 73: +// 594 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_return_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2096 "parser.php5.c" break; case 74: +// 604 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2110 "parser.php5.c" break; case 75: +// 608 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(1, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2124 "parser.php5.c" break; case 76: +// 618 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_break_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2134 "parser.php5.c" break; case 77: +// 628 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_continue_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2144 "parser.php5.c" break; case 78: +// 638 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2151 "parser.php5.c" break; case 79: +// 648 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2159 "parser.php5.c" break; case 80: +// 652 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2167 "parser.php5.c" break; case 81: +// 656 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_SUB, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2175 "parser.php5.c" break; case 82: +// 660 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ADD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2183 "parser.php5.c" break; case 83: +// 664 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MUL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2191 "parser.php5.c" break; case 84: +// 668 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_POW, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2200 "parser.php5.c" break; case 85: +// 672 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DIV, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2208 "parser.php5.c" break; case 86: +// 676 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2217 "parser.php5.c" break; case 87: +// 680 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2225 "parser.php5.c" break; case 88: +// 684 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_AND, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2233 "parser.php5.c" break; case 89: +// 688 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_OR, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2241 "parser.php5.c" break; case 90: +// 692 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_CONCAT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2249 "parser.php5.c" break; case 91: +// 696 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PIPE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2257 "parser.php5.c" break; case 92: +// 700 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_RANGE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2265 "parser.php5.c" break; case 93: +// 704 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_EQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2273 "parser.php5.c" break; case 94: +// 708 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2282 "parser.php5.c" break; case 95: +// 712 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2291 "parser.php5.c" break; case 96: +// 716 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2300 "parser.php5.c" break; case 97: +// 720 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2309 "parser.php5.c" break; case 98: +// 724 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2318 "parser.php5.c" break; case 99: +// 728 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2327 "parser.php5.c" break; case 100: +// 732 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2336 "parser.php5.c" break; case 101: +// 736 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2345 "parser.php5.c" break; case 102: +// 740 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2354 "parser.php5.c" break; case 103: +// 744 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2363 "parser.php5.c" break; case 104: +// 748 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2372 "parser.php5.c" break; case 105: +// 752 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2381 "parser.php5.c" break; case 106: +// 756 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2390 "parser.php5.c" break; case 107: +// 760 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2399 "parser.php5.c" break; case 108: +// 764 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2407 "parser.php5.c" break; case 109: +// 768 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2415 "parser.php5.c" break; case 110: +// 772 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2423 "parser.php5.c" break; case 111: +// 776 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2431 "parser.php5.c" break; case 112: +// 780 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2439 "parser.php5.c" break; case 113: +// 784 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATER, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2447 "parser.php5.c" break; case 114: +// 788 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2455 "parser.php5.c" break; case 115: +// 792 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2463 "parser.php5.c" break; case 117: +// 800 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IN, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2471 "parser.php5.c" break; case 118: +// 804 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2480 "parser.php5.c" break; case 119: +// 808 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2488 "parser.php5.c" break; case 120: +// 812 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_INCR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2496 "parser.php5.c" break; case 121: +// 816 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DECR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2504 "parser.php5.c" break; case 122: +// 820 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2513 "parser.php5.c" break; case 123: +// 824 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2522 "parser.php5.c" break; case 124: +// 828 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2531 "parser.php5.c" break; case 125: +// 832 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2540 "parser.php5.c" break; case 126: +// 836 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2549 "parser.php5.c" break; case 128: +// 844 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_TERNARY, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, yymsp[-4].minor.yy40, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2558 "parser.php5.c" break; case 129: +// 848 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, NULL, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2568 "parser.php5.c" break; case 130: +// 852 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2578 "parser.php5.c" break; case 131: +// 856 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2588 "parser.php5.c" break; case 136: case 144: +// 894 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2597 "parser.php5.c" break; case 137: case 143: +// 898 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(NULL, yymsp[0].minor.yy40, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); } +// 2605 "parser.php5.c" break; case 139: +// 912 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2614 "parser.php5.c" break; case 140: +// 916 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2623 "parser.php5.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php5.lemon" { @@ -159447,19 +129544,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2774 "parser.php5.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -159485,56 +129583,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -159554,40 +129652,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -159597,32 +129695,33 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php7.lemon" +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -159633,58 +129732,58 @@ static void phvolt_( #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval yy146; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval vv146; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -159694,46 +129793,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -159966,7 +130065,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -160199,8 +130298,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -160237,8 +130336,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -160275,7 +130374,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -160312,7 +130411,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -160324,10 +130423,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -160341,43 +130440,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -160415,7 +130514,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -160573,8 +130672,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -160584,21 +130683,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -160693,14 +130792,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 146 "parser.php7.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php7.c" break; case 88: case 89: @@ -160736,134 +130837,136 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 163 "parser.php7.lemon" { - zval_ptr_dtor(&(yypminor->yy146)); + zval_ptr_dtor(&(vvpminor->vv146)); } +// 1173 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -160872,9 +130975,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -161029,40 +131132,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 155 "parser.php7.lemon" { - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy146, 1, 1); + ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); } +// 1542 "parser.php7.c" break; case 1: case 4: @@ -161086,881 +131191,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 159 "parser.php7.lemon" { - yygotominor.yy146 = yymsp[0].minor.yy146; + vvgotominor.vv146 = vvmsp[0].minor.vv146; } +// 1570 "parser.php7.c" break; case 2: +// 167 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-1].minor.yy146, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); } +// 1577 "parser.php7.c" break; case 3: case 37: case 49: case 135: case 142: +// 171 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); } +// 1588 "parser.php7.c" break; case 24: +// 263 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1601 "parser.php7.c" break; case 25: +// 267 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1614 "parser.php7.c" break; case 26: +// 271 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-9].minor.yy146, &yymsp[-7].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1630 "parser.php7.c" break; case 27: +// 275 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1646 "parser.php7.c" break; case 28: +// 279 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-7].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1662 "parser.php7.c" break; case 29: +// 287 "parser.php7.lemon" { - phvolt_ret_elseif_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1672 "parser.php7.c" break; case 30: +// 295 "parser.php7.lemon" { - phvolt_ret_elsefor_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1682 "parser.php7.c" break; case 31: +// 303 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1696 "parser.php7.c" break; case 32: +// 307 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, NULL, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1711 "parser.php7.c" break; case 33: +// 311 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1726 "parser.php7.c" break; case 34: +// 315 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1742 "parser.php7.c" break; case 35: +// 323 "parser.php7.lemon" { - phvolt_ret_set_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1752 "parser.php7.c" break; case 36: case 48: case 134: case 141: +// 331 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146); - yy_destructor(2,&yymsp[-1].minor); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); + vv_destructor(2,&vvmsp[-1].minor); } +// 1763 "parser.php7.c" break; case 38: +// 343 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1771 "parser.php7.c" break; case 39: +// 347 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ADD_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1779 "parser.php7.c" break; case 40: +// 351 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_SUB_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1787 "parser.php7.c" break; case 41: +// 355 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_MUL_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1795 "parser.php7.c" break; case 42: +// 359 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_DIV_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1803 "parser.php7.c" break; case 43: case 67: case 133: case 145: +// 363 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1813 "parser.php7.c" break; case 44: case 127: +// 367 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAYACCESS, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1823 "parser.php7.c" break; case 45: case 116: +// 371 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DOT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1832 "parser.php7.c" break; case 46: +// 379 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1847 "parser.php7.c" break; case 47: +// 383 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-8].minor.yy0, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1862 "parser.php7.c" break; case 50: +// 403 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[0].minor.yy0, NULL, status->scanner_state); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1869 "parser.php7.c" break; case 51: +// 407 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1877 "parser.php7.c" break; case 52: case 66: case 132: case 146: +// 411 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1887 "parser.php7.c" break; case 53: case 147: +// 415 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1895 "parser.php7.c" break; case 54: case 148: +// 419 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1903 "parser.php7.c" break; case 55: case 149: +// 423 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1912 "parser.php7.c" break; case 56: case 150: +// 427 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1921 "parser.php7.c" break; case 57: case 151: +// 431 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1930 "parser.php7.c" break; case 58: +// 439 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1945 "parser.php7.c" break; case 59: +// 443 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1960 "parser.php7.c" break; case 60: +// 451 "parser.php7.lemon" { - phvolt_ret_empty_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1969 "parser.php7.c" break; case 61: +// 459 "parser.php7.lemon" { - phvolt_ret_echo_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1978 "parser.php7.c" break; case 62: +// 467 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-5].minor.yy0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1991 "parser.php7.c" break; case 63: +// 471 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2004 "parser.php7.c" break; case 64: +// 479 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2017 "parser.php7.c" break; case 65: +// 483 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2030 "parser.php7.c" break; case 68: +// 503 "parser.php7.lemon" { - phvolt_ret_raw_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2043 "parser.php7.c" break; case 69: +// 511 "parser.php7.lemon" { - phvolt_ret_extends_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2053 "parser.php7.c" break; case 70: +// 519 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2063 "parser.php7.c" break; case 71: +// 523 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2074 "parser.php7.c" break; case 72: +// 531 "parser.php7.lemon" { - phvolt_ret_do_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2084 "parser.php7.c" break; case 73: +// 539 "parser.php7.lemon" { - phvolt_ret_return_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2094 "parser.php7.c" break; case 74: +// 547 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2108 "parser.php7.c" break; case 75: +// 551 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 1, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2122 "parser.php7.c" break; case 76: +// 559 "parser.php7.lemon" { - phvolt_ret_break_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2132 "parser.php7.c" break; case 77: +// 567 "parser.php7.lemon" { - phvolt_ret_continue_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2142 "parser.php7.c" break; case 78: +// 575 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2149 "parser.php7.c" break; case 79: +// 583 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MINUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2157 "parser.php7.c" break; case 80: +// 587 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PLUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2165 "parser.php7.c" break; case 81: +// 591 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_SUB, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2173 "parser.php7.c" break; case 82: +// 595 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ADD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2181 "parser.php7.c" break; case 83: +// 599 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MUL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2189 "parser.php7.c" break; case 84: +// 603 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_POW, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2198 "parser.php7.c" break; case 85: +// 607 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DIV, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2206 "parser.php7.c" break; case 86: +// 611 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2215 "parser.php7.c" break; case 87: +// 615 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2223 "parser.php7.c" break; case 88: +// 619 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_AND, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2231 "parser.php7.c" break; case 89: +// 623 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_OR, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2239 "parser.php7.c" break; case 90: +// 627 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_CONCAT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2247 "parser.php7.c" break; case 91: +// 631 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PIPE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2255 "parser.php7.c" break; case 92: +// 635 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_RANGE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2263 "parser.php7.c" break; case 93: +// 639 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_EQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2271 "parser.php7.c" break; case 94: +// 643 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2280 "parser.php7.c" break; case 95: +// 647 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2289 "parser.php7.c" break; case 96: +// 651 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2298 "parser.php7.c" break; case 97: +// 655 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2307 "parser.php7.c" break; case 98: +// 659 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2316 "parser.php7.c" break; case 99: +// 663 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2325 "parser.php7.c" break; case 100: +// 667 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2334 "parser.php7.c" break; case 101: +// 671 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2343 "parser.php7.c" break; case 102: +// 675 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2352 "parser.php7.c" break; case 103: +// 679 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2361 "parser.php7.c" break; case 104: +// 683 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2370 "parser.php7.c" break; case 105: +// 687 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2379 "parser.php7.c" break; case 106: +// 691 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2388 "parser.php7.c" break; case 107: +// 695 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2397 "parser.php7.c" break; case 108: +// 699 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2405 "parser.php7.c" break; case 109: +// 703 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTEQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2413 "parser.php7.c" break; case 110: +// 707 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2421 "parser.php7.c" break; case 111: +// 711 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTIDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2429 "parser.php7.c" break; case 112: +// 715 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2437 "parser.php7.c" break; case 113: +// 719 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATER, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2445 "parser.php7.c" break; case 114: +// 723 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATEREQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2453 "parser.php7.c" break; case 115: +// 727 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESSEQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2461 "parser.php7.c" break; case 117: +// 735 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IN, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2469 "parser.php7.c" break; case 118: +// 739 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_IN, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2478 "parser.php7.c" break; case 119: +// 743 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2486 "parser.php7.c" break; case 120: +// 747 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_INCR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2494 "parser.php7.c" break; case 121: +// 751 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DECR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2502 "parser.php7.c" break; case 122: +// 755 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ENCLOSED, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2511 "parser.php7.c" break; case 123: +// 759 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2520 "parser.php7.c" break; case 124: +// 763 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2529 "parser.php7.c" break; case 125: +// 767 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2538 "parser.php7.c" break; case 126: +// 771 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2547 "parser.php7.c" break; case 128: +// 779 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_TERNARY, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, &yymsp[-4].minor.yy146, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2556 "parser.php7.c" break; case 129: +// 783 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2566 "parser.php7.c" break; case 130: +// 787 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2576 "parser.php7.c" break; case 131: +// 791 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2586 "parser.php7.c" break; case 136: case 144: +// 823 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2595 "parser.php7.c" break; case 137: case 143: +// 827 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146, status->scanner_state); + phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); } +// 2603 "parser.php7.c" break; case 139: +// 839 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2612 "parser.php7.c" break; case 140: +// 843 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2621 "parser.php7.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php7.lemon" { @@ -162060,19 +132382,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2763 "parser.php7.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -162098,56 +132421,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -162167,40 +132490,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -162210,23 +132533,783 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } +#endif + + +const phvolt_token_names phvolt_tokens[] = +{ + { SL("INTEGER"), PHVOLT_T_INTEGER }, + { SL("DOUBLE"), PHVOLT_T_DOUBLE }, + { SL("STRING"), PHVOLT_T_STRING }, + { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, + { SL("MINUS"), PHVOLT_T_MINUS }, + { SL("+"), PHVOLT_T_ADD }, + { SL("-"), PHVOLT_T_SUB }, + { SL("*"), PHVOLT_T_MUL }, + { SL("/"), PHVOLT_T_DIV }, + { SL("%%"), PHVOLT_T_MOD }, + { SL("!"), PHVOLT_T_NOT }, + { SL("~"), PHVOLT_T_CONCAT }, + { SL("AND"), PHVOLT_T_AND }, + { SL("OR"), PHVOLT_T_OR }, + { SL("DOT"), PHVOLT_T_DOT }, + { SL("COMMA"), PHVOLT_T_COMMA }, + { SL("EQUALS"), PHVOLT_T_EQUALS }, + { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, + { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, + { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, + { SL("NOT"), PHVOLT_T_NOT }, + { SL("RANGE"), PHVOLT_T_RANGE }, + { SL("COLON"), PHVOLT_T_COLON }, + { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, + { SL("<"), PHVOLT_T_LESS }, + { SL("<="), PHVOLT_T_LESSEQUAL }, + { SL(">"), PHVOLT_T_GREATER }, + { SL(">="), PHVOLT_T_GREATEREQUAL }, + { SL("("), PHVOLT_T_PARENTHESES_OPEN }, + { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, + { SL("["), PHVOLT_T_SBRACKET_OPEN }, + { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, + { SL("{"), PHVOLT_T_CBRACKET_OPEN }, + { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, + { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, + { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, + { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, + { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, + { SL("IF"), PHVOLT_T_IF }, + { SL("ELSE"), PHVOLT_T_ELSE }, + { SL("ELSEIF"), PHVOLT_T_ELSEIF }, + { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, + { SL("ENDIF"), PHVOLT_T_ENDIF }, + { SL("FOR"), PHVOLT_T_FOR }, + { SL("IN"), PHVOLT_T_IN }, + { SL("ENDFOR"), PHVOLT_T_ENDFOR }, + { SL("SET"), PHVOLT_T_SET }, + { SL("ASSIGN"), PHVOLT_T_ASSIGN }, + { SL("+="), PHVOLT_T_ADD_ASSIGN }, + { SL("-="), PHVOLT_T_SUB_ASSIGN }, + { SL("*="), PHVOLT_T_MUL_ASSIGN }, + { SL("/="), PHVOLT_T_DIV_ASSIGN }, + { SL("++"), PHVOLT_T_INCR }, + { SL("--"), PHVOLT_T_DECR }, + { SL("BLOCK"), PHVOLT_T_BLOCK }, + { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, + { SL("CACHE"), PHVOLT_T_CACHE }, + { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, + { SL("EXTENDS"), PHVOLT_T_EXTENDS }, + { SL("IS"), PHVOLT_T_IS }, + { SL("DEFINED"), PHVOLT_T_DEFINED }, + { SL("EMPTY"), PHVOLT_T_EMPTY }, + { SL("EVEN"), PHVOLT_T_EVEN }, + { SL("ODD"), PHVOLT_T_ODD }, + { SL("NUMERIC"), PHVOLT_T_NUMERIC }, + { SL("SCALAR"), PHVOLT_T_SCALAR }, + { SL("ITERABLE"), PHVOLT_T_ITERABLE }, + { SL("INCLUDE"), PHVOLT_T_INCLUDE }, + { SL("DO"), PHVOLT_T_DO }, + { SL("WHITESPACE"), PHVOLT_T_IGNORE }, + { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, + { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, + { SL("CONTINUE"), PHVOLT_T_CONTINUE }, + { SL("BREAK"), PHVOLT_T_BREAK }, + { SL("WITH"), PHVOLT_T_WITH }, + { SL("RETURN"), PHVOLT_T_RETURN }, + { SL("MACRO"), PHVOLT_T_MACRO }, + { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, + { SL("CALL"), PHVOLT_T_CALL }, + { SL("WITH"), PHVOLT_T_WITH }, + { NULL, 0, 0 } +}; + +static void *phvolt_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} + +static void phvolt_wrapper_free(void *pointer){ + efree(pointer); +} + +static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + + phvolt_parser_token *pToken; + + pToken = emalloc(sizeof(phvolt_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; + + phvolt_(phvolt_parser, parsercode, pToken, parser_status); + + token->value = NULL; + token->len = 0; +} + +static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + + unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); + char *str = emalloc(sizeof(char) * length); + + snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); + str[length - 1] = '\0'; + + parser_status->syntax_error = estrndup(str, strlen(str)); + efree(str); +} + +static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + + char *error, *error_part; + int length; + phvolt_scanner_state *state = parser_status->scanner_state; + +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); +#else + ZVAL_NULL(*error_msg); +#endif + + if (state->start) { + error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); + if (state->start_length > 16) { + length = 72 + Z_STRLEN_P(state->active_file); + error_part = estrndup(state->start, 16); + snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); + error[length - 1] = '\0'; + efree(error_part); + } else { + length = 48 + state->start_length + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + } + } else { + error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); + length = 32 + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + } + + error[length - 1] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRING(*error_msg, error, 1); +#else + ZVAL_STRING(*error_msg, error); +#endif + + efree(error); +} + +static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ + +#if PHP_VERSION_ID < 70000 + zval *error_msg = NULL; +#else + zval em, *error_msg = &em; +#endif + + ZVAL_NULL(result); + +#if PHP_VERSION_ID >= 70000 + ZVAL_NULL(error_msg); +#endif + + if (Z_TYPE_P(view_code) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); + return FAILURE; + } + + if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); +#if PHP_VERSION_ID < 70000 + zval_ptr_dtor(&error_msg); +#else + zval_dtor(error_msg); +#endif + return FAILURE; + } + + return SUCCESS; +} + +static int phvolt_is_blank_string(phvolt_scanner_token *token){ + + char *marker = token->value; + unsigned int ch, i; + + for (i = 0; i < token->len; i++) { + ch = *marker; + if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { + return 0; + } + marker++; + } + + return 1; +} + +static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { + + char *error; + phvolt_scanner_state *state; + phvolt_scanner_token token; + int scanner_status, status = SUCCESS; + phvolt_parser_status *parser_status = NULL; + void* phvolt_parser; + + /** Check if the view has code */ + if (!Z_STRVAL_P(view_code)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "View code cannot be null", 1); +#else + ZVAL_STRING(*error_msg, "View code cannot be null"); +#endif + return FAILURE; + } + + if (!Z_STRLEN_P(view_code)) { + array_init(*result); + return SUCCESS; + } + + /** Start the reentrant parser */ + phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); + if (unlikely(!phvolt_parser)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "Memory allocation error", 1); +#else + ZVAL_STRING(*error_msg, "Memory allocation error"); +#endif + return FAILURE; + } + + parser_status = emalloc(sizeof(phvolt_parser_status)); + state = emalloc(sizeof(phvolt_scanner_state)); + + parser_status->status = PHVOLT_PARSING_OK; + parser_status->scanner_state = state; +#if PHP_VERSION_ID < 70000 + parser_status->ret = NULL; +#else + ZVAL_UNDEF(&parser_status->ret); +#endif + parser_status->token = &token; + parser_status->syntax_error = NULL; + + /** Initialize the scanner state */ + state->active_token = 0; + state->start = Z_STRVAL_P(view_code); + state->mode = PHVOLT_MODE_RAW; + state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); + state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; + state->raw_buffer_cursor = 0; + state->active_file = template_path; + state->active_line = 1; + state->statement_position = 0; + state->extends_mode = 0; + state->block_level = 0; + state->macro_level = 0; + state->start_length = 0; + state->old_if_level = 0; + state->if_level = 0; + state->for_level = 0; + state->whitespace_control = 0; + state->forced_raw_state = 0; + + state->end = state->start; + + token.value = NULL; + token.len = 0; + + while (0 <= (scanner_status = phvolt_get_token(state, &token))) { + + state->active_token = token.opcode; + + state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); + + switch (token.opcode) { + + case PHVOLT_T_IGNORE: + break; + + case PHVOLT_T_ADD: + phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); + break; + case PHVOLT_T_SUB: + phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); + break; + case PHVOLT_T_MUL: + phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); + break; + case PHVOLT_T_DIV: + phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); + break; + case PHVOLT_T_MOD: + phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); + break; + case PHVOLT_T_AND: + phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); + break; + case PHVOLT_T_OR: + phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); + break; + case PHVOLT_T_IS: + phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); + break; + case PHVOLT_T_EQUALS: + phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); + break; + case PHVOLT_T_NOTEQUALS: + phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); + break; + case PHVOLT_T_LESS: + phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); + break; + case PHVOLT_T_GREATER: + phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); + break; + case PHVOLT_T_GREATEREQUAL: + phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); + break; + case PHVOLT_T_LESSEQUAL: + phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); + break; + case PHVOLT_T_IDENTICAL: + phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOTIDENTICAL: + phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOT: + phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); + break; + case PHVOLT_T_DOT: + phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); + break; + case PHVOLT_T_CONCAT: + phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); + break; + case PHVOLT_T_RANGE: + phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); + break; + case PHVOLT_T_PIPE: + phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); + break; + case PHVOLT_T_COMMA: + phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); + break; + case PHVOLT_T_COLON: + phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); + break; + case PHVOLT_T_QUESTION: + phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); + break; + + case PHVOLT_T_PARENTHESES_OPEN: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); + break; + case PHVOLT_T_PARENTHESES_CLOSE: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_EDELIMITER: + if (state->extends_mode == 1 && state->block_level == 0) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_EDELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_NULL: + phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); + break; + case PHVOLT_T_TRUE: + phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); + break; + case PHVOLT_T_FALSE: + phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); + break; + + case PHVOLT_T_INTEGER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); + break; + case PHVOLT_T_DOUBLE: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); + break; + case PHVOLT_T_STRING: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); + break; + case PHVOLT_T_IDENTIFIER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); + break; + + case PHVOLT_T_IF: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->if_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); + break; + + case PHVOLT_T_ELSE: + if (state->if_level == 0 && state->for_level > 0) { + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + } else { + phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + } + break; + + case PHVOLT_T_ELSEFOR: + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + break; + + case PHVOLT_T_ELSEIF: + if (state->if_level == 0) { + phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); + break; + + case PHVOLT_T_ENDIF: + state->block_level--; + state->if_level--; + phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); + break; + + case PHVOLT_T_FOR: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->old_if_level = state->if_level; + state->if_level = 0; + state->for_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); + break; + + case PHVOLT_T_IN: + phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); + break; + + case PHVOLT_T_ENDFOR: + state->block_level--; + state->for_level--; + state->if_level = state->old_if_level; + phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); + break; + + case PHVOLT_T_RAW_FRAGMENT: + if (token.len > 0) { + if (state->extends_mode == 1 && state->block_level == 0){ + if (!phvolt_is_blank_string(&token)) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + } + efree(token.value); + break; + } else { + if (!phvolt_is_blank_string(&token)) { + state->statement_position++; + } + } + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } else { + efree(token.value); + } + break; + + case PHVOLT_T_SET: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); + break; + case PHVOLT_T_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_ADD_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_SUB_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_MUL_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_DIV_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); + break; + + case PHVOLT_T_INCR: + phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); + break; + case PHVOLT_T_DECR: + phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); + break; + + case PHVOLT_T_BLOCK: + if (state->block_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); + break; + case PHVOLT_T_ENDBLOCK: + state->block_level--; + phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); + break; + + case PHVOLT_T_MACRO: + if (state->macro_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->macro_level++; + } + phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); + break; + case PHVOLT_T_ENDMACRO: + state->macro_level--; + phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); + break; + + case PHVOLT_T_CALL: + phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); + break; + case PHVOLT_T_ENDCALL: + phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); + break; + + case PHVOLT_T_CACHE: + phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); + break; + case PHVOLT_T_ENDCACHE: + phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); + break; + + case PHVOLT_T_RAW: + phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); + state->forced_raw_state++; + break; + case PHVOLT_T_ENDRAW: + phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); + state->forced_raw_state--; + break; + + case PHVOLT_T_INCLUDE: + phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); + break; + + case PHVOLT_T_WITH: + phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); + break; + + case PHVOLT_T_DEFINED: + phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); + break; + + case PHVOLT_T_EMPTY: + phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); + break; + + case PHVOLT_T_EVEN: + phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); + break; + + case PHVOLT_T_ODD: + phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); + break; + + case PHVOLT_T_NUMERIC: + phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); + break; + + case PHVOLT_T_SCALAR: + phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); + break; + + case PHVOLT_T_ITERABLE: + phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); + break; + + case PHVOLT_T_DO: + phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); + break; + case PHVOLT_T_RETURN: + phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); + break; + + case PHVOLT_T_AUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_ENDAUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_BREAK: + phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); + break; + + case PHVOLT_T_CONTINUE: + phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); + break; + + case PHVOLT_T_EXTENDS: + if (state->statement_position != 1) { + phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->extends_mode = 1; + } + phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); + break; + + default: + parser_status->status = PHVOLT_PARSING_FAILED; + error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); + snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, error, 1); + } +#else + if (Z_TYPE_P(*error_msg) == IS_NULL) { + ZVAL_STRING((*error_msg), error); + } +#endif + efree(error); + break; + } + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + break; + } + + state->end = state->start; + } + + if (status != FAILURE) { + switch (scanner_status) { + case PHVOLT_SCANNER_RETCODE_ERR: + case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: + if (!*error_msg) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } else { + if (Z_TYPE_P(*error_msg) == IS_NULL) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } + } + status = FAILURE; + break; + default: + phvolt_(phvolt_parser, 0, NULL, parser_status); + } + } + + state->active_token = 0; + state->start = NULL; + efree(state->raw_buffer); + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + if (parser_status->syntax_error) { +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); + } +#else + ZVAL_STRING(*error_msg, parser_status->syntax_error); +#endif + efree(parser_status->syntax_error); + } + } + + phvolt_Free(phvolt_parser, phvolt_wrapper_free); + + if (status != FAILURE) { + if (parser_status->status == PHVOLT_PARSING_OK) { +#if PHP_VERSION_ID < 70000 + if (parser_status->ret) { + ZVAL_ZVAL(*result, parser_status->ret, 0, 0); + ZVAL_NULL(parser_status->ret); + zval_ptr_dtor(&parser_status->ret); + } else { + array_init(*result); + } +#else + if (Z_TYPE(parser_status->ret) != IS_UNDEF) { + ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); + } else { + array_init(*result); + } +#endif + } + } + + efree(parser_status); + efree(state); + + return status; +} /* Generated by re2c 0.13.6 on Sun May 1 19:16:49 2016 */ @@ -167934,7 +139017,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { number = zephir_fast_count_int(items TSRMLS_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, show); - ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 322, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 287, &_2); zephir_check_call_status(); roundedTotal = zephir_safe_div_long_zval(number, _3 TSRMLS_CC); totalPages = (int) (roundedTotal); @@ -167945,7 +139028,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { ZVAL_LONG(&_2, (show * ((pageNumber - 1)))); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, show); - ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 396, items, &_2, &_4); + ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 361, items, &_2, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(items, _5); if (pageNumber < totalPages) { @@ -168291,7 +139374,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_4$$4); ZEPHIR_MAKE_REF(_3$$4); ZEPHIR_MAKE_REF(_4$$4); - ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 407, _1$$4, _2$$4, _3$$4, _4$$4); + ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 372, _1$$4, _2$$4, _3$$4, _4$$4); ZEPHIR_UNREF(_3$$4); ZEPHIR_UNREF(_4$$4); zephir_check_call_status(); @@ -168304,7 +139387,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_8$$5); ZEPHIR_MAKE_REF(_7$$5); ZEPHIR_MAKE_REF(_8$$5); - ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 408, _5$$5, _6$$5, _7$$5, _8$$5); + ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 373, _5$$5, _6$$5, _7$$5, _8$$5); ZEPHIR_UNREF(_7$$5); ZEPHIR_UNREF(_8$$5); zephir_check_call_status(); @@ -168315,7 +139398,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { } ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, -1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 409, connection, &_9, ZEPHIR_GLOBAL(global_null)); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 374, connection, &_9, ZEPHIR_GLOBAL(global_null)); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC); RETURN_CCTOR(connection); @@ -168363,7 +139446,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, put) { ZEPHIR_CONCAT_SVSVSVSVSV(_0, "put ", priority, " ", delay, " ", ttr, " ", length, "\r\n", serialized); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 190 TSRMLS_CC); _1 = !ZEPHIR_IS_STRING(status, "INSERTED"); @@ -168400,7 +139483,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { } ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, command); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_0, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 215 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_0, "RESERVED")) { @@ -168413,7 +139496,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_4, "unserialize", NULL, 66, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _1, _4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _1, _4); zephir_check_call_status(); RETURN_MM(); @@ -168444,7 +139527,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, choose) { ZEPHIR_CONCAT_SV(_0, "use ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 238 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168480,7 +139563,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, watch) { ZEPHIR_CONCAT_SV(_0, "watch ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 255 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168517,7 +139600,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, ignore) { ZEPHIR_CONCAT_SV(_0, "ignore ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 272 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168557,7 +139640,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, pauseTube) { ZEPHIR_CONCAT_SVSV(_1, "pause-tube ", tube, " ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 289 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "PAUSED")) { @@ -168585,7 +139668,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, kick) { ZEPHIR_CONCAT_SV(_1, "kick ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 306 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "KICKED")) { @@ -168609,7 +139692,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, stats) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 323 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168645,7 +139728,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, statsTube) { ZEPHIR_CONCAT_SV(_0, "stats-tube ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 340 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168668,7 +139751,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubes) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 357 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168691,7 +139774,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubeUsed) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 374 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168714,7 +139797,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubesWatched) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 391 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168737,7 +139820,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 408 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168750,7 +139833,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168768,7 +139851,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 425 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168781,7 +139864,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168802,7 +139885,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 444 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168815,7 +139898,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168839,7 +139922,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { ZEPHIR_CONCAT_SV(_1, "peek ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 462 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168852,7 +139935,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168883,7 +139966,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); ZEPHIR_OBS_VAR(status); zephir_array_fetch_long(&status, response, 0, PH_NOISY, "phalcon/queue/beanstalk.zep", 491 TSRMLS_CC); @@ -168892,7 +139975,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { zephir_array_fetch_long(&numberOfBytes, response, 1, PH_NOISY, "phalcon/queue/beanstalk.zep", 494 TSRMLS_CC); ZEPHIR_CALL_METHOD(&response, this_ptr, "read", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 413, response); + ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 378, response); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(numberOfBytes); @@ -168939,13 +140022,13 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { } ZEPHIR_SINIT_VAR(_0$$5); ZVAL_LONG(&_0$$5, (length + 2)); - ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 414, connection, &_0$$5); + ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 379, connection, &_0$$5); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$5); ZVAL_STRING(&_0$$5, "\r\n", 0); ZEPHIR_INIT_VAR(data); zephir_fast_trim(data, _1$$5, &_0$$5, ZEPHIR_TRIM_RIGHT TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 415, connection); + ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 380, connection); zephir_check_call_status(); zephir_array_fetch_string(&_4$$5, _3$$5, SL("timed_out"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 535 TSRMLS_CC); if (zephir_is_true(_4$$5)) { @@ -168957,7 +140040,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { ZVAL_LONG(&_5$$8, 16384); ZEPHIR_SINIT_VAR(_6$$8); ZVAL_STRING(&_6$$8, "\r\n", 0); - ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 414, connection, &_5$$8, &_6$$8); + ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 379, connection, &_5$$8, &_6$$8); zephir_check_call_status(); } if (ZEPHIR_IS_STRING_IDENTICAL(data, "UNKNOWN_COMMAND")) { @@ -169006,7 +140089,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, write) { ZEPHIR_CPY_WRT(packet, _0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, zephir_fast_strlen_ev(packet)); - ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 416, connection, packet, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 381, connection, packet, &_1); zephir_check_call_status(); RETURN_MM(); @@ -169355,7 +140438,7 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { if ((zephir_function_exists_ex(SS("random_bytes") TSRMLS_CC) == SUCCESS)) { ZEPHIR_SINIT_VAR(_0$$4); ZVAL_LONG(&_0$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 427, &_0$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 392, &_0$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169380,16 +140463,16 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { ZVAL_STRING(&_4$$7, "/dev/urandom", 0); ZEPHIR_SINIT_VAR(_5$$7); ZVAL_STRING(&_5$$7, "rb", 0); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 298, &_4$$7, &_5$$7); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 263, &_4$$7, &_5$$7); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(handle)) { ZEPHIR_SINIT_VAR(_6$$8); ZVAL_LONG(&_6$$8, 0); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 428, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 393, handle, &_6$$8); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_6$$8); ZVAL_LONG(&_6$$8, len); - ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 429, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 394, handle, &_6$$8); zephir_check_call_status(); zephir_fclose(handle TSRMLS_CC); if (zephir_fast_strlen_ev(ret) != len) { @@ -169425,7 +140508,7 @@ static PHP_METHOD(Phalcon_Security_Random, hex) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_MAKE_REF(_3); ZEPHIR_RETURN_CALL_FUNCTION("array_shift", NULL, 132, _3); @@ -169462,7 +140545,7 @@ static PHP_METHOD(Phalcon_Security_Random, base58) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "C*", 0); - ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 430, &_1, _0); + ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 395, &_1, _0); zephir_check_call_status(); zephir_is_iterable(bytes, &_3, &_2, 0, 0, "phalcon/security/random.zep", 205); for ( @@ -169576,7 +140659,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "N1a/n1b/n1c/n1d/n1e/N1f", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&ary, "array_values", NULL, 224, _3); zephir_check_call_status(); @@ -169591,7 +140674,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "%08x-%04x-%04x-%04x-%04x%08x", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_MAKE_REF(ary); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, ary, _7); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, ary, _7); zephir_check_temp_parameter(_7); ZEPHIR_UNREF(ary); zephir_check_call_status(); @@ -169628,7 +140711,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_0$$4, 0); ZEPHIR_SINIT_VAR(_1$$4); ZVAL_LONG(&_1$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 431, &_0$$4, &_1$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 396, &_0$$4, &_1$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169641,7 +140724,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, len); - ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 432, &_4); + ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 397, &_4); zephir_check_call_status(); if (((zephir_fast_strlen_ev(hex) & 1)) == 1) { ZEPHIR_INIT_VAR(_5$$6); @@ -169650,7 +140733,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 433, &_4, hex); + ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 398, &_4, hex); zephir_check_call_status(); zephir_concat_self(&bin, _6 TSRMLS_CC); _7 = ZEPHIR_STRING_OFFSET(bin, 0); @@ -169688,19 +140771,19 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_19$$7, 0); ZEPHIR_SINIT_NVAR(_20$$7); ZVAL_LONG(&_20$$7, 1); - ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 434, rnd, _16$$7, &_19$$7, &_20$$7); + ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 399, rnd, _16$$7, &_19$$7, &_20$$7); zephir_check_call_status(); ZEPHIR_CPY_WRT(rnd, _21$$7); } while (ZEPHIR_LT(bin, rnd)); ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 430, &_4, rnd); + ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 395, &_4, rnd); zephir_check_call_status(); ZEPHIR_MAKE_REF(ret); ZEPHIR_CALL_FUNCTION(&_23, "array_shift", NULL, 132, ret); ZEPHIR_UNREF(ret); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 435, _23); + ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 400, _23); zephir_check_call_status(); RETURN_MM(); @@ -170667,7 +141750,7 @@ static PHP_METHOD(Phalcon_Session_Bag, getIterator) { } object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 439, _1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 404, _1); zephir_check_call_status(); RETURN_MM(); @@ -170919,7 +142002,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { } ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2592000); - ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 436, lifetime, _0); + ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 401, lifetime, _0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_lifetime"), _1 TSRMLS_CC); ZEPHIR_OBS_VAR(prefix); @@ -170946,7 +142029,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); ZEPHIR_INIT_VAR(_5); zephir_create_array(_5, 5, 0 TSRMLS_CC); @@ -170955,7 +142038,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { zephir_array_update_string(&_5, SL("prefix"), &prefix, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("statsKey"), &statsKey, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("persistent_id"), &persistentId, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 335, _2, _5); + ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 300, _2, _5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_libmemcached"), _0 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -170994,9 +142077,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171205,9 +142288,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_OBS_VAR(_6); zephir_read_property_this(&_6, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_5, SL("lifetime"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 334, _5); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 299, _5); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 337, _4, options); + ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 302, _4, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _3 TSRMLS_CC); ZEPHIR_INIT_VAR(_7); @@ -171246,9 +142329,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "gc", 1); zephir_array_fast_append(_13, _8); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _7, _9, _10, _11, _12, _13); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _7, _9, _10, _11, _12, _13); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171444,7 +142527,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 0, _4); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 338, _3, options); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 303, _3, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _2 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -171483,9 +142566,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171738,7 +142821,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_10$$24, "PHP_EOL"); ZEPHIR_INIT_VAR(_11$$24); ZEPHIR_CONCAT_SV(_11$$24, "", _10$$24); - ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 443, options, using, value, _11$$24); + ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 408, options, using, value, _11$$24); zephir_check_call_status(); zephir_concat_self(&code, _8$$24 TSRMLS_CC); } else { @@ -171747,7 +142830,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_14$$26, "PHP_EOL"); ZEPHIR_INIT_VAR(_15$$26); ZEPHIR_CONCAT_SV(_15$$26, "", _14$$26); - ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 444, options, value, _15$$26); + ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 409, options, value, _15$$26); zephir_check_call_status(); zephir_concat_self(&code, _12$$26 TSRMLS_CC); } else { @@ -171787,7 +142870,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromResultset) { ZEPHIR_OBS_VAR(usingOne); zephir_array_fetch_long(&usingOne, using, 1, PH_NOISY, "phalcon/tag/select.zep", 168 TSRMLS_CC); } - ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 445); + ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 410); zephir_check_call_status(); ZEPHIR_CPY_WRT(escaper, _0); _2 = zephir_get_iterator(resultset TSRMLS_CC); @@ -171900,7 +142983,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromArray) { if (Z_TYPE_P(optionText) == IS_ARRAY) { ZEPHIR_INIT_NVAR(_4$$4); ZEPHIR_GET_CONSTANT(_4$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 444, optionText, value, closeOption); + ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 409, optionText, value, closeOption); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_7$$4); ZEPHIR_GET_CONSTANT(_7$$4, "PHP_EOL"); @@ -172271,7 +143354,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); if (!(zephir_array_isset_string(options, SS("content")))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_translate_exception_ce, "Parameter 'content' is required", "phalcon/translate/adapter/csv.zep", 42); @@ -172284,7 +143367,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { ZVAL_STRING(_3, ";", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "\"", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 455, _1, _2, _3, _4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 420, _1, _2, _3, _4); zephir_check_temp_parameter(_3); zephir_check_temp_parameter(_4); zephir_check_call_status(); @@ -172306,7 +143389,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rb", 0); - ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 298, file, &_0); + ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 263, file, &_0); zephir_check_call_status(); if (Z_TYPE_P(fileHandler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_1$$3); @@ -172320,7 +143403,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { return; } while (1) { - ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 456, fileHandler, length, delimiter, enclosure); + ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 421, fileHandler, length, delimiter, enclosure); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(data)) { break; @@ -172538,7 +143621,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, query) { } - ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 457, index); + ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 0, index); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); zephir_check_call_status(); @@ -172576,7 +143659,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, exists) { static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { int count, ZEPHIR_LAST_CALL_STATUS; - zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, _0$$3, _1$$4; + zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, *_0$$3, *_1$$4; zval *msgid1 = NULL, *msgid2 = NULL, *domain = NULL; ZEPHIR_MM_GROW(); @@ -172628,14 +143711,14 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { if (!(!(!domain) && Z_STRLEN_P(domain))) { - ZEPHIR_SINIT_VAR(_0$$3); - ZVAL_LONG(&_0$$3, count); - ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 458, msgid1, msgid2, &_0$$3); + ZEPHIR_INIT_VAR(_0$$3); + ZVAL_LONG(_0$$3, count); + ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 0, msgid1, msgid2, _0$$3); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_LONG(&_1$$4, count); - ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 459, domain, msgid1, msgid2, &_1$$4); + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_LONG(_1$$4, count); + ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 0, domain, msgid1, msgid2, _1$$4); zephir_check_call_status(); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); @@ -172654,7 +143737,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDomain) { - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, domain); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, domain); zephir_check_call_status(); RETURN_MM(); @@ -172669,7 +143752,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, resetDomain) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, _0); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, _0); zephir_check_call_status(); RETURN_MM(); @@ -172705,8 +143788,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { HashTable *_1$$4; HashPosition _0$$4; int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_3 = NULL; - zval *directory, *key = NULL, *value = NULL, **_2$$4, *_4$$6 = NULL; + zval *directory, *key = NULL, *value = NULL, **_2$$4, *_3$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &directory); @@ -172725,13 +143807,13 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { ) { ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, key, value); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, key, value); zephir_check_call_status(); } } else { - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getdefaultdomain", NULL, 0); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, _4$$6, directory); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, _3$$6, directory); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -172779,21 +143861,21 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setLocale) { _3 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_4); ZEPHIR_CONCAT_SV(_4, "LC_ALL=", _3); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _4); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _4); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SV(_7, "LANG=", _6); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _7); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _7); zephir_check_call_status(); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SV(_9, "LANGUAGE=", _8); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _9); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _9); zephir_check_call_status(); _10 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 6); + ZVAL_LONG(&_11, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", NULL, 442, &_11, _10); zephir_check_call_status(); RETURN_MM_MEMBER(this_ptr, "_locale"); @@ -172847,7 +143929,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, getOptionsDefault) { zephir_create_array(return_value, 2, 0 TSRMLS_CC); - add_assoc_long_ex(return_value, SS("category"), 6); + add_assoc_long_ex(return_value, SS("category"), 0); add_assoc_stringl_ex(return_value, SS("defaultDomain"), SL("messages"), 1); return; @@ -172887,7 +143969,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(data); if (!(zephir_array_isset_string_fetch(&data, options, SS("content"), 0 TSRMLS_CC))) { @@ -173081,7 +144163,7 @@ static PHP_METHOD(Phalcon_Translate_Interpolator_IndexedArray, replacePlaceholde } if (_0) { ZEPHIR_MAKE_REF(placeholders); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, placeholders, translation); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, placeholders, translation); ZEPHIR_UNREF(placeholders); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1$$3); @@ -173338,7 +144420,7 @@ static PHP_METHOD(Phalcon_Validation_Message, __set_state) { zephir_array_fetch_string(&_0, message, SL("_message"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_1, message, SL("_field"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_2, message, SL("_type"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 465, _0, _1, _2); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 460, _0, _1, _2); zephir_check_call_status(); RETURN_MM(); @@ -173691,7 +144773,7 @@ static PHP_METHOD(Phalcon_Validation_Message_Group, offsetUnset) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_LONG(_2$$3, 1); ZEPHIR_MAKE_REF(_1$$3); - ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 466, _1$$3, index, _2$$3); + ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 461, _1$$3, index, _2$$3); ZEPHIR_UNREF(_1$$3); zephir_check_call_status(); } @@ -173951,7 +145033,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 467, value); + ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 462, value); zephir_check_call_status(); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_VAR(_1$$3); @@ -174001,7 +145083,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "Alnum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -174106,7 +145188,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alpha, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Alpha", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -174231,7 +145313,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Between, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$5); ZVAL_STRING(_10$$5, "Between", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 465, _9$$5, field, _10$$5, code); + ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 460, _9$$5, field, _10$$5, code); zephir_check_temp_parameter(_10$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _4$$5); @@ -174294,7 +145376,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(&valueWith, validation, "getvalue", NULL, 0, fieldWith); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 468, value, valueWith); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 463, value, valueWith); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$4); @@ -174358,7 +145440,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$4); ZVAL_STRING(_10$$4, "Confirmation", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 465, _9$$4, field, _10$$4, code); + ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 460, _9$$4, field, _10$$4, code); zephir_check_temp_parameter(_10$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$4); @@ -174451,7 +145533,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 469, value); + ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 464, value); zephir_check_call_status(); if (!(zephir_is_true(valid))) { ZEPHIR_INIT_VAR(_0$$3); @@ -174501,7 +145583,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_6$$3); ZVAL_STRING(_6$$3, "CreditCard", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 465, _5$$3, field, _6$$3, code); + ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 460, _5$$3, field, _6$$3, code); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0$$3); @@ -174532,7 +145614,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm ZEPHIR_CPY_WRT(digits, _2); ZEPHIR_INIT_VAR(hash); ZVAL_STRING(hash, "", 1); - ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 470, digits); + ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 465, digits); zephir_check_call_status(); zephir_is_iterable(_4, &_6, &_5, 0, 0, "phalcon/validation/validator/creditcard.zep", 118); for ( @@ -174552,7 +145634,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm } ZEPHIR_CALL_FUNCTION(&_9, "str_split", &_1, 74, hash); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 471, _9); + ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 466, _9); zephir_check_call_status(); RETURN_MM_BOOL((zephir_safe_mod_zval_long(result, 10 TSRMLS_CC) == 0)); @@ -174612,7 +145694,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { ZEPHIR_INIT_NVAR(format); ZVAL_STRING(format, "Y-m-d", 1); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 472, value, format); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 467, value, format); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$5); @@ -174653,7 +145735,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$5); ZVAL_STRING(_8$$5, "Date", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 465, _7$$5, field, _8$$5); + ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 460, _7$$5, field, _8$$5); zephir_check_temp_parameter(_8$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$5); @@ -174742,7 +145824,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); _0 = Z_TYPE_P(value) == IS_LONG; if (!(_0)) { - ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 473, value); + ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 468, value); zephir_check_call_status(); _0 = zephir_is_true(_1); } @@ -174796,7 +145878,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "Digit", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 465, _7, field, _8, code); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 460, _7, field, _8, code); zephir_check_temp_parameter(_8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2); @@ -174898,7 +145980,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Email, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); @@ -175040,7 +146122,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_ExclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "ExclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175168,7 +146250,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_16$$6); ZVAL_STRING(_16$$6, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 465, _14$$6, field, _16$$6, code); + ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 460, _14$$6, field, _16$$6, code); zephir_check_temp_parameter(_16$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11$$6); @@ -175217,7 +146299,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_28$$9); ZVAL_STRING(_28$$9, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 465, _27$$9, field, _28$$9, code); + ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 460, _27$$9, field, _28$$9, code); zephir_check_temp_parameter(_28$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _24$$9); @@ -175258,7 +146340,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_35$$12); ZVAL_STRING(_35$$12, "FileValid", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 465, _34$$12, field, _35$$12, code); + ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 460, _34$$12, field, _35$$12, code); zephir_check_temp_parameter(_35$$12); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _31$$12); @@ -175349,7 +146431,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_54$$18); ZVAL_STRING(_54$$18, "FileSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 465, _53$$18, field, _54$$18, code); + ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 460, _53$$18, field, _54$$18, code); zephir_check_temp_parameter(_54$$18); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _50$$18); @@ -175419,7 +146501,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_63$$26); ZVAL_STRING(_63$$26, "FileType", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 465, _62$$26, field, _63$$26, code); + ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 460, _62$$26, field, _63$$26, code); zephir_check_temp_parameter(_63$$26); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _59$$26); @@ -175507,7 +146589,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_77$$33); ZVAL_STRING(_77$$33, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 465, _76$$33, field, _77$$33, code); + ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 460, _76$$33, field, _77$$33, code); zephir_check_temp_parameter(_77$$33); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _73$$33); @@ -175566,7 +146648,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_86$$38); ZVAL_STRING(_86$$38, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 465, _85$$38, field, _86$$38, code); + ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 460, _85$$38, field, _86$$38, code); zephir_check_temp_parameter(_86$$38); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _82$$38); @@ -175741,7 +146823,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Identical, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_14$$8); ZVAL_STRING(_14$$8, "Identical", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 465, _13$$8, field, _14$$8, code); + ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 460, _13$$8, field, _14$$8, code); zephir_check_temp_parameter(_14$$8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$8); @@ -175883,7 +146965,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_InclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "InclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175988,7 +147070,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Numericality, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -176093,7 +147175,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_PresenceOf, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176213,7 +147295,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Regex, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$6); ZVAL_STRING(_9$$6, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 465, _8$$6, field, _9$$6, code); + ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 460, _8$$6, field, _9$$6, code); zephir_check_temp_parameter(_9$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$6); @@ -176351,7 +147433,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$11); ZVAL_STRING(_11$$11, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 465, _9$$11, field, _11$$11, code); + ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 460, _9$$11, field, _11$$11, code); zephir_check_temp_parameter(_11$$11); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _6$$11); @@ -176396,7 +147478,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_19$$16); ZVAL_STRING(_19$$16, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 465, _18$$16, field, _19$$16, code); + ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 460, _18$$16, field, _19$$16, code); zephir_check_temp_parameter(_19$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _15$$16); @@ -176477,7 +147559,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, validate) { zephir_check_call_status(); ZEPHIR_INIT_NVAR(_6$$3); ZVAL_STRING(_6$$3, "Uniqueness", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _4$$3, field, _6$$3, _5$$3); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _4$$3, field, _6$$3, _5$$3); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176944,7 +148026,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Url, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); diff --git a/build/php5/32bits/php_phalcon.h b/build/php5/32bits/php_phalcon.h index f8a6d35836e..aa0591bfc62 100644 --- a/build/php5/32bits/php_phalcon.h +++ b/build/php5/32bits/php_phalcon.h @@ -185,7 +185,7 @@ typedef zend_function zephir_fcall_cache_entry; #define PHP_PHALCON_VERSION "3.0.4" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" -#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev" +#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev-aef205594b" #define PHP_PHALCON_DESCRIPTION "Web framework delivered as a C-extension for PHP" typedef struct _zephir_struct_db { diff --git a/build/php5/64bits/phalcon.zep.c b/build/php5/64bits/phalcon.zep.c index 14cec92404d..44c18c7b78e 100644 --- a/build/php5/64bits/phalcon.zep.c +++ b/build/php5/64bits/phalcon.zep.c @@ -17463,947 +17463,74 @@ static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); #endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ +/* jsmin.c + 2013-03-29 -/* This file was generated automatically by Zephir do not modify it! */ - -#ifdef HAVE_CONFIG_H -#endif - - -#if PHP_VERSION_ID < 50500 -#endif - - - - - - -zend_class_entry *phalcon_di_injectionawareinterface_ce; -zend_class_entry *phalcon_events_eventsawareinterface_ce; -zend_class_entry *phalcon_validation_validatorinterface_ce; -zend_class_entry *phalcon_forms_elementinterface_ce; -zend_class_entry *phalcon_mvc_model_validatorinterface_ce; -zend_class_entry *phalcon_cache_backendinterface_ce; -zend_class_entry *phalcon_cache_frontendinterface_ce; -zend_class_entry *phalcon_mvc_model_metadatainterface_ce; -zend_class_entry *phalcon_dispatcherinterface_ce; -zend_class_entry *phalcon_annotations_adapterinterface_ce; -zend_class_entry *phalcon_db_adapterinterface_ce; -zend_class_entry *phalcon_logger_adapterinterface_ce; -zend_class_entry *phalcon_logger_formatterinterface_ce; -zend_class_entry *phalcon_session_adapterinterface_ce; -zend_class_entry *phalcon_db_dialectinterface_ce; -zend_class_entry *phalcon_mvc_entityinterface_ce; -zend_class_entry *phalcon_mvc_model_resultsetinterface_ce; -zend_class_entry *phalcon_paginator_adapterinterface_ce; -zend_class_entry *phalcon_translate_adapterinterface_ce; -zend_class_entry *phalcon_assets_filterinterface_ce; -zend_class_entry *phalcon_diinterface_ce; -zend_class_entry *phalcon_flashinterface_ce; -zend_class_entry *phalcon_image_adapterinterface_ce; -zend_class_entry *phalcon_mvc_collection_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_model_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_view_engineinterface_ce; -zend_class_entry *phalcon_mvc_viewbaseinterface_ce; -zend_class_entry *phalcon_acl_adapterinterface_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategyinterface_ce; -zend_class_entry *phalcon_mvc_model_resultinterface_ce; -zend_class_entry *phalcon_mvc_routerinterface_ce; -zend_class_entry *phalcon_translate_interpolatorinterface_ce; -zend_class_entry *phalcon_acl_resourceinterface_ce; -zend_class_entry *phalcon_acl_roleinterface_ce; -zend_class_entry *phalcon_annotations_readerinterface_ce; -zend_class_entry *phalcon_cli_dispatcherinterface_ce; -zend_class_entry *phalcon_cli_taskinterface_ce; -zend_class_entry *phalcon_cryptinterface_ce; -zend_class_entry *phalcon_db_columninterface_ce; -zend_class_entry *phalcon_db_indexinterface_ce; -zend_class_entry *phalcon_db_referenceinterface_ce; -zend_class_entry *phalcon_db_resultinterface_ce; -zend_class_entry *phalcon_di_serviceinterface_ce; -zend_class_entry *phalcon_escaperinterface_ce; -zend_class_entry *phalcon_events_eventinterface_ce; -zend_class_entry *phalcon_events_managerinterface_ce; -zend_class_entry *phalcon_filterinterface_ce; -zend_class_entry *phalcon_http_cookieinterface_ce; -zend_class_entry *phalcon_http_request_fileinterface_ce; -zend_class_entry *phalcon_http_requestinterface_ce; -zend_class_entry *phalcon_http_response_cookiesinterface_ce; -zend_class_entry *phalcon_http_response_headersinterface_ce; -zend_class_entry *phalcon_http_responseinterface_ce; -zend_class_entry *phalcon_mvc_collectioninterface_ce; -zend_class_entry *phalcon_mvc_controllerinterface_ce; -zend_class_entry *phalcon_mvc_dispatcherinterface_ce; -zend_class_entry *phalcon_mvc_micro_collectioninterface_ce; -zend_class_entry *phalcon_mvc_model_criteriainterface_ce; -zend_class_entry *phalcon_mvc_model_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_messageinterface_ce; -zend_class_entry *phalcon_mvc_model_query_builderinterface_ce; -zend_class_entry *phalcon_mvc_model_query_statusinterface_ce; -zend_class_entry *phalcon_mvc_model_queryinterface_ce; -zend_class_entry *phalcon_mvc_model_relationinterface_ce; -zend_class_entry *phalcon_mvc_model_transaction_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_transactioninterface_ce; -zend_class_entry *phalcon_mvc_modelinterface_ce; -zend_class_entry *phalcon_mvc_router_groupinterface_ce; -zend_class_entry *phalcon_mvc_router_routeinterface_ce; -zend_class_entry *phalcon_mvc_urlinterface_ce; -zend_class_entry *phalcon_mvc_viewinterface_ce; -zend_class_entry *phalcon_session_baginterface_ce; -zend_class_entry *phalcon_validation_messageinterface_ce; -zend_class_entry *phalcon_validationinterface_ce; -zend_class_entry *phalcon_acl_resourceaware_ce; -zend_class_entry *phalcon_acl_roleaware_ce; -zend_class_entry *phalcon_cli_router_routeinterface_ce; -zend_class_entry *phalcon_cli_routerinterface_ce; -zend_class_entry *phalcon_filter_userfilterinterface_ce; -zend_class_entry *phalcon_mvc_collection_managerinterface_ce; -zend_class_entry *phalcon_mvc_controller_bindmodelinterface_ce; -zend_class_entry *phalcon_mvc_micro_middlewareinterface_ce; -zend_class_entry *phalcon_mvc_moduledefinitioninterface_ce; -zend_class_entry *phalcon_exception_ce; -zend_class_entry *phalcon_validation_validator_ce; -zend_class_entry *phalcon_di_injectable_ce; -zend_class_entry *phalcon_forms_element_ce; -zend_class_entry *phalcon_mvc_model_validator_ce; -zend_class_entry *phalcon_cache_backend_ce; -zend_class_entry *phalcon_mvc_model_metadata_ce; -zend_class_entry *phalcon_annotations_adapter_ce; -zend_class_entry *phalcon_config_ce; -zend_class_entry *phalcon_db_adapter_ce; -zend_class_entry *phalcon_logger_adapter_ce; -zend_class_entry *phalcon_logger_formatter_ce; -zend_class_entry *phalcon_session_adapter_ce; -zend_class_entry *phalcon_db_adapter_pdo_ce; -zend_class_entry *phalcon_db_dialect_ce; -zend_class_entry *phalcon_mvc_model_exception_ce; -zend_class_entry *phalcon_paginator_adapter_ce; -zend_class_entry *phalcon_translate_adapter_ce; -zend_class_entry *phalcon_application_ce; -zend_class_entry *phalcon_application_exception_ce; -zend_class_entry *phalcon_assets_inline_ce; -zend_class_entry *phalcon_assets_resource_ce; -zend_class_entry *phalcon_cache_frontend_data_ce; -zend_class_entry *phalcon_di_ce; -zend_class_entry *phalcon_dispatcher_ce; -zend_class_entry *phalcon_flash_ce; -zend_class_entry *phalcon_image_adapter_ce; -zend_class_entry *phalcon_mvc_collection_behavior_ce; -zend_class_entry *phalcon_mvc_model_behavior_ce; -zend_class_entry *phalcon_mvc_model_resultset_ce; -zend_class_entry *phalcon_mvc_view_engine_ce; -zend_class_entry *phalcon_acl_adapter_ce; -zend_class_entry *phalcon_di_factorydefault_ce; -zend_class_entry *phalcon_mvc_model_transaction_exception_ce; -zend_class_entry *phalcon_mvc_router_ce; -zend_class_entry *phalcon_mvc_view_exception_ce; -zend_class_entry *phalcon_validation_combinedfieldsvalidator_ce; -zend_class_entry *phalcon_0__closure_ce; -zend_class_entry *phalcon_1__closure_ce; -zend_class_entry *phalcon_acl_adapter_memory_ce; -zend_class_entry *phalcon_acl_ce; -zend_class_entry *phalcon_acl_exception_ce; -zend_class_entry *phalcon_acl_resource_ce; -zend_class_entry *phalcon_acl_role_ce; -zend_class_entry *phalcon_annotations_adapter_apc_ce; -zend_class_entry *phalcon_annotations_adapter_files_ce; -zend_class_entry *phalcon_annotations_adapter_memory_ce; -zend_class_entry *phalcon_annotations_adapter_xcache_ce; -zend_class_entry *phalcon_annotations_annotation_ce; -zend_class_entry *phalcon_annotations_collection_ce; -zend_class_entry *phalcon_annotations_exception_ce; -zend_class_entry *phalcon_annotations_reader_ce; -zend_class_entry *phalcon_annotations_reflection_ce; -zend_class_entry *phalcon_assets_collection_ce; -zend_class_entry *phalcon_assets_exception_ce; -zend_class_entry *phalcon_assets_filters_cssmin_ce; -zend_class_entry *phalcon_assets_filters_jsmin_ce; -zend_class_entry *phalcon_assets_filters_none_ce; -zend_class_entry *phalcon_assets_inline_css_ce; -zend_class_entry *phalcon_assets_inline_js_ce; -zend_class_entry *phalcon_assets_manager_ce; -zend_class_entry *phalcon_assets_resource_css_ce; -zend_class_entry *phalcon_assets_resource_js_ce; -zend_class_entry *phalcon_cache_backend_apc_ce; -zend_class_entry *phalcon_cache_backend_file_ce; -zend_class_entry *phalcon_cache_backend_libmemcached_ce; -zend_class_entry *phalcon_cache_backend_memcache_ce; -zend_class_entry *phalcon_cache_backend_memory_ce; -zend_class_entry *phalcon_cache_backend_mongo_ce; -zend_class_entry *phalcon_cache_backend_redis_ce; -zend_class_entry *phalcon_cache_backend_xcache_ce; -zend_class_entry *phalcon_cache_exception_ce; -zend_class_entry *phalcon_cache_frontend_base64_ce; -zend_class_entry *phalcon_cache_frontend_igbinary_ce; -zend_class_entry *phalcon_cache_frontend_json_ce; -zend_class_entry *phalcon_cache_frontend_msgpack_ce; -zend_class_entry *phalcon_cache_frontend_none_ce; -zend_class_entry *phalcon_cache_frontend_output_ce; -zend_class_entry *phalcon_cache_multiple_ce; -zend_class_entry *phalcon_cli_console_ce; -zend_class_entry *phalcon_cli_console_exception_ce; -zend_class_entry *phalcon_cli_dispatcher_ce; -zend_class_entry *phalcon_cli_dispatcher_exception_ce; -zend_class_entry *phalcon_cli_router_ce; -zend_class_entry *phalcon_cli_router_exception_ce; -zend_class_entry *phalcon_cli_router_route_ce; -zend_class_entry *phalcon_cli_task_ce; -zend_class_entry *phalcon_config_adapter_ini_ce; -zend_class_entry *phalcon_config_adapter_json_ce; -zend_class_entry *phalcon_config_adapter_php_ce; -zend_class_entry *phalcon_config_adapter_yaml_ce; -zend_class_entry *phalcon_config_exception_ce; -zend_class_entry *phalcon_crypt_ce; -zend_class_entry *phalcon_crypt_exception_ce; -zend_class_entry *phalcon_db_adapter_pdo_mysql_ce; -zend_class_entry *phalcon_db_adapter_pdo_postgresql_ce; -zend_class_entry *phalcon_db_adapter_pdo_sqlite_ce; -zend_class_entry *phalcon_db_ce; -zend_class_entry *phalcon_db_column_ce; -zend_class_entry *phalcon_db_dialect_mysql_ce; -zend_class_entry *phalcon_db_dialect_postgresql_ce; -zend_class_entry *phalcon_db_dialect_sqlite_ce; -zend_class_entry *phalcon_db_exception_ce; -zend_class_entry *phalcon_db_index_ce; -zend_class_entry *phalcon_db_profiler_ce; -zend_class_entry *phalcon_db_profiler_item_ce; -zend_class_entry *phalcon_db_rawvalue_ce; -zend_class_entry *phalcon_db_reference_ce; -zend_class_entry *phalcon_db_result_pdo_ce; -zend_class_entry *phalcon_debug_ce; -zend_class_entry *phalcon_debug_dump_ce; -zend_class_entry *phalcon_debug_exception_ce; -zend_class_entry *phalcon_di_exception_ce; -zend_class_entry *phalcon_di_factorydefault_cli_ce; -zend_class_entry *phalcon_di_service_builder_ce; -zend_class_entry *phalcon_di_service_ce; -zend_class_entry *phalcon_escaper_ce; -zend_class_entry *phalcon_escaper_exception_ce; -zend_class_entry *phalcon_events_event_ce; -zend_class_entry *phalcon_events_exception_ce; -zend_class_entry *phalcon_events_manager_ce; -zend_class_entry *phalcon_filter_ce; -zend_class_entry *phalcon_filter_exception_ce; -zend_class_entry *phalcon_flash_direct_ce; -zend_class_entry *phalcon_flash_exception_ce; -zend_class_entry *phalcon_flash_session_ce; -zend_class_entry *phalcon_forms_element_check_ce; -zend_class_entry *phalcon_forms_element_date_ce; -zend_class_entry *phalcon_forms_element_email_ce; -zend_class_entry *phalcon_forms_element_file_ce; -zend_class_entry *phalcon_forms_element_hidden_ce; -zend_class_entry *phalcon_forms_element_numeric_ce; -zend_class_entry *phalcon_forms_element_password_ce; -zend_class_entry *phalcon_forms_element_radio_ce; -zend_class_entry *phalcon_forms_element_select_ce; -zend_class_entry *phalcon_forms_element_submit_ce; -zend_class_entry *phalcon_forms_element_text_ce; -zend_class_entry *phalcon_forms_element_textarea_ce; -zend_class_entry *phalcon_forms_exception_ce; -zend_class_entry *phalcon_forms_form_ce; -zend_class_entry *phalcon_forms_manager_ce; -zend_class_entry *phalcon_http_cookie_ce; -zend_class_entry *phalcon_http_cookie_exception_ce; -zend_class_entry *phalcon_http_request_ce; -zend_class_entry *phalcon_http_request_exception_ce; -zend_class_entry *phalcon_http_request_file_ce; -zend_class_entry *phalcon_http_response_ce; -zend_class_entry *phalcon_http_response_cookies_ce; -zend_class_entry *phalcon_http_response_exception_ce; -zend_class_entry *phalcon_http_response_headers_ce; -zend_class_entry *phalcon_image_adapter_gd_ce; -zend_class_entry *phalcon_image_adapter_imagick_ce; -zend_class_entry *phalcon_image_ce; -zend_class_entry *phalcon_image_exception_ce; -zend_class_entry *phalcon_kernel_ce; -zend_class_entry *phalcon_loader_ce; -zend_class_entry *phalcon_loader_exception_ce; -zend_class_entry *phalcon_logger_adapter_file_ce; -zend_class_entry *phalcon_logger_adapter_firephp_ce; -zend_class_entry *phalcon_logger_adapter_stream_ce; -zend_class_entry *phalcon_logger_adapter_syslog_ce; -zend_class_entry *phalcon_logger_ce; -zend_class_entry *phalcon_logger_exception_ce; -zend_class_entry *phalcon_logger_formatter_firephp_ce; -zend_class_entry *phalcon_logger_formatter_json_ce; -zend_class_entry *phalcon_logger_formatter_line_ce; -zend_class_entry *phalcon_logger_formatter_syslog_ce; -zend_class_entry *phalcon_logger_item_ce; -zend_class_entry *phalcon_logger_multiple_ce; -zend_class_entry *phalcon_mvc_application_ce; -zend_class_entry *phalcon_mvc_application_exception_ce; -zend_class_entry *phalcon_mvc_collection_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_collection_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_collection_ce; -zend_class_entry *phalcon_mvc_collection_document_ce; -zend_class_entry *phalcon_mvc_collection_exception_ce; -zend_class_entry *phalcon_mvc_collection_manager_ce; -zend_class_entry *phalcon_mvc_controller_ce; -zend_class_entry *phalcon_mvc_dispatcher_ce; -zend_class_entry *phalcon_mvc_dispatcher_exception_ce; -zend_class_entry *phalcon_mvc_micro_ce; -zend_class_entry *phalcon_mvc_micro_collection_ce; -zend_class_entry *phalcon_mvc_micro_exception_ce; -zend_class_entry *phalcon_mvc_micro_lazyloader_ce; -zend_class_entry *phalcon_mvc_model_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_model_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_model_ce; -zend_class_entry *phalcon_mvc_model_criteria_ce; -zend_class_entry *phalcon_mvc_model_manager_ce; -zend_class_entry *phalcon_mvc_model_message_ce; -zend_class_entry *phalcon_mvc_model_metadata_apc_ce; -zend_class_entry *phalcon_mvc_model_metadata_files_ce; -zend_class_entry *phalcon_mvc_model_metadata_libmemcached_ce; -zend_class_entry *phalcon_mvc_model_metadata_memcache_ce; -zend_class_entry *phalcon_mvc_model_metadata_memory_ce; -zend_class_entry *phalcon_mvc_model_metadata_redis_ce; -zend_class_entry *phalcon_mvc_model_metadata_session_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_annotations_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_introspection_ce; -zend_class_entry *phalcon_mvc_model_metadata_xcache_ce; -zend_class_entry *phalcon_mvc_model_query_builder_ce; -zend_class_entry *phalcon_mvc_model_query_ce; -zend_class_entry *phalcon_mvc_model_query_lang_ce; -zend_class_entry *phalcon_mvc_model_query_status_ce; -zend_class_entry *phalcon_mvc_model_relation_ce; -zend_class_entry *phalcon_mvc_model_resultset_complex_ce; -zend_class_entry *phalcon_mvc_model_resultset_simple_ce; -zend_class_entry *phalcon_mvc_model_row_ce; -zend_class_entry *phalcon_mvc_model_transaction_ce; -zend_class_entry *phalcon_mvc_model_transaction_failed_ce; -zend_class_entry *phalcon_mvc_model_transaction_manager_ce; -zend_class_entry *phalcon_mvc_model_validationfailed_ce; -zend_class_entry *phalcon_mvc_model_validator_email_ce; -zend_class_entry *phalcon_mvc_model_validator_exclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_inclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_ip_ce; -zend_class_entry *phalcon_mvc_model_validator_numericality_ce; -zend_class_entry *phalcon_mvc_model_validator_presenceof_ce; -zend_class_entry *phalcon_mvc_model_validator_regex_ce; -zend_class_entry *phalcon_mvc_model_validator_stringlength_ce; -zend_class_entry *phalcon_mvc_model_validator_uniqueness_ce; -zend_class_entry *phalcon_mvc_model_validator_url_ce; -zend_class_entry *phalcon_mvc_router_annotations_ce; -zend_class_entry *phalcon_mvc_router_exception_ce; -zend_class_entry *phalcon_mvc_router_group_ce; -zend_class_entry *phalcon_mvc_router_route_ce; -zend_class_entry *phalcon_mvc_url_ce; -zend_class_entry *phalcon_mvc_url_exception_ce; -zend_class_entry *phalcon_mvc_user_component_ce; -zend_class_entry *phalcon_mvc_user_module_ce; -zend_class_entry *phalcon_mvc_user_plugin_ce; -zend_class_entry *phalcon_mvc_view_ce; -zend_class_entry *phalcon_mvc_view_engine_php_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_compiler_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_exception_ce; -zend_class_entry *phalcon_mvc_view_simple_ce; -zend_class_entry *phalcon_paginator_adapter_model_ce; -zend_class_entry *phalcon_paginator_adapter_nativearray_ce; -zend_class_entry *phalcon_paginator_adapter_querybuilder_ce; -zend_class_entry *phalcon_paginator_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_ce; -zend_class_entry *phalcon_queue_beanstalk_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_job_ce; -zend_class_entry *phalcon_registry_ce; -zend_class_entry *phalcon_security_ce; -zend_class_entry *phalcon_security_exception_ce; -zend_class_entry *phalcon_security_random_ce; -zend_class_entry *phalcon_session_adapter_files_ce; -zend_class_entry *phalcon_session_adapter_libmemcached_ce; -zend_class_entry *phalcon_session_adapter_memcache_ce; -zend_class_entry *phalcon_session_adapter_redis_ce; -zend_class_entry *phalcon_session_bag_ce; -zend_class_entry *phalcon_session_exception_ce; -zend_class_entry *phalcon_tag_ce; -zend_class_entry *phalcon_tag_exception_ce; -zend_class_entry *phalcon_tag_select_ce; -zend_class_entry *phalcon_text_ce; -zend_class_entry *phalcon_translate_adapter_csv_ce; -zend_class_entry *phalcon_translate_adapter_gettext_ce; -zend_class_entry *phalcon_translate_adapter_nativearray_ce; -zend_class_entry *phalcon_translate_ce; -zend_class_entry *phalcon_translate_exception_ce; -zend_class_entry *phalcon_translate_interpolator_associativearray_ce; -zend_class_entry *phalcon_translate_interpolator_indexedarray_ce; -zend_class_entry *phalcon_validation_ce; -zend_class_entry *phalcon_validation_exception_ce; -zend_class_entry *phalcon_validation_message_ce; -zend_class_entry *phalcon_validation_message_group_ce; -zend_class_entry *phalcon_validation_validator_alnum_ce; -zend_class_entry *phalcon_validation_validator_alpha_ce; -zend_class_entry *phalcon_validation_validator_between_ce; -zend_class_entry *phalcon_validation_validator_confirmation_ce; -zend_class_entry *phalcon_validation_validator_creditcard_ce; -zend_class_entry *phalcon_validation_validator_date_ce; -zend_class_entry *phalcon_validation_validator_digit_ce; -zend_class_entry *phalcon_validation_validator_email_ce; -zend_class_entry *phalcon_validation_validator_exclusionin_ce; -zend_class_entry *phalcon_validation_validator_file_ce; -zend_class_entry *phalcon_validation_validator_identical_ce; -zend_class_entry *phalcon_validation_validator_inclusionin_ce; -zend_class_entry *phalcon_validation_validator_numericality_ce; -zend_class_entry *phalcon_validation_validator_presenceof_ce; -zend_class_entry *phalcon_validation_validator_regex_ce; -zend_class_entry *phalcon_validation_validator_stringlength_ce; -zend_class_entry *phalcon_validation_validator_uniqueness_ce; -zend_class_entry *phalcon_validation_validator_url_ce; -zend_class_entry *phalcon_version_ce; - -ZEND_DECLARE_MODULE_GLOBALS(phalcon) - -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("phalcon.db.escape_identifiers", "1", PHP_INI_ALL, OnUpdateBool, db.escape_identifiers, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.db.force_casting", "0", PHP_INI_ALL, OnUpdateBool, db.force_casting, zend_phalcon_globals, phalcon_globals) - - - - - STD_PHP_INI_BOOLEAN("phalcon.orm.events", "1", PHP_INI_ALL, OnUpdateBool, orm.events, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.virtual_foreign_keys", "1", PHP_INI_ALL, OnUpdateBool, orm.virtual_foreign_keys, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.column_renaming", "1", PHP_INI_ALL, OnUpdateBool, orm.column_renaming, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.not_null_validations", "1", PHP_INI_ALL, OnUpdateBool, orm.not_null_validations, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.exception_on_failed_save", "0", PHP_INI_ALL, OnUpdateBool, orm.exception_on_failed_save, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_literals", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_literals, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.late_state_binding", "0", PHP_INI_ALL, OnUpdateBool, orm.late_state_binding, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_implicit_joins", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_implicit_joins, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.cast_on_hydrate", "0", PHP_INI_ALL, OnUpdateBool, orm.cast_on_hydrate, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.ignore_unknown_columns", "0", PHP_INI_ALL, OnUpdateBool, orm.ignore_unknown_columns, zend_phalcon_globals, phalcon_globals) -PHP_INI_END() - -static PHP_MINIT_FUNCTION(phalcon) -{ -#if PHP_VERSION_ID < 50500 - char* old_lc_all = setlocale(LC_ALL, NULL); - if (old_lc_all) { - size_t len = strlen(old_lc_all); - char *tmp = calloc(len+1, 1); - if (UNEXPECTED(!tmp)) { - return FAILURE; - } - - memcpy(tmp, old_lc_all, len); - old_lc_all = tmp; - } - - setlocale(LC_ALL, "C"); -#endif - REGISTER_INI_ENTRIES(); - ZEPHIR_INIT(Phalcon_Di_InjectionAwareInterface); - ZEPHIR_INIT(Phalcon_Events_EventsAwareInterface); - ZEPHIR_INIT(Phalcon_Validation_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Forms_ElementInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Cache_BackendInterface); - ZEPHIR_INIT(Phalcon_Cache_FrontendInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaDataInterface); - ZEPHIR_INIT(Phalcon_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Annotations_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_FormatterInterface); - ZEPHIR_INIT(Phalcon_Session_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_DialectInterface); - ZEPHIR_INIT(Phalcon_Mvc_EntityInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultsetInterface); - ZEPHIR_INIT(Phalcon_Paginator_AdapterInterface); - ZEPHIR_INIT(Phalcon_Translate_AdapterInterface); - ZEPHIR_INIT(Phalcon_Assets_FilterInterface); - ZEPHIR_INIT(Phalcon_DiInterface); - ZEPHIR_INIT(Phalcon_FlashInterface); - ZEPHIR_INIT(Phalcon_Image_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewBaseInterface); - ZEPHIR_INIT(Phalcon_Mvc_View_EngineInterface); - ZEPHIR_INIT(Phalcon_Acl_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_StrategyInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultInterface); - ZEPHIR_INIT(Phalcon_Mvc_RouterInterface); - ZEPHIR_INIT(Phalcon_Translate_InterpolatorInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceInterface); - ZEPHIR_INIT(Phalcon_Acl_RoleInterface); - ZEPHIR_INIT(Phalcon_Annotations_ReaderInterface); - ZEPHIR_INIT(Phalcon_Cli_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Cli_TaskInterface); - ZEPHIR_INIT(Phalcon_CryptInterface); - ZEPHIR_INIT(Phalcon_Db_ColumnInterface); - ZEPHIR_INIT(Phalcon_Db_IndexInterface); - ZEPHIR_INIT(Phalcon_Db_ReferenceInterface); - ZEPHIR_INIT(Phalcon_Db_ResultInterface); - ZEPHIR_INIT(Phalcon_Di_ServiceInterface); - ZEPHIR_INIT(Phalcon_EscaperInterface); - ZEPHIR_INIT(Phalcon_Events_EventInterface); - ZEPHIR_INIT(Phalcon_Events_ManagerInterface); - ZEPHIR_INIT(Phalcon_FilterInterface); - ZEPHIR_INIT(Phalcon_Http_CookieInterface); - ZEPHIR_INIT(Phalcon_Http_RequestInterface); - ZEPHIR_INIT(Phalcon_Http_Request_FileInterface); - ZEPHIR_INIT(Phalcon_Http_ResponseInterface); - ZEPHIR_INIT(Phalcon_Http_Response_CookiesInterface); - ZEPHIR_INIT(Phalcon_Http_Response_HeadersInterface); - ZEPHIR_INIT(Phalcon_Mvc_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ControllerInterface); - ZEPHIR_INIT(Phalcon_Mvc_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_CriteriaInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MessageInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_QueryInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_BuilderInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_StatusInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_RelationInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_TransactionInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_GroupInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Mvc_UrlInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewInterface); - ZEPHIR_INIT(Phalcon_Session_BagInterface); - ZEPHIR_INIT(Phalcon_ValidationInterface); - ZEPHIR_INIT(Phalcon_Validation_MessageInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceAware); - ZEPHIR_INIT(Phalcon_Acl_RoleAware); - ZEPHIR_INIT(Phalcon_Cli_RouterInterface); - ZEPHIR_INIT(Phalcon_Cli_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Filter_UserFilterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Controller_BindModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_MiddlewareInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModuleDefinitionInterface); - ZEPHIR_INIT(Phalcon_Exception); - ZEPHIR_INIT(Phalcon_Validation_Validator); - ZEPHIR_INIT(Phalcon_Di_Injectable); - ZEPHIR_INIT(Phalcon_Forms_Element); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator); - ZEPHIR_INIT(Phalcon_Cache_Backend); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData); - ZEPHIR_INIT(Phalcon_Annotations_Adapter); - ZEPHIR_INIT(Phalcon_Config); - ZEPHIR_INIT(Phalcon_Db_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Formatter); - ZEPHIR_INIT(Phalcon_Session_Adapter); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo); - ZEPHIR_INIT(Phalcon_Db_Dialect); - ZEPHIR_INIT(Phalcon_Mvc_Model_Exception); - ZEPHIR_INIT(Phalcon_Paginator_Adapter); - ZEPHIR_INIT(Phalcon_Translate_Adapter); - ZEPHIR_INIT(Phalcon_Application); - ZEPHIR_INIT(Phalcon_Application_Exception); - ZEPHIR_INIT(Phalcon_Assets_Inline); - ZEPHIR_INIT(Phalcon_Assets_Resource); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Data); - ZEPHIR_INIT(Phalcon_Di); - ZEPHIR_INIT(Phalcon_Dispatcher); - ZEPHIR_INIT(Phalcon_Flash); - ZEPHIR_INIT(Phalcon_Image_Adapter); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine); - ZEPHIR_INIT(Phalcon_Acl_Adapter); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router); - ZEPHIR_INIT(Phalcon_Mvc_View_Exception); - ZEPHIR_INIT(Phalcon_Validation_CombinedFieldsValidator); - ZEPHIR_INIT(Phalcon_Acl); - ZEPHIR_INIT(Phalcon_Acl_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Acl_Exception); - ZEPHIR_INIT(Phalcon_Acl_Resource); - ZEPHIR_INIT(Phalcon_Acl_Role); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Apc); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Files); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Xcache); - ZEPHIR_INIT(Phalcon_Annotations_Annotation); - ZEPHIR_INIT(Phalcon_Annotations_Collection); - ZEPHIR_INIT(Phalcon_Annotations_Exception); - ZEPHIR_INIT(Phalcon_Annotations_Reader); - ZEPHIR_INIT(Phalcon_Annotations_Reflection); - ZEPHIR_INIT(Phalcon_Assets_Collection); - ZEPHIR_INIT(Phalcon_Assets_Exception); - ZEPHIR_INIT(Phalcon_Assets_Filters_Cssmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_Jsmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_None); - ZEPHIR_INIT(Phalcon_Assets_Inline_Css); - ZEPHIR_INIT(Phalcon_Assets_Inline_Js); - ZEPHIR_INIT(Phalcon_Assets_Manager); - ZEPHIR_INIT(Phalcon_Assets_Resource_Css); - ZEPHIR_INIT(Phalcon_Assets_Resource_Js); - ZEPHIR_INIT(Phalcon_Cache_Backend_Apc); - ZEPHIR_INIT(Phalcon_Cache_Backend_File); - ZEPHIR_INIT(Phalcon_Cache_Backend_Libmemcached); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memcache); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memory); - ZEPHIR_INIT(Phalcon_Cache_Backend_Mongo); - ZEPHIR_INIT(Phalcon_Cache_Backend_Redis); - ZEPHIR_INIT(Phalcon_Cache_Backend_Xcache); - ZEPHIR_INIT(Phalcon_Cache_Exception); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Base64); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Igbinary); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Json); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Msgpack); - ZEPHIR_INIT(Phalcon_Cache_Frontend_None); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Output); - ZEPHIR_INIT(Phalcon_Cache_Multiple); - ZEPHIR_INIT(Phalcon_Cli_Console); - ZEPHIR_INIT(Phalcon_Cli_Console_Exception); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router); - ZEPHIR_INIT(Phalcon_Cli_Router_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router_Route); - ZEPHIR_INIT(Phalcon_Cli_Task); - ZEPHIR_INIT(Phalcon_Config_Adapter_Ini); - ZEPHIR_INIT(Phalcon_Config_Adapter_Json); - ZEPHIR_INIT(Phalcon_Config_Adapter_Php); - ZEPHIR_INIT(Phalcon_Config_Adapter_Yaml); - ZEPHIR_INIT(Phalcon_Config_Exception); - ZEPHIR_INIT(Phalcon_Crypt); - ZEPHIR_INIT(Phalcon_Crypt_Exception); - ZEPHIR_INIT(Phalcon_Db); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Mysql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Column); - ZEPHIR_INIT(Phalcon_Db_Dialect_Mysql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Exception); - ZEPHIR_INIT(Phalcon_Db_Index); - ZEPHIR_INIT(Phalcon_Db_Profiler); - ZEPHIR_INIT(Phalcon_Db_Profiler_Item); - ZEPHIR_INIT(Phalcon_Db_RawValue); - ZEPHIR_INIT(Phalcon_Db_Reference); - ZEPHIR_INIT(Phalcon_Db_Result_Pdo); - ZEPHIR_INIT(Phalcon_Debug); - ZEPHIR_INIT(Phalcon_Debug_Dump); - ZEPHIR_INIT(Phalcon_Debug_Exception); - ZEPHIR_INIT(Phalcon_Di_Exception); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault_Cli); - ZEPHIR_INIT(Phalcon_Di_Service); - ZEPHIR_INIT(Phalcon_Di_Service_Builder); - ZEPHIR_INIT(Phalcon_Escaper); - ZEPHIR_INIT(Phalcon_Escaper_Exception); - ZEPHIR_INIT(Phalcon_Events_Event); - ZEPHIR_INIT(Phalcon_Events_Exception); - ZEPHIR_INIT(Phalcon_Events_Manager); - ZEPHIR_INIT(Phalcon_Filter); - ZEPHIR_INIT(Phalcon_Filter_Exception); - ZEPHIR_INIT(Phalcon_Flash_Direct); - ZEPHIR_INIT(Phalcon_Flash_Exception); - ZEPHIR_INIT(Phalcon_Flash_Session); - ZEPHIR_INIT(Phalcon_Forms_Element_Check); - ZEPHIR_INIT(Phalcon_Forms_Element_Date); - ZEPHIR_INIT(Phalcon_Forms_Element_Email); - ZEPHIR_INIT(Phalcon_Forms_Element_File); - ZEPHIR_INIT(Phalcon_Forms_Element_Hidden); - ZEPHIR_INIT(Phalcon_Forms_Element_Numeric); - ZEPHIR_INIT(Phalcon_Forms_Element_Password); - ZEPHIR_INIT(Phalcon_Forms_Element_Radio); - ZEPHIR_INIT(Phalcon_Forms_Element_Select); - ZEPHIR_INIT(Phalcon_Forms_Element_Submit); - ZEPHIR_INIT(Phalcon_Forms_Element_Text); - ZEPHIR_INIT(Phalcon_Forms_Element_TextArea); - ZEPHIR_INIT(Phalcon_Forms_Exception); - ZEPHIR_INIT(Phalcon_Forms_Form); - ZEPHIR_INIT(Phalcon_Forms_Manager); - ZEPHIR_INIT(Phalcon_Http_Cookie); - ZEPHIR_INIT(Phalcon_Http_Cookie_Exception); - ZEPHIR_INIT(Phalcon_Http_Request); - ZEPHIR_INIT(Phalcon_Http_Request_Exception); - ZEPHIR_INIT(Phalcon_Http_Request_File); - ZEPHIR_INIT(Phalcon_Http_Response); - ZEPHIR_INIT(Phalcon_Http_Response_Cookies); - ZEPHIR_INIT(Phalcon_Http_Response_Exception); - ZEPHIR_INIT(Phalcon_Http_Response_Headers); - ZEPHIR_INIT(Phalcon_Image); - ZEPHIR_INIT(Phalcon_Image_Adapter_Gd); - ZEPHIR_INIT(Phalcon_Image_Adapter_Imagick); - ZEPHIR_INIT(Phalcon_Image_Exception); - ZEPHIR_INIT(Phalcon_Kernel); - ZEPHIR_INIT(Phalcon_Loader); - ZEPHIR_INIT(Phalcon_Loader_Exception); - ZEPHIR_INIT(Phalcon_Logger); - ZEPHIR_INIT(Phalcon_Logger_Adapter_File); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Stream); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Exception); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Json); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Line); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Item); - ZEPHIR_INIT(Phalcon_Logger_Multiple); - ZEPHIR_INIT(Phalcon_Mvc_Application); - ZEPHIR_INIT(Phalcon_Mvc_Application_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Document); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Controller); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro_LazyLoader); - ZEPHIR_INIT(Phalcon_Mvc_Model); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Model_Criteria); - ZEPHIR_INIT(Phalcon_Mvc_Model_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_Message); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Apc); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Files); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Libmemcached); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memory); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Redis); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Session); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Introspection); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Xcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Builder); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Lang); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Status); - ZEPHIR_INIT(Phalcon_Mvc_Model_Relation); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Complex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Simple); - ZEPHIR_INIT(Phalcon_Mvc_Model_Row); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Failed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidationFailed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Email); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Exclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Inclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Ip); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Regex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Url); - ZEPHIR_INIT(Phalcon_Mvc_Router_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Router_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router_Group); - ZEPHIR_INIT(Phalcon_Mvc_Router_Route); - ZEPHIR_INIT(Phalcon_Mvc_Url); - ZEPHIR_INIT(Phalcon_Mvc_Url_Exception); - ZEPHIR_INIT(Phalcon_Mvc_User_Component); - ZEPHIR_INIT(Phalcon_Mvc_User_Module); - ZEPHIR_INIT(Phalcon_Mvc_User_Plugin); - ZEPHIR_INIT(Phalcon_Mvc_View); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Php); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Compiler); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Exception); - ZEPHIR_INIT(Phalcon_Mvc_View_Simple); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_Model); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_QueryBuilder); - ZEPHIR_INIT(Phalcon_Paginator_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Job); - ZEPHIR_INIT(Phalcon_Registry); - ZEPHIR_INIT(Phalcon_Security); - ZEPHIR_INIT(Phalcon_Security_Exception); - ZEPHIR_INIT(Phalcon_Security_Random); - ZEPHIR_INIT(Phalcon_Session_Adapter_Files); - ZEPHIR_INIT(Phalcon_Session_Adapter_Libmemcached); - ZEPHIR_INIT(Phalcon_Session_Adapter_Memcache); - ZEPHIR_INIT(Phalcon_Session_Adapter_Redis); - ZEPHIR_INIT(Phalcon_Session_Bag); - ZEPHIR_INIT(Phalcon_Session_Exception); - ZEPHIR_INIT(Phalcon_Tag); - ZEPHIR_INIT(Phalcon_Tag_Exception); - ZEPHIR_INIT(Phalcon_Tag_Select); - ZEPHIR_INIT(Phalcon_Text); - ZEPHIR_INIT(Phalcon_Translate); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Csv); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Gettext); - ZEPHIR_INIT(Phalcon_Translate_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Translate_Exception); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_AssociativeArray); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_IndexedArray); - ZEPHIR_INIT(Phalcon_Validation); - ZEPHIR_INIT(Phalcon_Validation_Exception); - ZEPHIR_INIT(Phalcon_Validation_Message); - ZEPHIR_INIT(Phalcon_Validation_Message_Group); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alnum); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alpha); - ZEPHIR_INIT(Phalcon_Validation_Validator_Between); - ZEPHIR_INIT(Phalcon_Validation_Validator_Confirmation); - ZEPHIR_INIT(Phalcon_Validation_Validator_CreditCard); - ZEPHIR_INIT(Phalcon_Validation_Validator_Date); - ZEPHIR_INIT(Phalcon_Validation_Validator_Digit); - ZEPHIR_INIT(Phalcon_Validation_Validator_Email); - ZEPHIR_INIT(Phalcon_Validation_Validator_ExclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_File); - ZEPHIR_INIT(Phalcon_Validation_Validator_Identical); - ZEPHIR_INIT(Phalcon_Validation_Validator_InclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Validation_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Validation_Validator_Regex); - ZEPHIR_INIT(Phalcon_Validation_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Validation_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Validation_Validator_Url); - ZEPHIR_INIT(Phalcon_Version); - ZEPHIR_INIT(phalcon_0__closure); - ZEPHIR_INIT(phalcon_1__closure); - -#if PHP_VERSION_ID < 50500 - setlocale(LC_ALL, old_lc_all); - free(old_lc_all); -#endif - return SUCCESS; -} - -#ifndef ZEPHIR_RELEASE -static PHP_MSHUTDOWN_FUNCTION(phalcon) -{ - - zephir_deinitialize_memory(TSRMLS_C); - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -#endif - -static void php_zephir_init_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - phalcon_globals->initialized = 0; - - /* Memory options */ - phalcon_globals->active_memory = NULL; - - /* Virtual Symbol Tables */ - phalcon_globals->active_symbol_table = NULL; - - /* Cache Enabled */ - phalcon_globals->cache_enabled = 1; - - /* Recursive Lock */ - phalcon_globals->recursive_lock = 0; - - /* Static cache */ - memset(phalcon_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - - - - phalcon_globals->orm.parser_cache = NULL; - phalcon_globals->orm.ast_cache = NULL; - phalcon_globals->orm.cache_level = 3; - phalcon_globals->orm.unique_cache_id = 3; - - - - - - - - - - - -} - -static void php_zephir_init_module_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - -} - -static PHP_RINIT_FUNCTION(phalcon) -{ +Copyright (c) 2002 Douglas Crockford (www.crockford.com) - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: - php_zephir_init_globals(phalcon_globals_ptr TSRMLS_CC); - //zephir_init_interned_strings(TSRMLS_C); +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - zephir_initialize_memory(phalcon_globals_ptr TSRMLS_CC); +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ - return SUCCESS; -} +#ifndef PHALCON_ASSETS_FILTERS_CSSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_CSSMINIFIER_H -static PHP_RSHUTDOWN_FUNCTION(phalcon) -{ - phalcon_orm_destroy_cache(TSRMLS_C); +static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); - zephir_deinitialize_memory(TSRMLS_C); - return SUCCESS; -} +#endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ -static PHP_MINFO_FUNCTION(phalcon) -{ - php_info_print_box_start(0); - php_printf("%s", PHP_PHALCON_DESCRIPTION); - php_info_print_box_end(); - php_info_print_table_start(); - php_info_print_table_header(2, PHP_PHALCON_NAME, "enabled"); - php_info_print_table_row(2, "Author", PHP_PHALCON_AUTHOR); - php_info_print_table_row(2, "Version", PHP_PHALCON_VERSION); - php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); - php_info_print_table_row(2, "Powered by Zephir", "Version " PHP_PHALCON_ZEPVERSION); - php_info_print_table_end(); +/* jsmin.c + 2013-03-29 - DISPLAY_INI_ENTRIES(); -} +Copyright (c) 2002 Douglas Crockford (www.crockford.com) -static PHP_GINIT_FUNCTION(phalcon) -{ - php_zephir_init_globals(phalcon_globals TSRMLS_CC); - php_zephir_init_module_globals(phalcon_globals TSRMLS_CC); -} +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: -static PHP_GSHUTDOWN_FUNCTION(phalcon) -{ +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -} +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ -zend_function_entry php_phalcon_functions[] = { -ZEND_FE_END +#ifndef PHALCON_ASSETS_FILTERS_JSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_JSMINIFIER_H -}; -zend_module_entry phalcon_module_entry = { - STANDARD_MODULE_HEADER_EX, - NULL, - NULL, - PHP_PHALCON_EXTNAME, - php_phalcon_functions, - PHP_MINIT(phalcon), -#ifndef ZEPHIR_RELEASE - PHP_MSHUTDOWN(phalcon), -#else - NULL, -#endif - PHP_RINIT(phalcon), - PHP_RSHUTDOWN(phalcon), - PHP_MINFO(phalcon), - PHP_PHALCON_VERSION, - ZEND_MODULE_GLOBALS(phalcon), - PHP_GINIT(phalcon), - PHP_GSHUTDOWN(phalcon), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; +static int phalcon_jsmin(zval *return_value, zval *script TSRMLS_DC); -#ifdef COMPILE_DL_PHALCON -ZEND_GET_MODULE(phalcon) -#endif +#endif /* PHALCON_ASSETS_FILTERS_JSMINIFIER_H */ @@ -24217,7 +23344,7 @@ static PHP_METHOD(Phalcon_Loader, register) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 299, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 264, _1$$3); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24245,7 +23372,7 @@ static PHP_METHOD(Phalcon_Loader, unregister) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 300, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 265, _1$$3); zephir_check_call_status(); if (0) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24285,7 +23412,7 @@ static PHP_METHOD(Phalcon_Loader, loadFiles) { zephir_check_temp_parameter(_6$$4); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_7$$3)) { ZEPHIR_OBS_NVAR(_9$$5); @@ -24414,7 +23541,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_15$$11); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_17$$10)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24465,7 +23592,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_29$$16); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_31$$15)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24756,7 +23883,7 @@ static PHP_METHOD(Phalcon_Registry, next) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 417, _0); + ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 382, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24772,7 +23899,7 @@ static PHP_METHOD(Phalcon_Registry, key) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 418, _0); + ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24788,7 +23915,7 @@ static PHP_METHOD(Phalcon_Registry, rewind) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 419, _0); + ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 384, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24804,7 +23931,7 @@ static PHP_METHOD(Phalcon_Registry, valid) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 418, _0); + ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM_BOOL(Z_TYPE_P(_1) != IS_NULL); @@ -24820,7 +23947,7 @@ static PHP_METHOD(Phalcon_Registry, current) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 420, _0); + ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 385, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24848,7 +23975,7 @@ static PHP_METHOD(Phalcon_Registry, __set) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 421, key, value); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 386, key, value); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24875,7 +24002,7 @@ static PHP_METHOD(Phalcon_Registry, __get) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 422, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 387, key); zephir_check_call_status(); RETURN_MM(); @@ -24902,7 +24029,7 @@ static PHP_METHOD(Phalcon_Registry, __isset) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 423, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 388, key); zephir_check_call_status(); RETURN_MM(); @@ -24929,7 +24056,7 @@ static PHP_METHOD(Phalcon_Registry, __unset) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 424, key); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 389, key); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -25208,7 +24335,7 @@ static PHP_METHOD(Phalcon_Security, hash) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_security_exception_ce, "Unable to get random bytes for the salt", "phalcon/security.zep", 222); return; } - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, saltBytes); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, saltBytes); zephir_check_call_status(); RETURN_MM(); } @@ -25229,7 +24356,7 @@ static PHP_METHOD(Phalcon_Security, hash) { } ZEPHIR_INIT_VAR(_8$$15); ZEPHIR_CONCAT_SVSVS(_8$$15, "$", variant, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _8$$15); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _8$$15); zephir_check_call_status(); RETURN_MM(); } @@ -25256,7 +24383,7 @@ static PHP_METHOD(Phalcon_Security, hash) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_13$$17); ZEPHIR_CONCAT_SVSVSVS(_13$$17, "$2", variant, "$", _12$$17, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _13$$17); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _13$$17); zephir_check_call_status(); RETURN_MM(); } while(0); @@ -25296,7 +24423,7 @@ static PHP_METHOD(Phalcon_Security, checkHash) { RETURN_MM_BOOL(0); } } - ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 425, password, passwordHash); + ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 390, password, passwordHash); zephir_check_call_status(); zephir_get_strval(_2, _1); ZEPHIR_CPY_WRT(cryptedHash, _2); @@ -25551,7 +24678,7 @@ static PHP_METHOD(Phalcon_Security, computeHmac) { ZEPHIR_SINIT_VAR(_0); ZVAL_BOOL(&_0, (raw ? 1 : 0)); - ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 426, algo, data, key, &_0); + ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 391, algo, data, key, &_0); zephir_check_call_status(); if (!(zephir_is_true(hmac))) { ZEPHIR_INIT_VAR(_1$$3); @@ -27364,7 +26491,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_1)) { ZEPHIR_SINIT_VAR(_3$$3); - ZVAL_LONG(&_3$$3, 6); + ZVAL_LONG(&_3$$3, 0); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "en_US.UTF-8", 0); ZEPHIR_CALL_FUNCTION(&locale, "setlocale", &_5, 442, &_3$$3, &_4$$3); @@ -27435,7 +26562,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_19)) { ZEPHIR_SINIT_VAR(_20$$10); - ZVAL_LONG(&_20$$10, 6); + ZVAL_LONG(&_20$$10, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", &_5, 442, &_20$$10, locale); zephir_check_call_status(); } @@ -27804,13 +26931,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_STRING(&_0$$3, "a", 0); ZEPHIR_SINIT_VAR(_1$$3); ZVAL_STRING(&_1$$3, "z", 0); - ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$3); ZVAL_STRING(&_0$$3, "A", 0); ZEPHIR_SINIT_NVAR(_1$$3); ZVAL_STRING(&_1$$3, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(pool); zephir_fast_array_merge(pool, &(_2$$3), &(_4$$3) TSRMLS_CC); @@ -27821,13 +26948,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_5$$4, 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_LONG(&_6$$4, 9); - ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_5$$4); ZVAL_STRING(&_5$$4, "a", 0); ZEPHIR_SINIT_NVAR(_6$$4); ZVAL_STRING(&_6$$4, "f", 0); - ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(pool); zephir_fast_array_merge(pool, &(_7$$4), &(_8$$4) TSRMLS_CC); @@ -27838,7 +26965,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_9$$5, 0); ZEPHIR_SINIT_VAR(_10$$5); ZVAL_LONG(&_10$$5, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_9$$5, &_10$$5); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_9$$5, &_10$$5); zephir_check_call_status(); break; } @@ -27847,7 +26974,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_11$$6, 1); ZEPHIR_SINIT_VAR(_12$$6); ZVAL_LONG(&_12$$6, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_11$$6, &_12$$6); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_11$$6, &_12$$6); zephir_check_call_status(); break; } @@ -27855,21 +26982,21 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_13$$7, 0); ZEPHIR_SINIT_VAR(_14$$7); ZVAL_LONG(&_14$$7, 9); - ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "a", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "z", 0); - ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "A", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 447, _15$$7, _16$$7, _17$$7); + ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 412, _15$$7, _16$$7, _17$$7); zephir_check_call_status(); break; } while(0); @@ -28066,24 +27193,24 @@ static PHP_METHOD(Phalcon_Text, concat) { ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 449); + ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 414); zephir_check_call_status(); if (ZEPHIR_GT_LONG(_2, 3)) { ZEPHIR_CALL_FUNCTION(&_3$$3, "func_get_args", NULL, 176); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 396, _3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 361, _3$$3, &_4$$3); zephir_check_call_status(); zephir_is_iterable(_5$$3, &_7$$3, &_6$$3, 0, 0, "phalcon/text.zep", 256); for ( @@ -28179,24 +27306,24 @@ static PHP_METHOD(Phalcon_Text, dynamic) { } - ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 450, text, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 415, text, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 450, text, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 415, text, rightDelimiter); zephir_check_call_status(); if (!ZEPHIR_IS_IDENTICAL(_0, _2)) { ZEPHIR_INIT_VAR(_3$$3); object_init_ex(_3$$3, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(_4$$3); ZEPHIR_CONCAT_SVS(_4$$3, "Syntax error in string \"", text, "\""); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 451, _4$$3); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 416, _4$$3); zephir_check_call_status(); zephir_throw_exception_debug(_3$$3, "phalcon/text.zep", 283 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 452, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 417, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 452, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 417, rightDelimiter); zephir_check_call_status(); ZEPHIR_INIT_VAR(pattern); ZEPHIR_CONCAT_SVSVVSVS(pattern, "/", ldS, "([^", ldS, rdS, "]+)", rdS, "/"); @@ -28229,11 +27356,11 @@ static PHP_METHOD(Phalcon_Text, dynamic) { ZEPHIR_INIT_NVAR(words); zephir_fast_explode(words, separator, _12$$6, LONG_MAX TSRMLS_CC); ZEPHIR_OBS_NVAR(word); - ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 453, words); + ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 418, words); zephir_check_call_status(); zephir_array_fetch(&word, words, _13$$6, PH_NOISY, "phalcon/text.zep", 302 TSRMLS_CC); zephir_array_fetch_long(&_15$$6, match, 0, PH_NOISY | PH_READONLY, "phalcon/text.zep", 303 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 452, _15$$6, separator); + ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 417, _15$$6, separator); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_16$$6); ZEPHIR_CONCAT_SVS(_16$$6, "/", sub, "/"); @@ -28409,13 +27536,13 @@ static PHP_METHOD(Phalcon_Validation, __construct) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_INIT_NVAR(_0$$3); zephir_create_closure_ex(_0$$3, NULL, phalcon_0__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 463, validators, _0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 458, validators, _0$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_validators"), _1$$3 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_INIT_NVAR(_3$$3); zephir_create_closure_ex(_3$$3, NULL, phalcon_1__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 463, validators, _3$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 458, validators, _3$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_combinedFieldsValidators"), _4$$3 TSRMLS_CC); } @@ -28895,7 +28022,7 @@ static PHP_METHOD(Phalcon_Validation, appendMessage) { ZEPHIR_CALL_METHOD(NULL, messages, "__construct", NULL, 3); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 464, message); + ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 459, message); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); RETURN_THIS(); @@ -29319,7 +28446,7 @@ static PHP_METHOD(Phalcon_Version, get) { zephir_array_fetch_long(&specialNumber, version, 4, PH_NOISY, "phalcon/version.zep", 143 TSRMLS_CC); ZEPHIR_INIT_VAR(result); ZEPHIR_CONCAT_VSVSVS(result, major, ".", medium, ".", minor, " "); - ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 474, special); + ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 469, special); zephir_check_call_status(); if (!ZEPHIR_IS_STRING(suffix, "")) { ZEPHIR_INIT_VAR(_1$$3); @@ -29386,7 +28513,7 @@ static PHP_METHOD(Phalcon_Version, getPart) { } if (part == 3) { zephir_array_fetch_long(&_1$$4, version, 3, PH_NOISY | PH_READONLY, "phalcon/version.zep", 204 TSRMLS_CC); - ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 474, _1$$4); + ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 469, _1$$4); zephir_check_call_status(); break; } @@ -31276,428 +30403,6 @@ static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedParameter) { - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { - - smart_str_appendc(&processed_str, ch); - i++; - - open_parentheses = 0; - for (j = i; j < length; j++) { - - ch = comment[j]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (open_parentheses == 0) { - - if (isalnum(ch) || '_' == ch || '\\' == ch) { - smart_str_appendc(&processed_str, ch); - continue; - } - - if (ch == '(') { - smart_str_appendc(&processed_str, ch); - open_parentheses++; - continue; - } - - } else { - - smart_str_appendc(&processed_str, ch); - - if (ch == '(') { - open_parentheses++; - } else { - if (ch == ')') { - open_parentheses--; - } else { - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - } - - if (open_parentheses > 0) { - continue; - } - } - - i = j; - smart_str_appendc(&processed_str, ' '); - break; - } - } - - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - - smart_str_0(&processed_str); - -#if PHP_VERSION_ID < 70000 - if (processed_str.len) { - *ret = processed_str.c; - *ret_len = processed_str.len; - } else { - *ret = NULL; - *ret_len = 0; - } -#else - if (processed_str.s) { - *ret = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s)); - *ret_len = ZSTR_LEN(processed_str.s); - smart_str_free(&processed_str); - } else { - *ret = NULL; - *ret_len = 0; - } -#endif -} - -static int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg TSRMLS_DC) -{ - phannot_scanner_state *state; - phannot_scanner_token token; - int start_lines; - int scanner_status, status = SUCCESS; - phannot_parser_status *parser_status = NULL; - void* phannot_parser; - char *processed_comment; - int processed_comment_len; - - *error_msg = NULL; - - if (UNEXPECTED(!comment)) { - ZVAL_BOOL(*result, 0); - spprintf(error_msg, 0, "Empty annotation"); - return FAILURE; - } - - if (comment_len < 2) { - ZVAL_BOOL(*result, 0); - return SUCCESS; - } - - phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines); - - if (processed_comment_len < 2) { - ZVAL_BOOL(*result, 0); - if (processed_comment) { - efree(processed_comment); - } - - return SUCCESS; - } - - phannot_parser = phannot_Alloc(phannot_wrapper_alloc); - if (unlikely(!phannot_parser)) { - ZVAL_BOOL(*result, 0); - return FAILURE; - } - - parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state)); - state = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status)); - - parser_status->status = PHANNOT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - state->active_token = 0; - state->start = processed_comment; - state->start_length = 0; - state->mode = PHANNOT_MODE_RAW; - state->active_file = file_path; - - token.value = NULL; - token.len = 0; - - if (line) { - state->active_line = line - start_lines; - } else { - state->active_line = 1; - } - - state->end = state->start; - - while(0 <= (scanner_status = phannot_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = processed_comment + processed_comment_len - state->start; - - switch (token.opcode) { - - case PHANNOT_T_IGNORE: - break; - - case PHANNOT_T_AT: - phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status); - break; - case PHANNOT_T_COMMA: - phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status); - break; - case PHANNOT_T_EQUALS: - phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status); - break; - case PHANNOT_T_COLON: - phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status); - break; - - case PHANNOT_T_PARENTHESES_OPEN: - phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHANNOT_T_PARENTHESES_CLOSE: - phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_BRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_BRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_SBRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_SBRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_NULL: - phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status); - break; - case PHANNOT_T_TRUE: - phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status); - break; - case PHANNOT_T_FALSE: - phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status); - break; - - case PHANNOT_T_INTEGER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status); - break; - case PHANNOT_T_DOUBLE: - phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status); - break; - case PHANNOT_T_STRING: - phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status); - break; - case PHANNOT_T_IDENTIFIER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status); - break; - /*case PHANNOT_T_ARBITRARY_TEXT: - phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status); - break;*/ - - default: - parser_status->status = PHANNOT_PARSING_FAILED; - if (!*error_msg) { - spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line); - } - break; - } - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHANNOT_SCANNER_RETCODE_ERR: - case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phannot_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - status = FAILURE; - break; - - default: - phannot_(phannot_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { - if (!*error_msg) { - *error_msg = parser_status->syntax_error; - } else { - efree(parser_status->syntax_error); - } - } - } - - phannot_Free(phannot_parser, phannot_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHANNOT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - } - } - - efree(processed_comment); - efree(parser_status); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -31967,4374 +30672,968 @@ ZEPHIR_INIT_CLASS(Phalcon_Annotations_Exception) { +#if PHP_VERSION_ID < 70000 +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +// 28 "parser.php5.lemon" -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 +// 12 "parser.php5.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 #endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** AACODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** AANOCODE is a number of type AACODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** AAFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** AAACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** phannot_TOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** AAMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval* aa36; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < AANSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. +** +** N == AANSTATE+AANRULE A syntax error has occurred. +** +** N == AANSTATE+AANRULE+1 The parser accepts its input. +** +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. +** +** The action table is constructed as a single large table named aa_action[]. +** Given state S and lookahead X, the action is computed as +** +** aa_action[ aa_shift_ofst[S] + X ] +** +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for +** shifting terminals. +** aa_reduce_ofst[] For each state, the offset into aa_action for +** shifting non-terminals after a reduce. +** aa_default[] Default action for each state. +*/ +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ +static AACODETYPE aa_lookahead[] = { + /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, + /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, + /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, + /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, + /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, + /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, + /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, + /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, + /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, }; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ +#define AA_SHIFT_USE_DFLT (-3) +static signed char aa_shift_ofst[] = { + /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, + /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, + /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, + /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, }; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ +#define AA_REDUCE_USE_DFLT (-21) +static signed char aa_reduce_ofst[] = { + /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, + /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, + /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, + /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, }; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ +static AAACTIONTYPE aa_default[] = { + /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, + /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, + /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, + /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, }; +#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef AAFALLBACK +static const AACODETYPE aaFallback[] = { }; +#endif /* AAFALLBACK */ -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct aaStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + AAMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ }; +typedef struct aaStackEntry aaStackEntry; -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct aaParser { + int aaidx; /* Index of top element in stack */ + int aaerrcnt; /* Shifts left before out of the error */ + phannot_ARG_SDECL /* A place to hold %extra_argument */ + aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ }; +typedef struct aaParser aaParser; -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) +#ifndef NDEBUG +static FILE *aaTraceFILE = 0; +static char *aaTracePrompt = 0; +#endif /* NDEBUG */ -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); +#ifndef NDEBUG +static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ + aaTraceFILE = TraceFILE; + aaTracePrompt = zTracePrompt; + if( aaTraceFILE==0 ) aaTracePrompt = 0; + else if( aaTracePrompt==0 ) aaTraceFILE = 0; } +#endif /* NDEBUG */ -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *aaTokenName[] = { + "$", "COMMA", "AT", "IDENTIFIER", + "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", + "COLON", "INTEGER", "DOUBLE", "NULL", + "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", + "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", + "annotation_language", "annotation_list", "annotation", "argument_list", + "argument_item", "expr", "array", +}; +#endif /* NDEBUG */ -/* Add a new action to the current transaction set +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. */ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; +static const char *aaRuleName[] = { + /* 0 */ "program ::= annotation_language", + /* 1 */ "annotation_language ::= annotation_list", + /* 2 */ "annotation_list ::= annotation_list annotation", + /* 3 */ "annotation_list ::= annotation", + /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", + /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", + /* 6 */ "annotation ::= AT IDENTIFIER", + /* 7 */ "argument_list ::= argument_list COMMA argument_item", + /* 8 */ "argument_list ::= argument_item", + /* 9 */ "argument_item ::= expr", + /* 10 */ "argument_item ::= STRING EQUALS expr", + /* 11 */ "argument_item ::= STRING COLON expr", + /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", + /* 13 */ "argument_item ::= IDENTIFIER COLON expr", + /* 14 */ "expr ::= annotation", + /* 15 */ "expr ::= array", + /* 16 */ "expr ::= IDENTIFIER", + /* 17 */ "expr ::= INTEGER", + /* 18 */ "expr ::= STRING", + /* 19 */ "expr ::= DOUBLE", + /* 20 */ "expr ::= NULL", + /* 21 */ "expr ::= FALSE", + /* 22 */ "expr ::= TRUE", + /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", + /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", +}; +#endif /* NDEBUG */ + +const char *phannot_TokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ + return aaTokenName[tokenType]; }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } + return "Unknown"; } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; +#else + return ""; +#endif } -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; +void *phannot_Alloc(void *(*mallocProc)(size_t)){ + aaParser *pParser; + pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); + if( pParser ){ + pParser->aaidx = -1; } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); + return pParser; } -/********************** From the file "build.c" *****************************/ -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "aamajor" is the symbol code, and "aapminor" is a pointer to +** the value. */ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; +static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ + switch( aamajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: +// 77 "parser.php5.lemon" +{ + if ((aapminor->aa0)) { + if ((aapminor->aa0)->free_flag) { + efree((aapminor->aa0)->token); + } + efree((aapminor->aa0)); } - } - } - } - return; } - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; +// 378 "parser.php5.c" + break; + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: +// 90 "parser.php5.lemon" { - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; + zval_ptr_dtor(&(aapminor->aa36)); } - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); +// 390 "parser.php5.c" + break; + default: break; /* If no destructor action specified: do nothing */ } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; } -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ +static int aa_pop_parser_stack(aaParser *pParser){ + AACODETYPE aamajor; + aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + + if( pParser->aaidx<0 ) return 0; +#ifndef NDEBUG + if( aaTraceFILE && pParser->aaidx>=0 ){ + fprintf(aaTraceFILE,"%sPopping %s\n", + aaTracePrompt, + aaTokenName[aatos->major]); } - return stp; +#endif + aamajor = aatos->major; + aa_destructor( aamajor, &aatos->minor); + pParser->aaidx--; + return aamajor; } -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } +static void phannot_Free( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + aaParser *pParser = (aaParser*)p; + if( pParser==0 ) return; + while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); } -void FindLinks(lemp) -struct lemon *lemp; -{ +static int aa_find_shift_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ + i = aa_shift_ofst[stateno]; + if( i==AA_SHIFT_USE_DFLT ){ + return aa_default[stateno]; } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ +#ifdef AAFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead %s\n", + aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); } +#endif + return aa_find_shift_action(pParser, iFallback); } +#endif + return aa_default[stateno]; + }else{ + return aa_action[i]; } } -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ +static int aa_find_reduce_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + i = aa_reduce_ofst[stateno]; + if( i==AA_REDUCE_USE_DFLT ){ + return aa_default[stateno]; } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ + return aa_default[stateno]; }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; + return aa_action[i]; } } -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ +static void aa_shift( + aaParser *aapParser, /* The parser to be shifted */ + int aaNewState, /* The new state to shift in */ + int aaMajor, /* The major token to shift in */ + AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ +){ + aaStackEntry *aatos; + aapParser->aaidx++; + if( aapParser->aaidx>=AASTACKDEPTH ){ + phannot_ARG_FETCH; + aapParser->aaidx--; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); + } +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ + aatos = &aapParser->aastack[aapParser->aaidx]; + aatos->stateno = aaNewState; + aatos->major = aaMajor; + aatos->minor = *aapMinor; +#ifndef NDEBUG + if( aaTraceFILE && aapParser->aaidx>0 ){ int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; iaaidx; i++) + fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); + fprintf(aaTraceFILE,"\n"); } - new = freelist; - freelist = freelist->next; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; +#endif } -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static struct { + AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} aaRuleInfo[] = { + { 19, 1 }, + { 20, 1 }, + { 21, 2 }, + { 21, 1 }, + { 22, 5 }, + { 22, 4 }, + { 22, 2 }, + { 23, 3 }, + { 23, 1 }, + { 24, 1 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 26, 3 }, + { 26, 3 }, +}; -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} +static void aa_accept(aaParser*); /* Forward Declaration */ -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; iaastack[aapParser->aaidx]; +#ifndef NDEBUG + if( aaTraceFILE && aaruleno>=0 + && aaruleno + ** { ... } // User supplied code + ** // + ** break; + */ + case 0: +// 86 "parser.php5.lemon" { - int i; - int dashdash = 0; - if( argv!=0 && *argv!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ){ - if( n==0 ) return i; - n--; - } - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return -1; + status->ret = aamsp[0].minor.aa36; } - -static char emsg[] = "Command line syntax error: "; - -static int handleflags(i,err) -int i; -FILE *err; -{ - int v; - int errcnt = 0; - int j; - for(j=0; op[j].label; j++){ - if( strncmp(&argv[i][1],op[j].label,strlen(op[j].label))==0 ) break; - } - v = argv[i][0]=='-' ? 1 : 0; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,1,err); - } - errcnt++; - }else if( op[j].type==OPT_FLAG ){ - *((int*)op[j].arg) = v; - }else if( op[j].type==OPT_FFLAG ){ - (*(void(*)())(op[j].arg))(v); - }else if( op[j].type==OPT_FSTR ){ - (*(void(*)())(op[j].arg))(&argv[i][2]); - }else{ - if( err ){ - fprintf(err,"%smissing argument on switch.\n",emsg); - errline(i,1,err); - } - errcnt++; - } - return errcnt; -} - -static int handleswitch(i,err) -int i; -FILE *err; -{ - int lv = 0; - double dv = 0.0; - char *sv = 0, *end; - char *cp; - int j; - int errcnt = 0; - cp = strchr(argv[i],'='); - *cp = 0; - for(j=0; op[j].label; j++){ - if( strcmp(argv[i],op[j].label)==0 ) break; - } - *cp = '='; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,0,err); - } - errcnt++; - }else{ - cp++; - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - if( err ){ - fprintf(err,"%soption requires an argument.\n",emsg); - errline(i,0,err); - } - errcnt++; - break; - case OPT_DBL: - case OPT_FDBL: - dv = strtod(cp,&end); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in floating-point argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_INT: - case OPT_FINT: - lv = strtol(cp,&end,0); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in integer argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_STR: - case OPT_FSTR: - sv = cp; - break; - } - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_DBL: - *(double*)(op[j].arg) = dv; - break; - case OPT_FDBL: - (*(void(*)())(op[j].arg))(dv); - break; - case OPT_INT: - *(int*)(op[j].arg) = lv; - break; - case OPT_FINT: - (*(void(*)())(op[j].arg))((int)lv); - break; - case OPT_STR: - *(char**)(op[j].arg) = sv; - break; - case OPT_FSTR: - (*(void(*)())(op[j].arg))(sv); +// 632 "parser.php5.c" break; - } - } - return errcnt; -} - -int OptInit(a,o,err) -char **a; -struct s_options *o; -FILE *err; -{ - int errcnt = 0; - argv = a; - op = o; - errstream = err; - if( argv && *argv && op ){ - int i; - for(i=1; argv[i]; i++){ - if( argv[i][0]=='+' || argv[i][0]=='-' ){ - errcnt += handleflags(i,err); - }else if( strchr(argv[i],'=') ){ - errcnt += handleswitch(i,err); - } - } - } - if( errcnt>0 ){ - fprintf(err,"Valid command line options for \"%s\" are:\n",*a); - OptPrint(); - exit(1); - } - return 0; -} - -int OptNArgs(){ - int cnt = 0; - int dashdash = 0; - int i; - if( argv!=0 && argv[0]!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ) cnt++; - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return cnt; -} - -char *OptArg(n) -int n; + case 1: + case 14: + case 15: +// 94 "parser.php5.lemon" { - int i; - i = argindex(n); - return i>=0 ? argv[i] : 0; + aagotominor.aa36 = aamsp[0].minor.aa36; } - -void OptErr(n) -int n; +// 641 "parser.php5.c" + break; + case 2: +// 102 "parser.php5.lemon" { - int i; - i = argindex(n); - if( i>=0 ) errline(i,0,errstream); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); } - -void OptPrint(){ - int i; - int max, len; - max = 0; - for(i=0; op[i].label; i++){ - len = strlen(op[i].label) + 1; - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_INT: - case OPT_FINT: - len += 9; /* length of "" */ - break; - case OPT_DBL: - case OPT_FDBL: - len += 6; /* length of "" */ - break; - case OPT_STR: - case OPT_FSTR: - len += 8; /* length of "" */ - break; - } - if( len>max ) max = len; - } - for(i=0; op[i].label; i++){ - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - fprintf(errstream," -%-*s %s\n",max,op[i].label,op[i].message); - break; - case OPT_INT: - case OPT_FINT: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-9),"",op[i].message); - break; - case OPT_DBL: - case OPT_FDBL: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-6),"",op[i].message); - break; - case OPT_STR: - case OPT_FSTR: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-8),"",op[i].message); +// 648 "parser.php5.c" break; - } - } -} -/*********************** From the file "parse.c" ****************************/ - -/* The state of the parser */ -struct pstate { - char *filename; /* Name of the input file */ - int tokenlineno; /* Linenumber at which current token starts */ - int errorcnt; /* Number of errors so far */ - char *tokenstart; /* Text of current token */ - struct lemon *gp; /* Global state vector */ - enum e_state { - INITIALIZE, - WAITING_FOR_DECL_OR_RULE, - WAITING_FOR_DECL_KEYWORD, - WAITING_FOR_DECL_ARG, - WAITING_FOR_PRECEDENCE_SYMBOL, - WAITING_FOR_ARROW, - IN_RHS, - LHS_ALIAS_1, - LHS_ALIAS_2, - LHS_ALIAS_3, - RHS_ALIAS_1, - RHS_ALIAS_2, - PRECEDENCE_MARK_1, - PRECEDENCE_MARK_2, - RESYNC_AFTER_RULE_ERROR, - RESYNC_AFTER_DECL_ERROR, - WAITING_FOR_DESTRUCTOR_SYMBOL, - WAITING_FOR_DATATYPE_SYMBOL, - WAITING_FOR_FALLBACK_ID - } state; /* The state of the parser */ - struct symbol *fallback; /* The fallback token */ - struct symbol *lhs; /* Left-hand side of current rule */ - char *lhsalias; /* Alias for the LHS */ - int nrhs; /* Number of right-hand side symbols seen */ - struct symbol *rhs[MAXRHS]; /* RHS symbols */ - char *alias[MAXRHS]; /* Aliases for each RHS symbol (or NULL) */ - struct rule *prevrule; /* Previous rule parsed */ - char *declkeyword; /* Keyword of a declaration */ - char **declargslot; /* Where the declaration argument should be put */ - int *decllnslot; /* Where the declaration linenumber is put */ - enum e_assoc declassoc; /* Assign this association to decl arguments */ - int preccounter; /* Assign this precedence to decl arguments */ - struct rule *firstrule; /* Pointer to first rule in the grammar */ - struct rule *lastrule; /* Pointer to the most recently parsed rule */ -}; - -/* Parse a single token */ -static void parseonetoken(psp) -struct pstate *psp; + case 3: + case 8: +// 106 "parser.php5.lemon" { - char *x; - x = Strsafe(psp->tokenstart); /* Save the token permanently */ -#if 0 - printf("%s:%d: Token=[%s] state=%d\n",psp->filename,psp->tokenlineno, - x,psp->state); -#endif - switch( psp->state ){ - case INITIALIZE: - psp->prevrule = 0; - psp->preccounter = 0; - psp->firstrule = psp->lastrule = 0; - psp->gp->nrule = 0; - /* Fall thru to next case */ - case WAITING_FOR_DECL_OR_RULE: - if( x[0]=='%' ){ - psp->state = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } + aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); } - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; +// 656 "parser.php5.c" + break; + case 4: +// 114 "parser.php5.lemon" { - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + aa_destructor(2,&aamsp[-4].minor); + aa_destructor(4,&aamsp[-2].minor); + aa_destructor(5,&aamsp[0].minor); } -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; +// 666 "parser.php5.c" + break; + case 5: +// 118 "parser.php5.lemon" { - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-3].minor); + aa_destructor(4,&aamsp[-1].minor); + aa_destructor(5,&aamsp[0].minor); } - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; +// 676 "parser.php5.c" + break; + case 6: +// 122 "parser.php5.lemon" { - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-1].minor); } - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; +// 684 "parser.php5.c" + break; + case 7: +// 130 "parser.php5.lemon" { - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + aa_destructor(1,&aamsp[-1].minor); } - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; +// 692 "parser.php5.c" + break; + case 9: +// 142 "parser.php5.lemon" { - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; + aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); } - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; +// 699 "parser.php5.c" + break; + case 10: + case 12: +// 146 "parser.php5.lemon" { - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(7,&aamsp[-1].minor); } - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; +// 708 "parser.php5.c" + break; + case 11: + case 13: +// 150 "parser.php5.lemon" { - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(8,&aamsp[-1].minor); } - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; +// 717 "parser.php5.c" + break; + case 16: +// 174 "parser.php5.lemon" { - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; +// 724 "parser.php5.c" break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; + case 17: +// 178 "parser.php5.lemon" { - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; +// 731 "parser.php5.c" + break; + case 18: +// 182 "parser.php5.lemon" { - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); } - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; +// 738 "parser.php5.c" + break; + case 19: +// 186 "parser.php5.lemon" { - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } + aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + aa_destructor(16,&aamsp[-2].minor); + aa_destructor(17,&aamsp[0].minor); } -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; +// 787 "parser.php5.c" + break; + }; + aagoto = aaRuleInfo[aaruleno].lhs; + aasize = aaRuleInfo[aaruleno].nrhs; + aapParser->aaidx -= aasize; + aaact = aa_find_reduce_action(aapParser,aagoto); + if( aaact < AANSTATE ){ + aa_shift(aapParser,aaact,aagoto,&aagotominor); + }else if( aaact == AANSTATE + AANRULE + 1 ){ + aa_accept(aapParser); } - return np ? np->data : 0; } -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); +static void aa_parse_failed( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; +static void aa_syntax_error( + aaParser *aapParser, /* The parser */ + int aamajor, /* The major type of the error token */ + AAMINORTYPE aaminor /* The minor type of the error token */ +){ + phannot_ARG_FETCH; +#define ATOKEN (aaminor.aa0) +// 32 "parser.php5.lemon" -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} + if (status->scanner_state->start_length) { + char *token_name = NULL; + const phannot_token_names *tokens = phannot_tokens; + uint active_token = status->scanner_state->active_token; + uint near_length = status->scanner_state->start_length; -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} + if (active_token) { + do { + if (tokens->code == active_token) { + token_name = tokens->name; + break; + } + ++tokens; + } while (tokens[0].code != 0); + } -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} + if (!token_name) { + token_name = "UNKNOWN"; + } -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} + if (near_length > 0) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + if (active_token != PHANNOT_T_IGNORE) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); + } + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + } -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} + status->status = PHANNOT_PARSING_FAILED; -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; +// 874 "parser.php5.c" + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; +static void aa_accept( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x3". +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "phannot_Alloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. */ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; +static void phannot_( + void *aap, /* The parser */ + int aamajor, /* The major token code number */ + phannot_TOKENTYPE aaminor /* The value for the token */ + phannot_ARG_PDECL /* Optional %extra_argument parameter */ +){ + AAMINORTYPE aaminorunion; + int aaact; /* The parser action. */ + int aaendofinput; /* True if we are at the end of input */ + int aaerrorhit = 0; /* True if aamajor has invoked an error */ + aaParser *aapParser; /* The parser */ -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; + /* (re)initialize the parser, if necessary */ + aapParser = (aaParser*)aap; + if( aapParser->aaidx<0 ){ + if( aamajor==0 ) return; + aapParser->aaidx = 0; + aapParser->aaerrcnt = -1; + aapParser->aastack[0].stateno = 0; + aapParser->aastack[0].major = 0; } - return np ? np->data : 0; -} + aaminorunion.aa0 = aaminor; + aaendofinput = (aamajor==0); + phannot_ARG_STORE; -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; +#endif -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; + do{ + aaact = aa_find_shift_action(aapParser,aamajor); + if( aaactaaerrcnt--; + if( aaendofinput && aapParser->aaidx>=0 ){ + aamajor = 0; + }else{ + aamajor = AANOCODE; + } + }else if( aaact < AANSTATE + AANRULE ){ + aa_reduce(aapParser,aaact-AANSTATE); + }else if( aaact == AA_ERROR_ACTION ){ + int aamx; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); + } +#endif +#ifdef AAERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( aapParser->aaerrcnt<0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aamx = aapParser->aastack[aapParser->aaidx].major; + if( aamx==AAERRORSYMBOL || aaerrorhit ){ +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sDiscard input token %s\n", + aaTracePrompt,aaTokenName[aamajor]); + } +#endif + aa_destructor(aamajor,&aaminorunion); + aamajor = AANOCODE; + }else{ + while( + aapParser->aaidx >= 0 && + aamx != AAERRORSYMBOL && + (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE + ){ + aa_pop_parser_stack(aapParser); + } + if( aapParser->aaidx < 0 || aamajor==0 ){ + aa_destructor(aamajor,&aaminorunion); + aa_parse_failed(aapParser); + aamajor = AANOCODE; + }else if( aamx!=AAERRORSYMBOL ){ + AAMINORTYPE u2; + u2.AAERRSYMDT = 0; + aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); + } + } + aapParser->aaerrcnt = 3; + aaerrorhit = 1; +#else /* AAERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( aapParser->aaerrcnt<=0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aapParser->aaerrcnt = 3; + aa_destructor(aamajor,&aaminorunion); + if( aaendofinput ){ + aa_parse_failed(aapParser); + } + aamajor = AANOCODE; +#endif }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; + aa_accept(aapParser); + aamajor = AANOCODE; } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; + }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 28 "parser.php7.lemon" + + +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -36342,41 +31641,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** AACODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** AANOCODE is a number of type AACODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** AAFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** AAACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phannot_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** AAMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval aa8; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -36386,670 +31702,55 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < AANSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == AANSTATE+AANRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == AANSTATE+AANRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named aa_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** aa_action[ aa_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** aa_reduce_ofst[] For each state, the offset into aa_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. +** aa_default[] Default action for each state. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval* aa36; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; static AACODETYPE aa_lookahead[] = { /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, @@ -37245,7 +31946,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 15: case 16: case 17: -// 77 "parser.php5.lemon" +// 77 "parser.php7.lemon" { if ((aapminor->aa0)) { if ((aapminor->aa0)->free_flag) { @@ -37254,7 +31955,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ efree((aapminor->aa0)); } } -// 378 "parser.php5.c" +// 378 "parser.php7.c" break; case 20: case 21: @@ -37262,11 +31963,11 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 23: case 24: case 25: -// 90 "parser.php5.lemon" +// 90 "parser.php7.lemon" { - zval_ptr_dtor(&(aapminor->aa36)); + zval_ptr_dtor(&(aapminor->aa8)); } -// 390 "parser.php5.c" +// 390 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } @@ -37461,166 +32162,166 @@ static void aa_reduce( ** break; */ case 0: -// 86 "parser.php5.lemon" +// 86 "parser.php7.lemon" { - status->ret = aamsp[0].minor.aa36; + ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); } -// 632 "parser.php5.c" +// 632 "parser.php7.c" break; case 1: case 14: case 15: -// 94 "parser.php5.lemon" +// 94 "parser.php7.lemon" { - aagotominor.aa36 = aamsp[0].minor.aa36; + aagotominor.aa8 = aamsp[0].minor.aa8; } -// 641 "parser.php5.c" +// 641 "parser.php7.c" break; case 2: -// 102 "parser.php5.lemon" +// 102 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); } -// 648 "parser.php5.c" +// 648 "parser.php7.c" break; case 3: case 8: -// 106 "parser.php5.lemon" +// 106 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 656 "parser.php5.c" +// 656 "parser.php7.c" break; case 4: -// 114 "parser.php5.lemon" +// 114 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); aa_destructor(2,&aamsp[-4].minor); aa_destructor(4,&aamsp[-2].minor); aa_destructor(5,&aamsp[0].minor); } -// 666 "parser.php5.c" +// 666 "parser.php7.c" break; case 5: -// 118 "parser.php5.lemon" +// 118 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-3].minor); aa_destructor(4,&aamsp[-1].minor); aa_destructor(5,&aamsp[0].minor); } -// 676 "parser.php5.c" +// 676 "parser.php7.c" break; case 6: -// 122 "parser.php5.lemon" +// 122 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-1].minor); } -// 684 "parser.php5.c" +// 684 "parser.php7.c" break; case 7: -// 130 "parser.php5.lemon" +// 130 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); aa_destructor(1,&aamsp[-1].minor); } -// 692 "parser.php5.c" +// 692 "parser.php7.c" break; case 9: -// 142 "parser.php5.lemon" +// 142 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 699 "parser.php5.c" +// 699 "parser.php7.c" break; case 10: case 12: -// 146 "parser.php5.lemon" +// 146 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(7,&aamsp[-1].minor); } -// 708 "parser.php5.c" +// 708 "parser.php7.c" break; case 11: case 13: -// 150 "parser.php5.lemon" +// 150 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(8,&aamsp[-1].minor); } -// 717 "parser.php5.c" +// 717 "parser.php7.c" break; case 16: -// 174 "parser.php5.lemon" +// 174 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } -// 724 "parser.php5.c" +// 724 "parser.php7.c" break; case 17: -// 178 "parser.php5.lemon" +// 178 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } -// 731 "parser.php5.c" +// 731 "parser.php7.c" break; case 18: -// 182 "parser.php5.lemon" +// 182 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); } -// 738 "parser.php5.c" +// 738 "parser.php7.c" break; case 19: -// 186 "parser.php5.lemon" +// 186 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); } -// 745 "parser.php5.c" +// 745 "parser.php7.c" break; case 20: -// 190 "parser.php5.lemon" +// 190 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); aa_destructor(11,&aamsp[0].minor); } -// 753 "parser.php5.c" +// 753 "parser.php7.c" break; case 21: -// 194 "parser.php5.lemon" +// 194 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); aa_destructor(12,&aamsp[0].minor); } -// 761 "parser.php5.c" +// 761 "parser.php7.c" break; case 22: -// 198 "parser.php5.lemon" +// 198 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); aa_destructor(13,&aamsp[0].minor); } -// 769 "parser.php5.c" +// 769 "parser.php7.c" break; case 23: -// 202 "parser.php5.lemon" +// 202 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(14,&aamsp[-2].minor); aa_destructor(15,&aamsp[0].minor); } -// 778 "parser.php5.c" +// 778 "parser.php7.c" break; case 24: -// 206 "parser.php5.lemon" +// 206 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(16,&aamsp[-2].minor); aa_destructor(17,&aamsp[0].minor); } -// 787 "parser.php5.c" +// 787 "parser.php7.c" break; }; aagoto = aaRuleInfo[aaruleno].lhs; @@ -37656,7 +32357,7 @@ static void aa_syntax_error( ){ phannot_ARG_FETCH; #define ATOKEN (aaminor.aa0) -// 32 "parser.php5.lemon" +// 32 "parser.php7.lemon" if (status->scanner_state->start_length) { char *token_name = NULL; @@ -37701,7 +32402,7 @@ static void aa_syntax_error( status->status = PHANNOT_PARSING_FAILED; -// 874 "parser.php5.c" +// 874 "parser.php7.c" phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -37869,1082 +32570,133 @@ static void phannot_( }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php7.lemon" - - -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval aa8; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static AACODETYPE aa_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define AA_SHIFT_USE_DFLT (-3) -static signed char aa_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define AA_REDUCE_USE_DFLT (-21) -static signed char aa_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static AAACTIONTYPE aa_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef AAFALLBACK -static const AACODETYPE aaFallback[] = { +const phannot_token_names phannot_tokens[] = +{ + { "INTEGER", PHANNOT_T_INTEGER }, + { "DOUBLE", PHANNOT_T_DOUBLE }, + { "STRING", PHANNOT_T_STRING }, + { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, + { "@", PHANNOT_T_AT }, + { ",", PHANNOT_T_COMMA }, + { "=", PHANNOT_T_EQUALS }, + { ":", PHANNOT_T_COLON }, + { "(", PHANNOT_T_PARENTHESES_OPEN }, + { ")", PHANNOT_T_PARENTHESES_CLOSE }, + { "{", PHANNOT_T_BRACKET_OPEN }, + { "}", PHANNOT_T_BRACKET_CLOSE }, + { "[", PHANNOT_T_SBRACKET_OPEN }, + { "]", PHANNOT_T_SBRACKET_CLOSE }, + { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, + { NULL, 0 } }; -#endif /* AAFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct aaStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - AAMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct aaStackEntry aaStackEntry; +static void *phannot_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct aaParser { - int aaidx; /* Index of top element in stack */ - int aaerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ -}; -typedef struct aaParser aaParser; +static void phannot_wrapper_free(void *pointer){ + efree(pointer); +} -#ifndef NDEBUG -static FILE *aaTraceFILE = 0; -static char *aaTracePrompt = 0; -#endif /* NDEBUG */ +static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - aaTraceFILE = TraceFILE; - aaTracePrompt = zTracePrompt; - if( aaTraceFILE==0 ) aaTracePrompt = 0; - else if( aaTracePrompt==0 ) aaTraceFILE = 0; -} -#endif /* NDEBUG */ + phannot_parser_token *pToken; -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *aaTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ + pToken = emalloc(sizeof(phannot_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *aaRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + phannot_(phannot_parser, parsercode, pToken, parser_status); -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ - return aaTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif + token->value = NULL; + token->len = 0; } -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - aaParser *pParser; - pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); - if( pParser ){ - pParser->aaidx = -1; - } - return pParser; +static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ + + phannot_scanner_state *state = parser_status->scanner_state; + + if (state->start) { + if (state->start_length > 16) { + spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); + } else { + spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); + } + } else { + spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); + } } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "aamajor" is the symbol code, and "aapminor" is a pointer to -** the value. -*/ -static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ - switch( aamajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -// 77 "parser.php7.lemon" -{ - if ((aapminor->aa0)) { - if ((aapminor->aa0)->free_flag) { - efree((aapminor->aa0)->token); +static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { + + char *comment_str; + int comment_len; + char *file_path_str; + int line_num; + + char *error_msg = NULL; + + ZVAL_NULL(result); + + if (Z_TYPE_P(comment) == IS_STRING) { + comment_str = Z_STRVAL_P(comment); + comment_len = Z_STRLEN_P(comment); + } else { + comment_str = ""; + comment_len = 0; + } + + if (Z_TYPE_P(file_path) == IS_STRING) { + file_path_str = Z_STRVAL_P(file_path); + } else { + file_path_str = "eval"; + } + + if (Z_TYPE_P(line) == IS_LONG) { + line_num = Z_LVAL_P(line); + } else { + line_num = 0; + } + + if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { + if (likely(error_msg != NULL)) { + zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); + efree(error_msg); + } else { + zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); } - efree((aapminor->aa0)); + + return FAILURE; } + + return SUCCESS; } -// 378 "parser.php7.c" - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -// 90 "parser.php7.lemon" + +static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) { - zval_ptr_dtor(&(aapminor->aa8)); -} -// 390 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} + char ch; + int start_mode = 1, j, i, open_parentheses; + smart_str processed_str = {0}; -static int aa_pop_parser_stack(aaParser *pParser){ - AACODETYPE aamajor; - aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + (*start_lines) = 0; - if( pParser->aaidx<0 ) return 0; -#ifndef NDEBUG - if( aaTraceFILE && pParser->aaidx>=0 ){ - fprintf(aaTraceFILE,"%sPopping %s\n", - aaTracePrompt, - aaTokenName[aatos->major]); - } -#endif - aamajor = aatos->major; - aa_destructor( aamajor, &aatos->minor); - pParser->aaidx--; - return aamajor; -} + for (i = 0; i < length; i++) { -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - aaParser *pParser = (aaParser*)p; - if( pParser==0 ) return; - while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} + ch = comment[i]; -static int aa_find_shift_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ - i = aa_shift_ofst[stateno]; - if( i==AA_SHIFT_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ -#ifdef AAFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); - } -#endif - return aa_find_shift_action(pParser, iFallback); - } -#endif - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} + if (start_mode) { + if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { + continue; + } + start_mode = 0; + } -static int aa_find_reduce_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - i = aa_reduce_ofst[stateno]; - if( i==AA_REDUCE_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} - -static void aa_shift( - aaParser *aapParser, /* The parser to be shifted */ - int aaNewState, /* The new state to shift in */ - int aaMajor, /* The major token to shift in */ - AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ -){ - aaStackEntry *aatos; - aapParser->aaidx++; - if( aapParser->aaidx>=AASTACKDEPTH ){ - phannot_ARG_FETCH; - aapParser->aaidx--; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - aatos = &aapParser->aastack[aapParser->aaidx]; - aatos->stateno = aaNewState; - aatos->major = aaMajor; - aatos->minor = *aapMinor; -#ifndef NDEBUG - if( aaTraceFILE && aapParser->aaidx>0 ){ - int i; - fprintf(aaTraceFILE,"%sShift %d\n",aaTracePrompt,aaNewState); - fprintf(aaTraceFILE,"%sStack:",aaTracePrompt); - for(i=1; i<=aapParser->aaidx; i++) - fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); - fprintf(aaTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} aaRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; - -static void aa_accept(aaParser*); /* Forward Declaration */ - -static void aa_reduce( - aaParser *aapParser, /* The parser */ - int aaruleno /* Number of the rule by which to reduce */ -){ - int aagoto; /* The next state */ - int aaact; /* The next action */ - AAMINORTYPE aagotominor; /* The LHS of the rule reduced */ - aaStackEntry *aamsp; /* The top of the parser's stack */ - int aasize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - aamsp = &aapParser->aastack[aapParser->aaidx]; -#ifndef NDEBUG - if( aaTraceFILE && aaruleno>=0 - && aaruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 86 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); -} -// 632 "parser.php7.c" - break; - case 1: - case 14: - case 15: -// 94 "parser.php7.lemon" -{ - aagotominor.aa8 = aamsp[0].minor.aa8; -} -// 641 "parser.php7.c" - break; - case 2: -// 102 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); -} -// 648 "parser.php7.c" - break; - case 3: - case 8: -// 106 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 656 "parser.php7.c" - break; - case 4: -// 114 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); - aa_destructor(2,&aamsp[-4].minor); - aa_destructor(4,&aamsp[-2].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 666 "parser.php7.c" - break; - case 5: -// 118 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-3].minor); - aa_destructor(4,&aamsp[-1].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 676 "parser.php7.c" - break; - case 6: -// 122 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-1].minor); -} -// 684 "parser.php7.c" - break; - case 7: -// 130 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); - aa_destructor(1,&aamsp[-1].minor); -} -// 692 "parser.php7.c" - break; - case 9: -// 142 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 699 "parser.php7.c" - break; - case 10: - case 12: -// 146 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(7,&aamsp[-1].minor); -} -// 708 "parser.php7.c" - break; - case 11: - case 13: -// 150 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(8,&aamsp[-1].minor); -} -// 717 "parser.php7.c" - break; - case 16: -// 174 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); -} -// 724 "parser.php7.c" - break; - case 17: -// 178 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); -} -// 731 "parser.php7.c" - break; - case 18: -// 182 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); -} -// 738 "parser.php7.c" - break; - case 19: -// 186 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); -} -// 745 "parser.php7.c" - break; - case 20: -// 190 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); - aa_destructor(11,&aamsp[0].minor); -} -// 753 "parser.php7.c" - break; - case 21: -// 194 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); - aa_destructor(12,&aamsp[0].minor); -} -// 761 "parser.php7.c" - break; - case 22: -// 198 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); - aa_destructor(13,&aamsp[0].minor); -} -// 769 "parser.php7.c" - break; - case 23: -// 202 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(14,&aamsp[-2].minor); - aa_destructor(15,&aamsp[0].minor); -} -// 778 "parser.php7.c" - break; - case 24: -// 206 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(16,&aamsp[-2].minor); - aa_destructor(17,&aamsp[0].minor); -} -// 787 "parser.php7.c" - break; - }; - aagoto = aaRuleInfo[aaruleno].lhs; - aasize = aaRuleInfo[aaruleno].nrhs; - aapParser->aaidx -= aasize; - aaact = aa_find_reduce_action(aapParser,aagoto); - if( aaact < AANSTATE ){ - aa_shift(aapParser,aaact,aagoto,&aagotominor); - }else if( aaact == AANSTATE + AANRULE + 1 ){ - aa_accept(aapParser); - } -} - -static void aa_parse_failed( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_syntax_error( - aaParser *aapParser, /* The parser */ - int aamajor, /* The major type of the error token */ - AAMINORTYPE aaminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define ATOKEN (aaminor.aa0) -// 32 "parser.php7.lemon" - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - - status->status = PHANNOT_PARSING_FAILED; - -// 874 "parser.php7.c" - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_accept( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *aap, /* The parser */ - int aamajor, /* The major token code number */ - phannot_TOKENTYPE aaminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - AAMINORTYPE aaminorunion; - int aaact; /* The parser action. */ - int aaendofinput; /* True if we are at the end of input */ - int aaerrorhit = 0; /* True if aamajor has invoked an error */ - aaParser *aapParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - aapParser = (aaParser*)aap; - if( aapParser->aaidx<0 ){ - if( aamajor==0 ) return; - aapParser->aaidx = 0; - aapParser->aaerrcnt = -1; - aapParser->aastack[0].stateno = 0; - aapParser->aastack[0].major = 0; - } - aaminorunion.aa0 = aaminor; - aaendofinput = (aamajor==0); - phannot_ARG_STORE; - -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); - } -#endif - - do{ - aaact = aa_find_shift_action(aapParser,aamajor); - if( aaactaaerrcnt--; - if( aaendofinput && aapParser->aaidx>=0 ){ - aamajor = 0; - }else{ - aamajor = AANOCODE; - } - }else if( aaact < AANSTATE + AANRULE ){ - aa_reduce(aapParser,aaact-AANSTATE); - }else if( aaact == AA_ERROR_ACTION ){ - int aamx; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); - } -#endif -#ifdef AAERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( aapParser->aaerrcnt<0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aamx = aapParser->aastack[aapParser->aaidx].major; - if( aamx==AAERRORSYMBOL || aaerrorhit ){ -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sDiscard input token %s\n", - aaTracePrompt,aaTokenName[aamajor]); - } -#endif - aa_destructor(aamajor,&aaminorunion); - aamajor = AANOCODE; - }else{ - while( - aapParser->aaidx >= 0 && - aamx != AAERRORSYMBOL && - (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE - ){ - aa_pop_parser_stack(aapParser); - } - if( aapParser->aaidx < 0 || aamajor==0 ){ - aa_destructor(aamajor,&aaminorunion); - aa_parse_failed(aapParser); - aamajor = AANOCODE; - }else if( aamx!=AAERRORSYMBOL ){ - AAMINORTYPE u2; - u2.AAERRSYMDT = 0; - aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); - } - } - aapParser->aaerrcnt = 3; - aaerrorhit = 1; -#else /* AAERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( aapParser->aaerrcnt<=0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aapParser->aaerrcnt = 3; - aa_destructor(aamajor,&aaminorunion); - if( aaendofinput ){ - aa_parse_failed(aapParser); - } - aamajor = AANOCODE; -#endif - }else{ - aa_accept(aapParser); - aamajor = AANOCODE; - } - }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); - return; -} -#endif - - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { + if (ch == '@') { smart_str_appendc(&processed_str, ch); i++; @@ -39241,2185 +32993,381 @@ static int phannot_internal_parse_annotations(zval **result, const char *comment } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval* yy36; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); + + zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reader, parse) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + HashTable *_3$$5, *_9$$10; + HashPosition _2$$5, _8$$10; + int ZEPHIR_LAST_CALL_STATUS, line = 0; + zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; + zval *className = NULL; -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &className_param); -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_get_strval(className, className_param); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + + ZEPHIR_INIT_VAR(annotations); + array_init(annotations); + ZEPHIR_INIT_VAR(reflection); + object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_VAR(classAnnotations); + ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { + zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); } - efree((yypminor->yy0)); } + ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); + zephir_check_call_status(); + if (zephir_fast_count_int(properties TSRMLS_CC)) { + line = 1; + ZEPHIR_INIT_VAR(annotationsProperties); + array_init(annotationsProperties); + zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); + for ( + ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) + ) { + ZEPHIR_GET_HVALUE(property, _4$$5); + ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(propertyAnnotations); + ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_6$$7); + ZVAL_LONG(_6$$7, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_7$$8); + zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); + zephir_check_call_status(); + if (zephir_fast_count_int(methods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(annotationsMethods); + array_init(annotationsMethods); + zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); + for ( + ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) + ) { + ZEPHIR_GET_HVALUE(method, _10$$10); + ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(methodAnnotations); + ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_13$$13); + zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); + } + } + RETURN_CCTOR(annotations); + } - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy36)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } + +static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *docBlock_param = NULL, *file = NULL, *line = NULL; + zval *docBlock = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); + + zephir_get_strval(docBlock, docBlock_param); + if (!file) { + ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(file); + } + if (!line) { + line = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(file) != IS_STRING) { + ZEPHIR_INIT_NVAR(file); + ZVAL_STRING(file, "eval code", 1); + } + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); + } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } + + +#ifdef HAVE_CONFIG_H #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; -static void yy_accept(yyParser*); /* Forward Declaration */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy36; -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy36 = yymsp[0].minor.yy36; -} - break; - case 2: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-1].minor.yy36, yymsp[0].minor.yy36); -} - break; - case 3: - case 8: -{ - yygotominor.yy36 = phannot_ret_zval_list(NULL, yymsp[0].minor.yy36); -} - break; - case 4: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-3].minor.yy0, yymsp[-1].minor.yy36, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-2].minor.yy36, yymsp[0].minor.yy36); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - yygotominor.yy36 = phannot_ret_named_item(NULL, yymsp[0].minor.yy36); -} - break; - case 10: - case 12: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} + return SUCCESS; -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - if (!token_name) { - token_name = "UNKNOWN"; - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - status->status = PHANNOT_PARSING_FAILED; - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } +#ifdef HAVE_CONFIG_H #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval yy8; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + zval *reflectionData = NULL; -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_fetch_params(0, 0, 1, &reflectionData); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); - } - efree((yypminor->yy0)); + if (!reflectionData) { + reflectionData = ZEPHIR_GLOBAL(global_null); } -} - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy8)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} + if (Z_TYPE_P(reflectionData) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); + } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; + zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; + int ZEPHIR_LAST_CALL_STATUS; -static void yy_accept(yyParser*); /* Forward Declaration */ + ZEPHIR_MM_GROW(); -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy8, 1, 1); -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy8 = yymsp[0].minor.yy8; -} - break; - case 2: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-1].minor.yy8, &yymsp[0].minor.yy8); -} - break; - case 3: - case 8: -{ - phannot_ret_zval_list(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 4: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-3].minor.yy0, &yymsp[-1].minor.yy8, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-2].minor.yy8, &yymsp[0].minor.yy8); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - phannot_ret_named_item(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 10: - case 12: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; + ZEPHIR_MM_GROW(); - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionMethods); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); + zephir_check_call_status(); + zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + RETURN_MM_BOOL(0); } + RETURN_CCTOR(annotations); - status->status = PHANNOT_PARSING_FAILED; - - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; + ZEPHIR_MM_GROW(); -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionProperties); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); + zephir_check_call_status(); + zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); + } + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); + } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + RETURN_CCTOR(annotations); - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; } +static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { + -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(this_ptr, "_reflectionData"); +} +static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { + int ZEPHIR_LAST_CALL_STATUS; + zval *data, *reflectionData = NULL; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); - zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); - return SUCCESS; + if (Z_TYPE_P(data) == IS_ARRAY) { + if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); + zephir_check_call_status(); + RETURN_MM(); + } + } + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Annotations_Reader, parse) { - HashTable *_3$$5, *_9$$10; - HashPosition _2$$5, _8$$10; - int ZEPHIR_LAST_CALL_STATUS, line = 0; - zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; - zval *className = NULL; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); - - zephir_get_strval(className, className_param); - - - ZEPHIR_INIT_VAR(annotations); - array_init(annotations); - ZEPHIR_INIT_VAR(reflection); - object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_VAR(classAnnotations); - ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { - zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); - zephir_check_call_status(); - if (zephir_fast_count_int(properties TSRMLS_CC)) { - line = 1; - ZEPHIR_INIT_VAR(annotationsProperties); - array_init(annotationsProperties); - zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); - for ( - ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) - ) { - ZEPHIR_GET_HVALUE(property, _4$$5); - ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(propertyAnnotations); - ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_6$$7); - ZVAL_LONG(_6$$7, line); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_7$$8); - zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); - zephir_check_call_status(); - if (zephir_fast_count_int(methods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(annotationsMethods); - array_init(annotationsMethods); - zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); - for ( - ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) - ) { - ZEPHIR_GET_HVALUE(method, _10$$10); - ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(methodAnnotations); - ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_13$$13); - zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); - } - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *docBlock_param = NULL, *file = NULL, *line = NULL; - zval *docBlock = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); - - zephir_get_strval(docBlock, docBlock_param); - if (!file) { - ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(file); - } - if (!line) { - line = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(file) != IS_STRING) { - ZEPHIR_INIT_NVAR(file); - ZVAL_STRING(file, "eval code", 1); - } - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations, ReaderInterface, phalcon, annotations_readerinterface, phalcon_annotations_readerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { - - zval *reflectionData = NULL; - - zephir_fetch_params(0, 0, 1, &reflectionData); - - if (!reflectionData) { - reflectionData = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(reflectionData) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { - - zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - annotations = zephir_fetch_nproperty_this(this_ptr, SL("_classAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionClass, _0$$3, SS("class"), 1 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collection); - object_init_ex(collection, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, collection, "__construct", NULL, 17, reflectionClass); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC); - RETURN_CCTOR(collection); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionMethods); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); - zephir_check_call_status(); - zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionProperties); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); - zephir_check_call_status(); - zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { - - - - RETURN_MEMBER(this_ptr, "_reflectionData"); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data, *reflectionData = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - - - - if (Z_TYPE_P(data) == IS_ARRAY) { - if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); - zephir_check_call_status(); - RETURN_MM(); - } - } - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); - zephir_check_call_status(); - RETURN_MM(); - -} - - - -/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ -// 1 "scanner.re" +/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ +// 1 "scanner.re" @@ -47040,9 +38988,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, delete) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { - zend_object_iterator *_2; + zend_object_iterator *_3; + zephir_nts_static zend_class_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_1 = NULL, _3$$5 = zval_used_for_init, *_4$$5 = NULL; + zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_2 = NULL, _4$$5 = zval_used_for_init, *_5$$5 = NULL; zval *prefix = NULL, *_0$$4; ZEPHIR_MM_GROW(); @@ -47067,29 +39016,34 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { ZEPHIR_INIT_VAR(keys); array_init(keys); ZEPHIR_INIT_VAR(apc); - object_init_ex(apc, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _1, prefixPattern); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_1); - _2 = zephir_get_iterator(apc TSRMLS_CC); - _2->funcs->rewind(_2 TSRMLS_CC); - for (;_2->funcs->valid(_2 TSRMLS_CC) == SUCCESS && !EG(exception); _2->funcs->move_forward(_2 TSRMLS_CC)) { - ZEPHIR_GET_IMKEY(key, _2); + if (!_1) { + _1 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(apc, _1); + if (zephir_has_constructor(apc TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2); + ZVAL_STRING(_2, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _2, prefixPattern); + zephir_check_temp_parameter(_2); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_2); + _3 = zephir_get_iterator(apc TSRMLS_CC); + _3->funcs->rewind(_3 TSRMLS_CC); + for (;_3->funcs->valid(_3 TSRMLS_CC) == SUCCESS && !EG(exception); _3->funcs->move_forward(_3 TSRMLS_CC)) { + ZEPHIR_GET_IMKEY(key, _3); { zval **ZEPHIR_TMP_ITERATOR_PTR; - _2->funcs->get_current_data(_2, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); - ZEPHIR_CPY_WRT(_1, (*ZEPHIR_TMP_ITERATOR_PTR)); + _3->funcs->get_current_data(_3, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); + ZEPHIR_CPY_WRT(_2, (*ZEPHIR_TMP_ITERATOR_PTR)); } - ZEPHIR_SINIT_NVAR(_3$$5); - ZVAL_LONG(&_3$$5, 5); - ZEPHIR_INIT_NVAR(_4$$5); - zephir_substr(_4$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_array_append(&keys, _4$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); + ZEPHIR_SINIT_NVAR(_4$$5); + ZVAL_LONG(&_4$$5, 5); + ZEPHIR_INIT_NVAR(_5$$5); + zephir_substr(_5$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_array_append(&keys, _5$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); } - _2->funcs->dtor(_2 TSRMLS_CC); + _3->funcs->dtor(_3 TSRMLS_CC); RETURN_CCTOR(keys); } @@ -47131,9 +39085,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, exists) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { + zephir_nts_static zend_class_entry *_3 = NULL; zend_object_iterator *_1; - zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_3, *_4$$3; - zephir_fcall_cache_entry *_5 = NULL; + zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_4, *_5$$3; + zephir_fcall_cache_entry *_6 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -47142,12 +39097,17 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { ZEPHIR_INIT_VAR(prefixPattern); ZEPHIR_CONCAT_SVS(prefixPattern, "/^_PHCA", _0, "/"); ZEPHIR_INIT_VAR(_2); - object_init_ex(_2, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_3); - ZVAL_STRING(_3, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _3, prefixPattern); - zephir_check_temp_parameter(_3); - zephir_check_call_status(); + if (!_3) { + _3 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(_2, _3); + if (zephir_has_constructor(_2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _4, prefixPattern); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } _1 = zephir_get_iterator(_2 TSRMLS_CC); _1->funcs->rewind(_1 TSRMLS_CC); for (;_1->funcs->valid(_1 TSRMLS_CC) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1 TSRMLS_CC)) { @@ -47156,8 +39116,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { _1->funcs->get_current_data(_1, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); ZEPHIR_CPY_WRT(item, (*ZEPHIR_TMP_ITERATOR_PTR)); } - zephir_array_fetch_string(&_4$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_5, 111, _4$$3); + zephir_array_fetch_string(&_5$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_6, 111, _5$$3); zephir_check_call_status(); } _1->funcs->dtor(_1 TSRMLS_CC); @@ -50047,10 +42007,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); - if (zephir_has_constructor(redis TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); + zephir_check_call_status(); ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { @@ -75944,7 +67902,7 @@ static PHP_METHOD(Phalcon_Http_Response, setStatusCode) { } if (ZEPHIR_IS_STRING_IDENTICAL(message, "")) { ZEPHIR_INIT_VAR(statusCodes); - zephir_create_array(statusCodes, 67, 0 TSRMLS_CC); + zephir_create_array(statusCodes, 63, 0 TSRMLS_CC); add_index_stringl(statusCodes, 100, SL("Continue"), 1); add_index_stringl(statusCodes, 101, SL("Switching Protocols"), 1); add_index_stringl(statusCodes, 102, SL("Processing"), 1); @@ -78737,9 +70695,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, check) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { zend_bool _26$$14; - zephir_fcall_cache_entry *_25 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, _30$$14, _31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; + zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_25$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, *_30$$14 = NULL, *_31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -78796,35 +70753,35 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { do { if (ZEPHIR_IS_LONG(_9$$4, 1)) { _10$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 255, _10$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 0, _10$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _11$$6 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 2)) { _12$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 256, _12$$7); + ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 0, _12$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _13$$7 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 3)) { _14$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 257, _14$$8); + ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 0, _14$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _15$$8 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 15)) { _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 258, _16$$9); + ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 0, _16$$9); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _17$$9 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 16)) { _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 259, _18$$10); + ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 0, _18$$10); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _19$$10 TSRMLS_CC); break; @@ -78849,7 +70806,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { } while(0); _24$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _24$$4, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_25$$4); + ZVAL_BOOL(_25$$4, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _24$$4, _25$$4); zephir_check_call_status(); } else { _26$$14 = !width; @@ -78868,18 +70827,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_SINIT_VAR(_30$$14); - ZVAL_LONG(&_30$$14, width); - ZEPHIR_SINIT_VAR(_31$$14); - ZVAL_LONG(&_31$$14, height); - ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 261, &_30$$14, &_31$$14); + ZEPHIR_INIT_VAR(_30$$14); + ZVAL_LONG(_30$$14, width); + ZEPHIR_INIT_VAR(_31$$14); + ZVAL_LONG(_31$$14, height); + ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 0, _30$$14, _31$$14); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _32$$14 TSRMLS_CC); _33$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _33$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _33$$14, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _34$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _34$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_30$$14); + ZVAL_BOOL(_30$$14, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _34$$14, _30$$14); zephir_check_call_status(); _35$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_realpath"), _35$$14 TSRMLS_CC); @@ -78903,8 +70864,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { zend_bool _4$$3, _8$$4; - zephir_fcall_cache_entry *_9 = NULL, *_19 = NULL, *_32 = NULL, *_34 = NULL; - zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_20$$3, *_21$$3, *_22$$3, _23$$3, _24$$3, _25$$3, _26$$3, _27$$3, _28$$3, *_29$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, _13$$4, _14$$4, _15$$4, _16$$4, *_17$$4 = NULL, *_18$$6, *_30$$7, *_31$$7 = NULL, *_33$$7 = NULL, *_35$$8, _36$$8, _37$$8, *_38$$8, *_39$$8 = NULL, *_40$$8 = NULL; + zephir_fcall_cache_entry *_9 = NULL; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_19$$3 = NULL, *_20$$3 = NULL, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_25$$3, *_26$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, *_13$$4, *_14$$4, *_15$$4, *_16$$4, *_17$$4 = NULL, *_18$$6, *_27$$7, *_28$$7 = NULL, *_29$$7 = NULL, *_30$$8, *_31$$8, *_32$$8, *_33$$8, *_34$$8 = NULL, *_35$$8 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -78958,74 +70919,74 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { _10$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _11$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _12$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_13$$4); - ZVAL_LONG(&_13$$4, 0); - ZEPHIR_SINIT_VAR(_14$$4); - ZVAL_LONG(&_14$$4, 0); - ZEPHIR_SINIT_VAR(_15$$4); - ZVAL_LONG(&_15$$4, 0); - ZEPHIR_SINIT_VAR(_16$$4); - ZVAL_LONG(&_16$$4, 0); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 263, image, _10$$4, &_13$$4, &_14$$4, &_15$$4, &_16$$4, pre_width, pre_height, _11$$4, _12$$4); + ZEPHIR_INIT_VAR(_13$$4); + ZVAL_LONG(_13$$4, 0); + ZEPHIR_INIT_VAR(_14$$4); + ZVAL_LONG(_14$$4, 0); + ZEPHIR_INIT_VAR(_15$$4); + ZVAL_LONG(_15$$4, 0); + ZEPHIR_INIT_VAR(_16$$4); + ZVAL_LONG(_16$$4, 0); + ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 0, image, _10$$4, _13$$4, _14$$4, _15$$4, _16$$4, pre_width, pre_height, _11$$4, _12$$4); zephir_check_call_status(); if (zephir_is_true(_17$$4)) { _18$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _18$$6); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); } } + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, width); ZEPHIR_INIT_VAR(_20$$3); - ZVAL_LONG(_20$$3, width); - ZEPHIR_INIT_VAR(_21$$3); - ZVAL_LONG(_21$$3, height); - ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _20$$3, _21$$3); - zephir_check_call_status(); - _22$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, 0); - ZEPHIR_SINIT_VAR(_24$$3); - ZVAL_LONG(&_24$$3, 0); - ZEPHIR_SINIT_VAR(_25$$3); - ZVAL_LONG(&_25$$3, 0); - ZEPHIR_SINIT_VAR(_26$$3); - ZVAL_LONG(&_26$$3, 0); - ZEPHIR_SINIT_VAR(_27$$3); - ZVAL_LONG(&_27$$3, width); - ZEPHIR_SINIT_VAR(_28$$3); - ZVAL_LONG(&_28$$3, height); - ZEPHIR_CALL_FUNCTION(&_29$$3, "imagecopyresampled", NULL, 265, image, _22$$3, &_23$$3, &_24$$3, &_25$$3, &_26$$3, &_27$$3, &_28$$3, pre_width, pre_height); - zephir_check_call_status(); - if (zephir_is_true(_29$$3)) { - _30$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _30$$7); + ZVAL_LONG(_20$$3, height); + ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _19$$3, _20$$3); + zephir_check_call_status(); + _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_NVAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, 0); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, width); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, height); + ZEPHIR_CALL_FUNCTION(&_26$$3, "imagecopyresampled", NULL, 0, image, _21$$3, _19$$3, _20$$3, _22$$3, _23$$3, _24$$3, _25$$3, pre_width, pre_height); + zephir_check_call_status(); + if (zephir_is_true(_26$$3)) { + _27$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _27$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_31$$7, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_28$$7, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _31$$7 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33$$7, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _28$$7 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_29$$7, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33$$7 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _29$$7 TSRMLS_CC); } } else { - _35$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_36$$8); - ZVAL_LONG(&_36$$8, width); - ZEPHIR_SINIT_VAR(_37$$8); - ZVAL_LONG(&_37$$8, height); - ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 268, _35$$8, &_36$$8, &_37$$8); + _30$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_31$$8); + ZVAL_LONG(_31$$8, width); + ZEPHIR_INIT_VAR(_32$$8); + ZVAL_LONG(_32$$8, height); + ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 0, _30$$8, _31$$8, _32$$8); zephir_check_call_status(); - _38$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _38$$8); + _33$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _33$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_39$$8, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_34$$8, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _39$$8 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_40$$8, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _34$$8 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_35$$8, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _40$$8 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _35$$8 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79033,8 +70994,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { - zephir_fcall_cache_entry *_16 = NULL, *_18 = NULL, *_20 = NULL; - zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, *_14$$3 = NULL, *_15$$4, *_17$$4 = NULL, *_19$$4 = NULL, *_21$$5 = NULL, *_22$$5, *_23$$5, *_24$$5 = NULL, *_25$$5 = NULL; + zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3 = NULL, *_4$$3 = NULL, *_5$$3, *_6$$3, *_7$$3, *_8$$3, *_9$$3, *_10$$3, *_11$$3, *_12$$3 = NULL, *_13$$4, *_14$$4 = NULL, *_15$$4 = NULL, *_16$$5 = NULL, *_17$$5, *_18$$5, *_19$$5 = NULL, *_20$$5 = NULL; int width, height, offsetX, offsetY, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79060,64 +71020,64 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", NULL, 0, _3$$3, _4$$3); zephir_check_call_status(); _5$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_VAR(_7$$3); - ZVAL_LONG(&_7$$3, 0); - ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, offsetX); - ZEPHIR_SINIT_VAR(_9$$3); - ZVAL_LONG(&_9$$3, offsetY); - ZEPHIR_SINIT_VAR(_10$$3); - ZVAL_LONG(&_10$$3, width); - ZEPHIR_SINIT_VAR(_11$$3); - ZVAL_LONG(&_11$$3, height); - ZEPHIR_SINIT_VAR(_12$$3); - ZVAL_LONG(&_12$$3, width); - ZEPHIR_SINIT_VAR(_13$$3); - ZVAL_LONG(&_13$$3, height); - ZEPHIR_CALL_FUNCTION(&_14$$3, "imagecopyresampled", NULL, 265, image, _5$$3, &_6$$3, &_7$$3, &_8$$3, &_9$$3, &_10$$3, &_11$$3, &_12$$3, &_13$$3); + ZEPHIR_INIT_NVAR(_3$$3); + ZVAL_LONG(_3$$3, 0); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, 0); + ZEPHIR_INIT_VAR(_6$$3); + ZVAL_LONG(_6$$3, offsetX); + ZEPHIR_INIT_VAR(_7$$3); + ZVAL_LONG(_7$$3, offsetY); + ZEPHIR_INIT_VAR(_8$$3); + ZVAL_LONG(_8$$3, width); + ZEPHIR_INIT_VAR(_9$$3); + ZVAL_LONG(_9$$3, height); + ZEPHIR_INIT_VAR(_10$$3); + ZVAL_LONG(_10$$3, width); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, height); + ZEPHIR_CALL_FUNCTION(&_12$$3, "imagecopyresampled", NULL, 0, image, _5$$3, _3$$3, _4$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3); zephir_check_call_status(); - if (zephir_is_true(_14$$3)) { - _15$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _15$$4); + if (zephir_is_true(_12$$3)) { + _13$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_14$$4, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _17$$4 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_19$$4, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _14$$4 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_15$$4, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _19$$4 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _15$$4 TSRMLS_CC); } } else { ZEPHIR_INIT_VAR(rect); zephir_create_array(rect, 4, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$5); - ZVAL_LONG(_21$$5, offsetX); - zephir_array_update_string(&rect, SL("x"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, offsetY); - zephir_array_update_string(&rect, SL("y"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, width); - zephir_array_update_string(&rect, SL("width"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, height); - zephir_array_update_string(&rect, SL("height"), &_21$$5, PH_COPY | PH_SEPARATE); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 269, _22$$5, rect); - zephir_check_call_status(); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _23$$5); + ZEPHIR_INIT_VAR(_16$$5); + ZVAL_LONG(_16$$5, offsetX); + zephir_array_update_string(&rect, SL("x"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, offsetY); + zephir_array_update_string(&rect, SL("y"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, width); + zephir_array_update_string(&rect, SL("width"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, height); + zephir_array_update_string(&rect, SL("height"), &_16$$5, PH_COPY | PH_SEPARATE); + _17$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 0, _17$$5, rect); + zephir_check_call_status(); + _18$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_24$$5, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_19$$5, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _24$$5 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$5, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _19$$5 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_20$$5, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _25$$5 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _20$$5 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79125,7 +71085,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { - zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1 = zval_used_for_init, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, *_5, *_6, _7, *_8 = NULL, *_9$$3; + zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1, _2, _3, _4, *_5, *_6 = NULL, *_7 = NULL, *_8, *_9, *_10, *_11, *_12 = NULL, *_13$$3; int degrees, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79143,37 +71103,39 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { ZVAL_LONG(&_3, 0); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, 127); - ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 270, _0, &_1, &_2, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 256, _0, &_1, &_2, &_3, &_4); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, (360 - degrees)); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 1); - ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 271, _5, &_1, transparent, &_2); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, (360 - degrees)); + ZEPHIR_INIT_VAR(_7); + ZVAL_LONG(_7, 1); + ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 0, _5, _6, transparent, _7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_6); + ZVAL_BOOL(_6, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _6); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 0, image); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 267, image); + ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 0, image); zephir_check_call_status(); - _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 100); - ZEPHIR_CALL_FUNCTION(&_8, "imagecopymerge", NULL, 272, _6, image, &_1, &_2, &_3, &_4, width, height, &_7); + _8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_INIT_NVAR(_7); + ZVAL_LONG(_7, 0); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 100); + ZEPHIR_CALL_FUNCTION(&_12, "imagecopymerge", NULL, 0, _8, image, _6, _7, _9, _10, width, height, _11); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _9$$3); + if (zephir_is_true(_12)) { + _13$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_width"), width TSRMLS_CC); @@ -79185,8 +71147,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { - zephir_fcall_cache_entry *_14 = NULL, *_29 = NULL; - zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_24$$3, *_25$$3 = NULL, *_26$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, _9$$5 = zval_used_for_init, _10$$5 = zval_used_for_init, _11$$5 = zval_used_for_init, _12$$5 = zval_used_for_init, _13$$5 = zval_used_for_init, *_15$$6, *_16$$7, *_17$$7, *_18$$7, _19$$7 = zval_used_for_init, _20$$7 = zval_used_for_init, _21$$7 = zval_used_for_init, _22$$7 = zval_used_for_init, _23$$7 = zval_used_for_init, *_27$$9, _28$$9, *_30$$10, _31$$10; + zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_23$$3, *_24$$3 = NULL, *_25$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, *_9$$5 = NULL, *_10$$5 = NULL, *_11$$5 = NULL, *_12$$5 = NULL, *_13$$5 = NULL, *_14$$6, *_15$$7, *_16$$7, *_17$$7, *_18$$7 = NULL, *_19$$7 = NULL, *_20$$7 = NULL, *_21$$7 = NULL, *_22$$7 = NULL, *_26$$9, *_27$$9, *_28$$10, *_29$$10; int direction, ZEPHIR_LAST_CALL_STATUS, x = 0; ZEPHIR_MM_GROW(); @@ -79217,66 +71178,66 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_9$$5); - ZVAL_LONG(&_9$$5, x); - ZEPHIR_SINIT_NVAR(_10$$5); - ZVAL_LONG(&_10$$5, 0); - ZEPHIR_SINIT_NVAR(_11$$5); - ZVAL_LONG(&_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); - ZEPHIR_SINIT_NVAR(_12$$5); - ZVAL_LONG(&_12$$5, 0); - ZEPHIR_SINIT_NVAR(_13$$5); - ZVAL_LONG(&_13$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _6$$5, &_9$$5, &_10$$5, &_11$$5, &_12$$5, &_13$$5, _8$$5); + ZEPHIR_INIT_NVAR(_9$$5); + ZVAL_LONG(_9$$5, x); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_LONG(_10$$5, 0); + ZEPHIR_INIT_NVAR(_11$$5); + ZVAL_LONG(_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); + ZEPHIR_INIT_NVAR(_12$$5); + ZVAL_LONG(_12$$5, 0); + ZEPHIR_INIT_NVAR(_13$$5); + ZVAL_LONG(_13$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _6$$5, _9$$5, _10$$5, _11$$5, _12$$5, _13$$5, _8$$5); zephir_check_call_status(); } } else { x = 0; while (1) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - if (!(ZEPHIR_GT_LONG(_15$$6, x))) { + _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + if (!(ZEPHIR_GT_LONG(_14$$6, x))) { break; } x++; - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _18$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, 0); - ZEPHIR_SINIT_NVAR(_20$$7); - ZVAL_LONG(&_20$$7, x); - ZEPHIR_SINIT_NVAR(_21$$7); - ZVAL_LONG(&_21$$7, 0); - ZEPHIR_SINIT_NVAR(_22$$7); - ZVAL_LONG(&_22$$7, ((zephir_get_numberval(_17$$7) - x) - 1)); - ZEPHIR_SINIT_NVAR(_23$$7); - ZVAL_LONG(&_23$$7, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _16$$7, &_19$$7, &_20$$7, &_21$$7, &_22$$7, _18$$7, &_23$$7); + _15$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_18$$7); + ZVAL_LONG(_18$$7, 0); + ZEPHIR_INIT_NVAR(_19$$7); + ZVAL_LONG(_19$$7, x); + ZEPHIR_INIT_NVAR(_20$$7); + ZVAL_LONG(_20$$7, 0); + ZEPHIR_INIT_NVAR(_21$$7); + ZVAL_LONG(_21$$7, ((zephir_get_numberval(_16$$7) - x) - 1)); + ZEPHIR_INIT_NVAR(_22$$7); + ZVAL_LONG(_22$$7, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _15$$7, _18$$7, _19$$7, _20$$7, _21$$7, _17$$7, _22$$7); zephir_check_call_status(); } } - _24$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _24$$3); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _23$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&_24$$3, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _25$$3 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_26$$3, "imagesy", NULL, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _24$$3 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _26$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _25$$3 TSRMLS_CC); } else { if (direction == 11) { - _27$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_28$$9); - ZVAL_LONG(&_28$$9, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _27$$9, &_28$$9); + _26$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_27$$9); + ZEPHIR_GET_CONSTANT(_27$$9, "IMG_FLIP_HORIZONTAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _26$$9, _27$$9); zephir_check_call_status(); } else { - _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_31$$10); - ZVAL_LONG(&_31$$10, 2); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _30$$10, &_31$$10); + _28$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_29$$10); + ZEPHIR_GET_CONSTANT(_29$$10, "IMG_FLIP_VERTICAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _28$$10, _29$$10); zephir_check_call_status(); } } @@ -79287,7 +71248,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zval *_3 = NULL; - zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, _6, _7, *_8 = NULL, *_9$$3, *_10$$3 = NULL, *_11$$3, *_12$$3 = NULL; + zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, *_6, *_7 = NULL, *_8$$3, *_9$$3 = NULL, *_10$$3, *_11$$3 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79344,21 +71305,21 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zephir_array_fast_append(_3, _4); zephir_array_fast_append(matrix, _3); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6); - ZVAL_LONG(&_6, (amount - 8)); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(&_8, "imageconvolution", NULL, 275, _5, matrix, &_6, &_7); + ZEPHIR_INIT_NVAR(_4); + ZVAL_LONG(_4, (amount - 8)); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_CALL_FUNCTION(&_7, "imageconvolution", NULL, 0, _5, matrix, _4, _6); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_10$$3, "imagesx", NULL, 266, _9$$3); + if (zephir_is_true(_7)) { + _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_9$$3, "imagesx", NULL, 0, _8$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _10$$3 TSRMLS_CC); - _11$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_12$$3, "imagesy", NULL, 267, _11$$3); + zephir_update_property_this(this_ptr, SL("_width"), _9$$3 TSRMLS_CC); + _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_11$$3, "imagesy", NULL, 0, _10$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _12$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _11$$3 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79366,9 +71327,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { - zephir_fcall_cache_entry *_6 = NULL, *_13 = NULL, *_29 = NULL; + zephir_fcall_cache_entry *_6 = NULL; zend_bool fadeIn; - zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_3, *_4, *_5, *_7, *_8, *_9, _10, _11, _12, *_31, *_32 = NULL, *_33 = NULL, *_14$$5, *_15$$5, *_20$$5, *_21$$5 = NULL, *_22$$5, *_23$$5, _24$$5 = zval_used_for_init, _25$$5 = zval_used_for_init, _26$$5 = zval_used_for_init, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_30$$5, *_16$$6 = NULL, _17$$6 = zval_used_for_init, *_18$$7 = NULL, _19$$7 = zval_used_for_init; + zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1, *_2 = NULL, *_3, *_4, *_5 = NULL, *_7, *_8, *_9, *_10, *_11, *_12, *_29, *_30 = NULL, *_31 = NULL, *_13$$5, *_14$$5, *_19$$5, *_20$$5 = NULL, *_21$$5, *_22$$5, *_23$$5 = NULL, *_24$$5 = NULL, *_25$$5 = NULL, *_26$$5 = NULL, *_27$$5, *_28$$5 = NULL, *_15$$6 = NULL, _16$$6 = zval_used_for_init, *_17$$7 = NULL, _18$$7 = zval_used_for_init; int height, opacity, ZEPHIR_LAST_CALL_STATUS, stepping = 0, offset = 0, src_y = 0, dst_y = 0, dst_opacity = 0; ZEPHIR_MM_GROW(); @@ -79400,94 +71361,94 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { _7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _9 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, 0); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 0); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, _7, &_1, &_10, &_11, &_12, _8, _9); + ZEPHIR_INIT_NVAR(_5); + ZVAL_LONG(_5, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, _7, _5, _10, _11, _12, _8, _9); zephir_check_call_status(); offset = 0; while (1) { if (!(height >= offset)) { break; } + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + src_y = ((zephir_get_numberval(_13$$5) - offset) - 1); _14$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - src_y = ((zephir_get_numberval(_14$$5) - offset) - 1); - _15$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - dst_y = (zephir_get_numberval(_15$$5) + offset); + dst_y = (zephir_get_numberval(_14$$5) + offset); if (fadeIn) { - ZEPHIR_INIT_NVAR(_16$$6); - ZEPHIR_SINIT_NVAR(_17$$6); - ZVAL_LONG(&_17$$6, (opacity + ((stepping * ((height - offset)))))); - zephir_round(_16$$6, &_17$$6, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_16$$6); + ZEPHIR_INIT_NVAR(_15$$6); + ZEPHIR_SINIT_NVAR(_16$$6); + ZVAL_LONG(&_16$$6, (opacity + ((stepping * ((height - offset)))))); + zephir_round(_15$$6, &_16$$6, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_15$$6); } else { - ZEPHIR_INIT_NVAR(_18$$7); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, (opacity + ((stepping * offset)))); - zephir_round(_18$$7, &_19$$7, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_18$$7); - } - _20$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, 1); - ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _20$$5, _21$$5); - zephir_check_call_status(); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, src_y); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, line, _22$$5, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _23$$5, &_28$$5); - zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 4); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, dst_opacity); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_29, 276, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, &_28$$5); - zephir_check_call_status(); - _30$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, dst_y); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _30$$5, &_28$$5); + ZEPHIR_INIT_NVAR(_17$$7); + ZEPHIR_SINIT_NVAR(_18$$7); + ZVAL_LONG(&_18$$7, (opacity + ((stepping * offset)))); + zephir_round(_17$$7, &_18$$7, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_17$$7); + } + _19$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 1); + ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _19$$5, _20$$5); + zephir_check_call_status(); + _21$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 0); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, src_y); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, line, _21$$5, _20$$5, _23$$5, _24$$5, _25$$5, _22$$5, _26$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_20$$5); + ZEPHIR_GET_CONSTANT(_20$$5, "IMG_FILTER_COLORIZE"); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, dst_opacity); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, line, _20$$5, _23$$5, _24$$5, _25$$5, _26$$5); + zephir_check_call_status(); + _27$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, dst_y); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 0); + ZEPHIR_INIT_NVAR(_28$$5); + ZVAL_LONG(_28$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, line, _23$$5, _24$$5, _25$$5, _26$$5, _27$$5, _28$$5); zephir_check_call_status(); offset++; } - _31 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _31); + _29 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _29); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), reflection TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_32, "imagesx", NULL, 266, reflection); + ZEPHIR_CALL_FUNCTION(&_30, "imagesx", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _32 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33, "imagesy", NULL, 267, reflection); + zephir_update_property_this(this_ptr, SL("_width"), _30 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_31, "imagesy", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _31 TSRMLS_CC); ZEPHIR_MM_RESTORE(); } @@ -79495,7 +71456,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { int offsetX, offsetY, opacity, ZEPHIR_LAST_CALL_STATUS, width = 0, height = 0; - zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_9, *_10, _11, _12, _13, _14, _15, _16, *_17 = NULL, *_3$$3, _4$$3 = zval_used_for_init, *_5$$3 = NULL, _6$$3 = zval_used_for_init, _7$$3 = zval_used_for_init, _8$$3 = zval_used_for_init; + zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22 = NULL, *_4$$3, _5$$3 = zval_used_for_init, *_6$$3 = NULL, _7$$3, _8$$3, _9$$3, *_10$$3, *_11$$3, *_12$$3, *_13$$3, *_14$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &watermark, &offsetX_param, &offsetY_param, &opacity_param); @@ -79507,69 +71468,71 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { ZEPHIR_CALL_METHOD(&_0, watermark, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, overlay, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_1); + ZVAL_BOOL(_1, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, overlay, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, overlay); + ZEPHIR_CALL_FUNCTION(&_2, "imagesx", NULL, 0, overlay); zephir_check_call_status(); - width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, overlay); + width = zephir_get_intval(_2); + ZEPHIR_CALL_FUNCTION(&_3, "imagesy", NULL, 0, overlay); zephir_check_call_status(); - height = zephir_get_intval(_2); + height = zephir_get_intval(_3); if (opacity < 100) { - ZEPHIR_INIT_VAR(_3$$3); - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_DOUBLE(&_4$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_5$$3, "abs", NULL, 202, &_4$$3); + ZEPHIR_INIT_VAR(_4$$3); + ZEPHIR_SINIT_VAR(_5$$3); + ZVAL_DOUBLE(&_5$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); + ZEPHIR_CALL_FUNCTION(&_6$$3, "abs", NULL, 202, &_5$$3); zephir_check_call_status(); - zephir_round(_3$$3, _5$$3, NULL, NULL TSRMLS_CC); - opacity = zephir_get_intval(_3$$3); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 127); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 127); + zephir_round(_4$$3, _6$$3, NULL, NULL TSRMLS_CC); + opacity = zephir_get_intval(_4$$3); + ZEPHIR_SINIT_NVAR(_5$$3); + ZVAL_LONG(&_5$$3, 127); ZEPHIR_SINIT_VAR(_7$$3); ZVAL_LONG(&_7$$3, 127); ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3); + ZVAL_LONG(&_8$$3, 127); + ZEPHIR_SINIT_VAR(_9$$3); + ZVAL_LONG(&_9$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, overlay, &_5$$3, &_7$$3, &_8$$3, &_9$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 278, overlay, &_4$$3); + ZEPHIR_INIT_VAR(_10$$3); + ZEPHIR_GET_CONSTANT(_10$$3, "IMG_EFFECT_OVERLAY"); + ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 0, overlay, _10$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 0); - ZEPHIR_SINIT_NVAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_NVAR(_7$$3); - ZVAL_LONG(&_7$$3, width); - ZEPHIR_SINIT_NVAR(_8$$3); - ZVAL_LONG(&_8$$3, height); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 279, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3, color); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, 0); + ZEPHIR_INIT_VAR(_12$$3); + ZVAL_LONG(_12$$3, 0); + ZEPHIR_INIT_VAR(_13$$3); + ZVAL_LONG(_13$$3, width); + ZEPHIR_INIT_VAR(_14$$3); + ZVAL_LONG(_14$$3, height); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, overlay, _11$$3, _12$$3, _13$$3, _14$$3, color); zephir_check_call_status(); } - _9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _9, ZEPHIR_GLOBAL(global_true)); + _15 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _15, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); - _10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, offsetX); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, offsetY); - ZEPHIR_SINIT_VAR(_13); - ZVAL_LONG(&_13, 0); - ZEPHIR_SINIT_VAR(_14); - ZVAL_LONG(&_14, 0); - ZEPHIR_SINIT_VAR(_15); - ZVAL_LONG(&_15, width); - ZEPHIR_SINIT_VAR(_16); - ZVAL_LONG(&_16, height); - ZEPHIR_CALL_FUNCTION(&_17, "imagecopy", NULL, 273, _10, overlay, &_11, &_12, &_13, &_14, &_15, &_16); - zephir_check_call_status(); - if (zephir_is_true(_17)) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, overlay); + _16 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_1); + ZVAL_LONG(_1, offsetX); + ZEPHIR_INIT_VAR(_17); + ZVAL_LONG(_17, offsetY); + ZEPHIR_INIT_VAR(_18); + ZVAL_LONG(_18, 0); + ZEPHIR_INIT_VAR(_19); + ZVAL_LONG(_19, 0); + ZEPHIR_INIT_VAR(_20); + ZVAL_LONG(_20, width); + ZEPHIR_INIT_VAR(_21); + ZVAL_LONG(_21, height); + ZEPHIR_CALL_FUNCTION(&_22, "imagecopy", NULL, 0, _16, overlay, _1, _17, _18, _19, _20, _21); + zephir_check_call_status(); + if (zephir_is_true(_22)) { + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, overlay); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79579,9 +71542,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zend_bool _10$$3, _11$$3, _12$$3; - zephir_fcall_cache_entry *_3 = NULL, *_20 = NULL; + zephir_fcall_cache_entry *_3 = NULL, *_22 = NULL; int offsetX, offsetY, opacity, r, g, b, size, ZEPHIR_LAST_CALL_STATUS, angle = 0, s0, s1, s4, s5, width = 0, height = 0; - zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, _4$$3 = zval_used_for_init, _5$$3 = zval_used_for_init, *_13$$3 = NULL, *_14$$3 = NULL, *_17$$3, _18$$3 = zval_used_for_init, _19$$3 = zval_used_for_init, *_21$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_15$$6, *_16$$7, _22$$8 = zval_used_for_init, *_23$$8 = NULL, *_24$$8 = NULL, *_27$$8, _28$$8 = zval_used_for_init, _29$$8 = zval_used_for_init, _30$$8, *_31$$8, *_25$$9, *_26$$10; + zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, *_4$$3 = NULL, *_5$$3 = NULL, _13$$3 = zval_used_for_init, *_14$$3 = NULL, *_15$$3 = NULL, *_18$$3, _19$$3, _20$$3, _21$$3, *_23$$3, *_24$$3, *_25$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_16$$6, *_17$$7, *_26$$8 = NULL, *_27$$8 = NULL, *_28$$8 = NULL, *_31$$8, _32$$8, _33$$8, _34$$8, _35$$8, *_36$$8, *_37$$8, *_38$$8, *_29$$9, *_30$$10; zval *text = NULL, *fontfile = NULL; ZEPHIR_MM_GROW(); @@ -79610,11 +71573,11 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zephir_round(_0, _2, NULL, NULL TSRMLS_CC); opacity = zephir_get_intval(_0); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_VAR(_5$$3); - ZVAL_LONG(&_5$$3, 0); - ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 280, &_4$$3, &_5$$3, fontfile, text); + ZEPHIR_INIT_VAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_VAR(_5$$3); + ZVAL_LONG(_5$$3, 0); + ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 0, _4$$3, _5$$3, fontfile, text); zephir_check_call_status(); if (zephir_array_isset_long(space, 0)) { ZEPHIR_OBS_VAR(_6$$4); @@ -79646,85 +71609,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "Call to imagettfbbox() failed", "phalcon/image/adapter/gd.zep", 357); return; } - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s4 - s0)); - ZEPHIR_CALL_FUNCTION(&_13$$3, "abs", &_3, 202, &_4$$3); + ZEPHIR_SINIT_VAR(_13$$3); + ZVAL_LONG(&_13$$3, (s4 - s0)); + ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - width = (zephir_get_numberval(_13$$3) + 10); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s5 - s1)); - ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_4$$3); + width = (zephir_get_numberval(_14$$3) + 10); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, (s5 - s1)); + ZEPHIR_CALL_FUNCTION(&_15$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - height = (zephir_get_numberval(_14$$3) + 10); + height = (zephir_get_numberval(_15$$3) + 10); if (offsetX < 0) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_15$$6) - width) + offsetX); + _16$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_16$$6) - width) + offsetX); } if (offsetY < 0) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_16$$7) - height) + offsetY); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_17$$7) - height) + offsetY); } - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, r); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, g); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, b); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, r); ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _17$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3); + ZVAL_LONG(&_19$$3, g); + ZEPHIR_SINIT_VAR(_20$$3); + ZVAL_LONG(&_20$$3, b); + ZEPHIR_SINIT_VAR(_21$$3); + ZVAL_LONG(&_21$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _18$$3, &_13$$3, &_19$$3, &_20$$3, &_21$$3); zephir_check_call_status(); angle = 0; - _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, angle); - ZEPHIR_SINIT_NVAR(_18$$3); - ZVAL_LONG(&_18$$3, offsetX); - ZEPHIR_SINIT_NVAR(_19$$3); - ZVAL_LONG(&_19$$3, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 281, _21$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3, color, fontfile, text); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_NVAR(_5$$3); + ZVAL_LONG(_5$$3, angle); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, offsetX); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 0, _23$$3, _4$$3, _5$$3, _24$$3, _25$$3, color, fontfile, text); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_23$$8, "imagefontwidth", NULL, 282, &_22$$8); + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_27$$8, "imagefontwidth", NULL, 0, _26$$8); zephir_check_call_status(); - width = (zephir_get_intval(_23$$8) * zephir_fast_strlen_ev(text)); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_24$$8, "imagefontheight", NULL, 283, &_22$$8); + width = (zephir_get_intval(_27$$8) * zephir_fast_strlen_ev(text)); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_28$$8, "imagefontheight", NULL, 0, _26$$8); zephir_check_call_status(); - height = zephir_get_intval(_24$$8); + height = zephir_get_intval(_28$$8); if (offsetX < 0) { - _25$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_25$$9) - width) + offsetX); + _29$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_29$$9) - width) + offsetX); } if (offsetY < 0) { - _26$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_26$$10) - height) + offsetY); - } - _27$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, r); - ZEPHIR_SINIT_VAR(_28$$8); - ZVAL_LONG(&_28$$8, g); - ZEPHIR_SINIT_VAR(_29$$8); - ZVAL_LONG(&_29$$8, b); - ZEPHIR_SINIT_VAR(_30$$8); - ZVAL_LONG(&_30$$8, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _27$$8, &_22$$8, &_28$$8, &_29$$8, &_30$$8); - zephir_check_call_status(); + _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_30$$10) - height) + offsetY); + } _31$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_SINIT_NVAR(_28$$8); - ZVAL_LONG(&_28$$8, offsetX); - ZEPHIR_SINIT_NVAR(_29$$8); - ZVAL_LONG(&_29$$8, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 284, _31$$8, &_22$$8, &_28$$8, &_29$$8, text, color); + ZEPHIR_SINIT_VAR(_32$$8); + ZVAL_LONG(&_32$$8, r); + ZEPHIR_SINIT_VAR(_33$$8); + ZVAL_LONG(&_33$$8, g); + ZEPHIR_SINIT_VAR(_34$$8); + ZVAL_LONG(&_34$$8, b); + ZEPHIR_SINIT_VAR(_35$$8); + ZVAL_LONG(&_35$$8, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _31$$8, &_32$$8, &_33$$8, &_34$$8, &_35$$8); + zephir_check_call_status(); + _36$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_INIT_VAR(_37$$8); + ZVAL_LONG(_37$$8, offsetX); + ZEPHIR_INIT_VAR(_38$$8); + ZVAL_LONG(_38$$8, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 0, _36$$8, _26$$8, _37$$8, _38$$8, text, color); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79733,10 +71696,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { - zend_bool _12; - zephir_fcall_cache_entry *_3 = NULL, *_10 = NULL, *_24 = NULL, *_29 = NULL, *_30 = NULL, *_35 = NULL; + zend_bool _13; + zephir_fcall_cache_entry *_10 = NULL, *_29 = NULL, *_30 = NULL; int ZEPHIR_LAST_CALL_STATUS, mask_width = 0, mask_height = 0, x = 0, y = 0, alpha = 0; - zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4, *_5, _6 = zval_used_for_init, _7 = zval_used_for_init, _8, _9, *_11, *_13, *_25, *_36, *_14$$3, *_15$$3, *_16$$3, *_17$$3, _18$$3, _19$$3, _20$$3, _21$$3, _22$$3, _23$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_31$$6, _32$$6 = zval_used_for_init; + zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4, *_5, _6, _7, _8, _9, *_11, *_12, *_14, *_25, *_37, *_15$$3, *_16$$3, *_17$$3, *_18$$3, *_19$$3, *_20$$3, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_35$$5 = NULL, *_36$$5 = NULL, *_31$$6, _32$$6 = zval_used_for_init; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &mask); @@ -79745,22 +71708,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZEPHIR_CALL_METHOD(&_0, mask, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, maskImage); + ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 0, maskImage); zephir_check_call_status(); mask_width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, maskImage); + ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 0, maskImage); zephir_check_call_status(); mask_height = zephir_get_intval(_2); alpha = 127; - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, maskImage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, maskImage, _3); zephir_check_call_status(); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&newimage, this_ptr, "_create", NULL, 0, _4, _5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, newimage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, newimage, _3); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, 0); @@ -79770,42 +71737,42 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_8, 0); ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, &_6, &_7, &_8, &_9); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, &_6, &_7, &_8, &_9); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_6); - ZVAL_LONG(&_6, 0); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 285, newimage, &_6, &_7, color); + ZEPHIR_INIT_NVAR(_3); + ZVAL_LONG(_3, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 0, newimage, _3, _11, color); zephir_check_call_status(); - _11 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_11, mask_width); - if (!(_12)) { - _13 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_13, mask_height); + _12 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_12, mask_width); + if (!(_13)) { + _14 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_14, mask_height); } - if (_12) { - _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 261, _14$$3, _15$$3); - zephir_check_call_status(); - _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, 0); - ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, 0); - ZEPHIR_SINIT_VAR(_20$$3); - ZVAL_LONG(&_20$$3, 0); - ZEPHIR_SINIT_VAR(_21$$3); - ZVAL_LONG(&_21$$3, 0); - ZEPHIR_SINIT_VAR(_22$$3); - ZVAL_LONG(&_22$$3, mask_width); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, mask_height); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 265, tempImage, maskImage, &_18$$3, &_19$$3, &_20$$3, &_21$$3, _16$$3, _17$$3, &_22$$3, &_23$$3); + if (_13) { + _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 0, _15$$3, _16$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_VAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_21$$3); + ZVAL_LONG(_21$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, mask_width); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, mask_height); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 0, tempImage, maskImage, _19$$3, _20$$3, _21$$3, _22$$3, _17$$3, _18$$3, _23$$3, _24$$3); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); ZEPHIR_CPY_WRT(maskImage, tempImage); } @@ -79825,9 +71792,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, maskImage, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, maskImage, &_27$$5, &_28$$5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, maskImage, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, maskImage, index); zephir_check_call_status(); if (zephir_array_isset_string(color, SS("red"))) { zephir_array_fetch_string(&_31$$6, color, SL("red"), PH_NOISY | PH_READONLY, "phalcon/image/adapter/gd.zep", 430 TSRMLS_CC); @@ -79840,10 +71807,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, _33$$5, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, _33$$5, &_27$$5, &_28$$5); zephir_check_call_status(); _34$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, _34$$5, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, _34$$5, index); zephir_check_call_status(); ZEPHIR_OBS_NVAR(r); zephir_array_fetch_string(&r, color, SL("red"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); @@ -79853,22 +71820,22 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { zephir_array_fetch_string(&b, color, SL("blue"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_27$$5); ZVAL_LONG(&_27$$5, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, r, g, b, &_27$$5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, r, g, b, &_27$$5); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, x); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", &_35, 288, newimage, &_27$$5, &_28$$5, color); + ZEPHIR_INIT_NVAR(_35$$5); + ZVAL_LONG(_35$$5, x); + ZEPHIR_INIT_NVAR(_36$$5); + ZVAL_LONG(_36$$5, y); + ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", NULL, 0, newimage, _35$$5, _36$$5, color); zephir_check_call_status(); y++; } x++; } - _36 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, _36); + _37 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _37); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), newimage TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -79877,7 +71844,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { - zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, _5 = zval_used_for_init, *_6, *_7, *_8, *_9 = NULL, *_10$$3; + zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2, _3, _4, _5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13 = NULL, *_14$$3; int r, g, b, opacity, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79902,26 +71869,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { ZVAL_LONG(&_4, b); ZEPHIR_SINIT_VAR(_5); ZVAL_LONG(&_5, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, background, &_2, &_3, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, background, &_2, &_3, &_4, &_5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, background, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, background, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_NVAR(_5); - ZVAL_LONG(&_5, 0); - ZEPHIR_CALL_FUNCTION(&_9, "imagecopy", NULL, 273, background, _6, &_2, &_3, &_4, &_5, _7, _8); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(&_13, "imagecopy", NULL, 0, background, _6, _9, _10, _11, _12, _7, _8); zephir_check_call_status(); - if (zephir_is_true(_9)) { - _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _10$$3); + if (zephir_is_true(_13)) { + _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _14$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), background TSRMLS_CC); } @@ -79931,8 +71898,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { - zephir_fcall_cache_entry *_2 = NULL; - zval *radius_param = NULL, *_0$$3, _1$$3 = zval_used_for_init; + zval *radius_param = NULL, *_0$$3, *_1$$3 = NULL; int radius, ZEPHIR_LAST_CALL_STATUS, i = 0; ZEPHIR_MM_GROW(); @@ -79947,9 +71913,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { break; } _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1$$3); - ZVAL_LONG(&_1$$3, 7); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_2, 276, _0$$3, &_1$$3); + ZEPHIR_INIT_NVAR(_1$$3); + ZEPHIR_GET_CONSTANT(_1$$3, "IMG_FILTER_GAUSSIAN_BLUR"); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, _0$$3, _1$$3); zephir_check_call_status(); i++; } @@ -79959,8 +71925,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { - zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; - zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, _7$$4 = zval_used_for_init, _8$$4 = zval_used_for_init; + zephir_fcall_cache_entry *_5 = NULL; + zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, *_7$$4 = NULL, *_8$$4 = NULL, *_9$$4 = NULL, *_10$$4 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS, x = 0, y = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0; ZEPHIR_MM_GROW(); @@ -79988,20 +71954,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { ZVAL_LONG(&_3$$4, x1); ZEPHIR_SINIT_NVAR(_4$$4); ZVAL_LONG(&_4$$4, y1); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 286, _2$$4, &_3$$4, &_4$$4); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 257, _2$$4, &_3$$4, &_4$$4); zephir_check_call_status(); x2 = (x + amount); y2 = (y + amount); _6$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_3$$4); - ZVAL_LONG(&_3$$4, x); - ZEPHIR_SINIT_NVAR(_4$$4); - ZVAL_LONG(&_4$$4, y); - ZEPHIR_SINIT_NVAR(_7$$4); - ZVAL_LONG(&_7$$4, x2); - ZEPHIR_SINIT_NVAR(_8$$4); - ZVAL_LONG(&_8$$4, y2); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", &_9, 279, _6$$4, &_3$$4, &_4$$4, &_7$$4, &_8$$4, color); + ZEPHIR_INIT_NVAR(_7$$4); + ZVAL_LONG(_7$$4, x); + ZEPHIR_INIT_NVAR(_8$$4); + ZVAL_LONG(_8$$4, y); + ZEPHIR_INIT_NVAR(_9$$4); + ZVAL_LONG(_9$$4, x2); + ZEPHIR_INIT_NVAR(_10$$4); + ZVAL_LONG(_10$$4, y2); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, _6$$4, _7$$4, _8$$4, _9$$4, _10$$4, color); zephir_check_call_status(); y += amount; } @@ -80014,9 +71980,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zend_bool _10; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL, *_16 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_18 = NULL, *_22 = NULL, *_26 = NULL, *_30, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, _15$$6, *_17$$9, *_19$$10, *_20$$10 = NULL, *_21$$10, *_23$$11, *_24$$11 = NULL, *_25$$11, *_27$$12, *_28$$12 = NULL, *_29$$12; + zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_17 = NULL, *_21 = NULL, *_25 = NULL, *_29, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, *_15$$6, *_16$$9, *_18$$10, *_19$$10 = NULL, *_20$$10, *_22$$11, *_23$$11 = NULL, *_24$$11, *_26$$12, *_27$$12 = NULL, *_28$$12; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -80032,7 +71998,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zephir_check_call_status(); if (!(zephir_is_true(ext))) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 289, _1$$3, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 259, _1$$3, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_2); @@ -80040,30 +72006,30 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZEPHIR_CPY_WRT(ext, _2); ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_3, 0)) { ZEPHIR_INIT_ZVAL_NREF(_5$$4); ZVAL_LONG(_5$$4, 1); zephir_update_property_this(this_ptr, SL("_type"), _5$$4 TSRMLS_CC); _5$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 291, _5$$4); + ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 261, _5$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _6$$4 TSRMLS_CC); _8$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _8$$4, file); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _8$$4, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_9, 0); if (!(_10)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_11, 0); } @@ -80072,7 +72038,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZVAL_LONG(_12$$5, 2); zephir_update_property_this(this_ptr, SL("_type"), _12$$5 TSRMLS_CC); _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 291, _12$$5); + ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 261, _12$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _13$$5 TSRMLS_CC); if (quality >= 0) { @@ -80082,73 +72048,73 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { quality = 100; } _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_15$$6); - ZVAL_LONG(&_15$$6, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _14$$6, file, &_15$$6); + ZEPHIR_INIT_VAR(_15$$6); + ZVAL_LONG(_15$$6, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _14$$6, file, _15$$6); zephir_check_call_status(); } else { - _17$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _17$$9, file); + _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _16$$9, file); zephir_check_call_status(); } RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "png", 0); - ZEPHIR_CALL_FUNCTION(&_18, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_17, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_18, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_19$$10); - ZVAL_LONG(_19$$10, 3); - zephir_update_property_this(this_ptr, SL("_type"), _19$$10 TSRMLS_CC); - _19$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_20$$10, "image_type_to_mime_type", &_7, 291, _19$$10); + if (ZEPHIR_IS_LONG(_17, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_18$$10); + ZVAL_LONG(_18$$10, 3); + zephir_update_property_this(this_ptr, SL("_type"), _18$$10 TSRMLS_CC); + _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_19$$10, "image_type_to_mime_type", &_7, 261, _18$$10); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _20$$10 TSRMLS_CC); - _21$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _21$$10, file); + zephir_update_property_this(this_ptr, SL("_mime"), _19$$10 TSRMLS_CC); + _20$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _20$$10, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_22, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_21, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_22, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_23$$11); - ZVAL_LONG(_23$$11, 15); - zephir_update_property_this(this_ptr, SL("_type"), _23$$11 TSRMLS_CC); - _23$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_24$$11, "image_type_to_mime_type", &_7, 291, _23$$11); + if (ZEPHIR_IS_LONG(_21, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_22$$11); + ZVAL_LONG(_22$$11, 15); + zephir_update_property_this(this_ptr, SL("_type"), _22$$11 TSRMLS_CC); + _22$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_23$$11, "image_type_to_mime_type", &_7, 261, _22$$11); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _24$$11 TSRMLS_CC); - _25$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _25$$11, file); + zephir_update_property_this(this_ptr, SL("_mime"), _23$$11 TSRMLS_CC); + _24$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _24$$11, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_26, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_25, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_26, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_27$$12); - ZVAL_LONG(_27$$12, 16); - zephir_update_property_this(this_ptr, SL("_type"), _27$$12 TSRMLS_CC); - _27$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_28$$12, "image_type_to_mime_type", &_7, 291, _27$$12); + if (ZEPHIR_IS_LONG(_25, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_26$$12); + ZVAL_LONG(_26$$12, 16); + zephir_update_property_this(this_ptr, SL("_type"), _26$$12 TSRMLS_CC); + _26$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_27$$12, "image_type_to_mime_type", &_7, 261, _26$$12); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _28$$12 TSRMLS_CC); - _29$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _29$$12, file); + zephir_update_property_this(this_ptr, SL("_mime"), _27$$12 TSRMLS_CC); + _28$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _28$$12, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_INIT_NVAR(_2); object_init_ex(_2, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_30); - ZEPHIR_CONCAT_SVS(_30, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _30); + ZEPHIR_INIT_VAR(_29); + ZEPHIR_CONCAT_SVS(_29, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _29); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/image/adapter/gd.zep", 554 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -80161,8 +72127,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zend_bool _7; zephir_fcall_cache_entry *_3 = NULL, *_5 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_11 = NULL, *_13 = NULL, *_15 = NULL, *_17, *_4$$3, *_9$$4, _10$$4, *_12$$5, *_14$$6, *_16$$7; - zval *ext = NULL, *_18; + zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_12 = NULL, *_14 = NULL, *_16 = NULL, *_19, *_4$$3, *_9$$4, *_10$$4, *_11$$4, *_13$$5, *_15$$6, *_17$$7, *_18$$7; + zval *ext = NULL, *_20; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &ext_param, &quality_param); @@ -80178,81 +72144,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_2, 0)) { _4$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _4$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _4$$3); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_6, 0); if (!(_7)) { ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_8, 0); } if (_7) { _9$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_10$$4); - ZVAL_LONG(&_10$$4, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 293, _9$$4, ZEPHIR_GLOBAL(global_null), &_10$$4); + ZEPHIR_INIT_VAR(_10$$4); + ZVAL_NULL(_10$$4); + ZEPHIR_INIT_VAR(_11$$4); + ZVAL_LONG(_11$$4, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _9$$4, _10$$4, _11$$4); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "png", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_12, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_11, 0)) { - _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _12$$5); + if (ZEPHIR_IS_LONG(_12, 0)) { + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _13$$5); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_13, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_14, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_13, 0)) { - _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _14$$6); + if (ZEPHIR_IS_LONG(_14, 0)) { + _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _15$$6); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_15, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_16, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_15, 0)) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _16$$7, ZEPHIR_GLOBAL(global_null)); + if (ZEPHIR_IS_LONG(_16, 0)) { + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_18$$7); + ZVAL_NULL(_18$$7); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _17$$7, _18$$7); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_INIT_VAR(_17); - object_init_ex(_17, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_18); - ZEPHIR_CONCAT_SVS(_18, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _17, "__construct", NULL, 9, _18); + ZEPHIR_INIT_VAR(_19); + object_init_ex(_19, phalcon_image_exception_ce); + ZEPHIR_INIT_VAR(_20); + ZEPHIR_CONCAT_SVS(_20, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _19, "__construct", NULL, 9, _20); zephir_check_call_status(); - zephir_throw_exception_debug(_17, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); + zephir_throw_exception_debug(_19, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; @@ -80260,7 +72230,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { - zval *width_param = NULL, *height_param = NULL, *image = NULL, _0, _1; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *_0 = NULL, *_1; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -80270,15 +72240,17 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { height = zephir_get_intval(height_param); - ZEPHIR_SINIT_VAR(_0); - ZVAL_LONG(&_0, width); - ZEPHIR_SINIT_VAR(_1); - ZVAL_LONG(&_1, height); - ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 261, &_0, &_1); + ZEPHIR_INIT_VAR(_0); + ZVAL_LONG(_0, width); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, height); + ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 0, _0, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, image, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, image, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_0); + ZVAL_BOOL(_0, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _0); zephir_check_call_status(); RETURN_CCTOR(image); @@ -80294,7 +72266,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __destruct) { ZEPHIR_OBS_VAR(image); zephir_read_property_this(&image, this_ptr, SL("_image"), PH_NOISY_CC); if (Z_TYPE_P(image) == IS_RESOURCE) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, image); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -80397,8 +72369,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { zephir_update_property_this(this_ptr, SL("_file"), file TSRMLS_CC); ZEPHIR_INIT_VAR(_1); object_init_ex(_1, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(_1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); + zephir_check_call_status(); + } zephir_update_property_this(this_ptr, SL("_image"), _1 TSRMLS_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); if ((zephir_file_exists(_2 TSRMLS_CC) == SUCCESS)) { @@ -80467,11 +72441,13 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { _24$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_25$$8); object_init_ex(_25$$8, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_26$$8); - ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); - zephir_check_temp_parameter(_26$$8); - zephir_check_call_status(); + if (zephir_has_constructor(_25$$8 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); + zephir_check_temp_parameter(_26$$8); + zephir_check_call_status(); + } ZEPHIR_INIT_NVAR(_26$$8); ZVAL_LONG(_26$$8, width); ZEPHIR_INIT_VAR(_27$$8); @@ -80685,8 +72661,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _rotate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } while (1) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3$$3); @@ -80875,8 +72853,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { } ZEPHIR_INIT_VAR(fade); object_init_ex(fade, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(fade TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_17, reflection, "getimagewidth", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_18, reflection, "getimageheight", NULL, 0); @@ -80925,12 +72905,16 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { zephir_check_call_status(); ZEPHIR_INIT_VAR(image); object_init_ex(image, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(image TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } _30 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_31, _30, "getimageheight", NULL, 0); zephir_check_call_status(); @@ -81057,8 +73041,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _watermark) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(watermark); object_init_ex(watermark, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(watermark TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(method); ZVAL_STRING(method, "setImageOpacity", 1); if (likely((zephir_method_exists_ex(watermark, SS("getversion") TSRMLS_CC) == SUCCESS))) { @@ -81140,8 +73126,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(draw); object_init_ex(draw, zephir_get_internal_ce(SS("imagickdraw") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(draw TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rgb(%d, %d, %d)", 0); ZEPHIR_SINIT_VAR(_1); @@ -81154,8 +73142,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_4); object_init_ex(_4, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(_4 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(NULL, draw, "setfillcolor", NULL, 0, _4); zephir_check_call_status(); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { @@ -81374,8 +73364,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _mask) { ZEPHIR_INIT_VAR(mask); object_init_ex(mask, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(mask TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_0, image, "render", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, mask, "readimageblob", NULL, 0, _0); @@ -81448,20 +73440,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _background) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel1); object_init_ex(pixel1, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(pixel1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); + zephir_check_call_status(); + } opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(pixel2); object_init_ex(pixel2, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_4); - ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); - zephir_check_temp_parameter(_4); - zephir_check_call_status(); + if (zephir_has_constructor(pixel2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(background); object_init_ex(background, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(background TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); + zephir_check_call_status(); + } _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 0); @@ -83192,7 +75190,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (Z_TYPE_P(handler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_0$$7); @@ -83224,7 +75222,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83304,7 +75302,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __wakeup) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode", "phalcon/logger/adapter/file.zep", 153); return; } - ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 298, path, mode); + ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 263, path, mode); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_fileHandler"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -83493,7 +75491,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (!(zephir_is_true(stream))) { ZEPHIR_INIT_VAR(_0$$6); @@ -83523,7 +75521,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83620,7 +75618,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, __construct) { ZEPHIR_INIT_NVAR(facility); ZVAL_LONG(facility, 8); } - ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 303, name, option, facility); + ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 268, name, option, facility); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_opened"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -83684,7 +75682,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, logInternal) { } zephir_array_fetch_long(&_3, appliedFormat, 0, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); zephir_array_fetch_long(&_4, appliedFormat, 1, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 304, _3, _4); + ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 269, _3, _4); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -83701,7 +75699,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, close) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(1); } - ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 305); + ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 270); zephir_check_call_status(); RETURN_MM(); @@ -84109,7 +76107,7 @@ static PHP_METHOD(Phalcon_Logger_Formatter_Line, format) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_LONG(&_2$$3, timestamp); - ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 306, _1$$3, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 271, _1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2$$3); ZVAL_STRING(&_2$$3, "%date%", 0); @@ -85089,7 +77087,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, _getResultset) { } ZEPHIR_INIT_VAR(collections); array_init(collections); - ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 307, documentsCursor, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 272, documentsCursor, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); zephir_is_iterable(_5, &_7, &_6, 0, 0, "phalcon/mvc/collection.zep", 443); for ( @@ -85563,7 +77561,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _2 TSRMLS_CC); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _5 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 308, _4, _5, exists); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 273, _4, _5, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { RETURN_MM_BOOL(0); @@ -85597,7 +77595,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -85629,7 +77627,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85669,7 +77667,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _6, _7, _8); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _6, _7, _8); zephir_check_call_status(); RETURN_MM(); @@ -85709,22 +77707,22 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 310, criteria); + ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 275, criteria); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&data, this_ptr, "toarray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 311, keys, data); + ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 276, keys, data); zephir_check_call_status(); if (zephir_is_true(_5)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Criteria parameter must be array with one or more attributes of the model", "phalcon/mvc/collection.zep", 1046); return; } - ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 312, data, keys); + ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 277, data, keys); zephir_check_call_status(); success = 0; ZEPHIR_INIT_VAR(_6); @@ -85773,7 +77771,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_14, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _13, _8, _14); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _13, _8, _14); zephir_check_call_status(); RETURN_MM(); @@ -85804,7 +77802,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _3 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, exists); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85839,7 +77837,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -87182,7 +79180,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, mount) { if (zephir_is_true(_0$$5)) { ZEPHIR_INIT_VAR(lazyHandler); object_init_ex(lazyHandler, phalcon_mvc_micro_lazyloader_ce); - ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 313, mainHandler); + ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 278, mainHandler); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(lazyHandler, mainHandler); @@ -87340,7 +79338,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, setService) { } else { ZVAL_BOOL(_0, 0); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 314, serviceName, definition, _0); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 279, serviceName, definition, _0); zephir_check_call_status(); RETURN_MM(); @@ -87376,7 +79374,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, hasService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 315, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 280, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87412,7 +79410,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 316, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 281, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87437,7 +79435,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getSharedService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 317, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 282, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -88547,7 +80545,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, assign) { continue; } } - ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 318, attributeField, value); + ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 283, attributeField, value); zephir_check_call_status(); if (!(zephir_is_true(_10$$16))) { zephir_update_property_zval_zval(this_ptr, attributeField, value TSRMLS_CC); @@ -89000,12 +80998,12 @@ static PHP_METHOD(Phalcon_Mvc_Model, query) { ZEPHIR_CALL_METHOD(NULL, criteria, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 319, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 284, dependencyInjector); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_3); zephir_get_called_class(_3 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, _3); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, _3); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -90031,7 +82029,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, _preSave) { } } if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 321); + ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 286); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_7$$9)) { RETURN_MM_BOOL(0); @@ -90595,9 +82593,9 @@ static PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) { break; } if (ZEPHIR_IS_LONG(dataType, 3) || ZEPHIR_IS_LONG(dataType, 7)) { - ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 322, snapshotValue); + ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 287, snapshotValue); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 322, value); + ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 287, value); zephir_check_call_status(); changed = !ZEPHIR_IS_IDENTICAL(_12$$25, _14$$25); break; @@ -91107,7 +83105,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, save) { object_init_ex(_9$$12, phalcon_mvc_model_validationfailed_ce); ZEPHIR_CALL_METHOD(&_10$$12, this_ptr, "getmessages", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 323, this_ptr, _10$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 288, this_ptr, _10$$12); zephir_check_call_status(); zephir_throw_exception_debug(_9$$12, "phalcon/mvc/model.zep", 3030 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -91277,7 +83275,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { array_init(_1); zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 324); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 289); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2$$3)) { RETURN_MM_BOOL(0); @@ -91395,7 +83393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { ZEPHIR_CALL_METHOD(&success, writeConnection, "delete", NULL, 0, table, _19, values, bindTypes); zephir_check_call_status(); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 325); + ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 290); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_20$$20)) { RETURN_MM_BOOL(0); @@ -92307,7 +84305,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __call) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) != IS_NULL) { RETURN_CCTOR(records); @@ -92350,7 +84348,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __callStatic) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) == IS_NULL) { ZEPHIR_INIT_VAR(_1$$3); @@ -92447,13 +84445,13 @@ static PHP_METHOD(Phalcon_Mvc_Model, __set) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 318, property, value); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 283, property, value); zephir_check_call_status(); if (zephir_is_true(_10)) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 327, this_ptr, property); + ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 292, this_ptr, property); zephir_check_call_status(); if (zephir_is_true(_11)) { ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", &_1, 0); @@ -94849,7 +86847,7 @@ static PHP_METHOD(Phalcon_Mvc_Url, get) { } } if (zephir_is_true(args)) { - ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 385, args); + ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 350, args); zephir_check_call_status(); _25$$19 = Z_TYPE_P(queryString) == IS_STRING; if (_25$$19) { @@ -95591,7 +87589,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _loadTemplateEngines) { if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_1$$4, PH_COPY | PH_SEPARATE); } else { @@ -95682,7 +87680,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _engineRender) { ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(viewsDir, _4); - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 387, viewPath); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 352, viewPath); zephir_check_call_status(); if (!(zephir_is_true(_5$$3))) { ZEPHIR_INIT_NVAR(viewsDirPath); @@ -96223,7 +88221,7 @@ static PHP_METHOD(Phalcon_Mvc_View, getPartial) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "partial", NULL, 0, partialPath, params); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 262); zephir_check_call_status(); RETURN_MM(); @@ -97892,7 +89890,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -99928,12 +91926,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) { ZEPHIR_INIT_VAR(_12$$10); ZEPHIR_CONCAT_SVS(_12$$10, " ", operator, " "); zephir_fast_join(_11$$10, _12$$10, conditions TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 328, _11$$10); + ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 293, _11$$10); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 329, bind); + ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 294, bind); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, modelName); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, modelName); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -100946,7 +92944,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOne) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 1); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101022,7 +93020,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addBelongsTo) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101099,7 +93097,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101194,9 +93192,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasManyToMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 4); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 331, intermediateFields, intermediateModel, intermediateReferencedFields); + ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 296, intermediateFields, intermediateModel, intermediateReferencedFields); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101644,7 +93642,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not supported", "phalcon/mvc/model/manager.zep", 1254); return; } - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 332, extraParameters, parameters); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 297, extraParameters, parameters); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&builder, this_ptr, "createbuilder", NULL, 0, _5$$3); zephir_check_call_status(); @@ -101728,10 +93726,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_CALL_METHOD(&_26, record, "getdi", NULL, 0); zephir_check_call_status(); zephir_array_update_string(&findParams, SL("di"), &_26, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 332, findParams, parameters); + ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 297, findParams, parameters); zephir_check_call_status(); if (Z_TYPE_P(extraParameters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 332, findArguments, extraParameters); + ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 297, findArguments, extraParameters); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(findParams, findArguments); @@ -102448,7 +94446,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, __destruct) { ZEPHIR_MM_GROW(); phalcon_orm_destroy_cache(TSRMLS_C); - ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 333); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 298); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -104180,7 +96178,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCallArgument) { add_assoc_stringl_ex(return_value, SS("type"), SL("all"), 1); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 339, argument); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 304, argument); zephir_check_call_status(); RETURN_MM(); @@ -104215,11 +96213,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_4$$4, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(_4$$4, SS("type"), SL("when"), 1); zephir_array_fetch_string(&_6$$4, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 369 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _6$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _6$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("expr"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_8$$4, whenExpr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 370 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _8$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _8$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("then"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _4$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 371); @@ -104228,7 +96226,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_9$$5, 2, 0 TSRMLS_CC); add_assoc_stringl_ex(_9$$5, SS("type"), SL("else"), 1); zephir_array_fetch_string(&_11$$5, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 375 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 339, _11$$5); + ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 304, _11$$5); zephir_check_call_status(); zephir_array_update_string(&_9$$5, SL("expr"), &_10$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _9$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 376); @@ -104237,7 +96235,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(return_value, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(return_value, SS("type"), SL("case"), 1); zephir_array_fetch_string(&_13, expr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 382 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 339, _13); + ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 304, _13); zephir_check_call_status(); zephir_array_update_string(&return_value, SL("expr"), &_12, PH_COPY | PH_SEPARATE); zephir_array_update_string(&return_value, SL("when-clauses"), &whenClauses, PH_COPY | PH_SEPARATE); @@ -104276,13 +96274,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getFunctionCall) { ; zephir_hash_move_forward_ex(_1$$6, &_0$$6) ) { ZEPHIR_GET_HVALUE(argument, _2$$6); - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 340, argument); + ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 305, argument); zephir_check_call_status(); zephir_array_append(&functionArgs, _3$$7, PH_SEPARATE, "phalcon/mvc/model/query.zep", 406); } } else { zephir_create_array(functionArgs, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 340, arguments); + ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 305, arguments); zephir_check_call_status(); zephir_array_fast_append(functionArgs, _5$$8); } @@ -104351,7 +96349,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_0$$5, 0); } - ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 339, exprLeft, _0$$5); + ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 304, exprLeft, _0$$5); zephir_check_call_status(); } ZEPHIR_OBS_VAR(exprRight); @@ -104362,7 +96360,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_2$$6, 0); } - ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 339, exprRight, _2$$6); + ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 304, exprRight, _2$$6); zephir_check_call_status(); } } @@ -104440,7 +96438,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 355)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); break; } @@ -104885,12 +96883,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 350)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 342, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 307, expr); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(exprType, 409)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 343, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 308, expr); zephir_check_call_status(); break; } @@ -104900,7 +96898,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { add_assoc_stringl_ex(exprReturn, SS("type"), SL("select"), 1); ZEPHIR_INIT_VAR(_36$$68); ZVAL_BOOL(_36$$68, 1); - ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 344, expr, _36$$68); + ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 309, expr, _36$$68); zephir_check_call_status(); zephir_array_update_string(&exprReturn, SL("value"), &_35$$68, PH_COPY | PH_SEPARATE); break; @@ -104919,7 +96917,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { RETURN_CCTOR(exprReturn); } if (zephir_array_isset_string(expr, SS("domain"))) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); RETURN_MM(); } @@ -104932,7 +96930,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { ; zephir_hash_move_forward_ex(_40$$71, &_39$$71) ) { ZEPHIR_GET_HVALUE(exprListItem, _41$$71); - ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 339, exprListItem); + ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 304, exprListItem); zephir_check_call_status(); zephir_array_append(&listItems, _42$$72, PH_SEPARATE, "phalcon/mvc/model/query.zep", 760); } @@ -105053,7 +97051,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSelectColumn) { add_assoc_stringl_ex(sqlColumn, SS("type"), SL("scalar"), 1); ZEPHIR_OBS_VAR(columnData); zephir_array_fetch_string(&columnData, column, SL("column"), PH_NOISY, "phalcon/mvc/model/query.zep", 886 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 339, columnData); + ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 304, columnData); zephir_check_call_status(); ZEPHIR_OBS_VAR(balias); if (zephir_array_isset_string_fetch(&balias, sqlExprColumn, SS("balias"), 0 TSRMLS_CC)) { @@ -105250,7 +97248,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_2$$3, SS("type"), 355); zephir_array_update_string(&_2$$3, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_2$$3, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _2$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _2$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("left"), &_1$$3, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_4$$3); @@ -105258,7 +97256,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_4$$3, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_4$$3, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_4$$3, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _4$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _4$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("right"), &_1$$3, PH_COPY | PH_SEPARATE); zephir_array_fast_append(sqlJoinConditions, _0$$3); @@ -105294,7 +97292,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_14$$5, SS("type"), 355); zephir_array_update_string(&_14$$5, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_14$$5, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _14$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _14$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("left"), &_13$$5, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_15$$5); @@ -105302,7 +97300,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_15$$5, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_15$$5, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$5, SL("name"), &referencedField, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _15$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _15$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("right"), &_13$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlJoinPartialConditions, _12$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1093); @@ -105385,7 +97383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_8$$4, SS("type"), 355); zephir_array_update_string(&_8$$4, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_8$$4, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _8$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _8$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("left"), &_7$$4, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$4); @@ -105393,7 +97391,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_10$$4, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_10$$4, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$4, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _10$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _10$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("right"), &_7$$4, PH_COPY | PH_SEPARATE); } @@ -105415,7 +97413,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_15$$6, SS("type"), 355); zephir_array_update_string(&_15$$6, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$6, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _15$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _15$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_16$$6); @@ -105423,7 +97421,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_16$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_16$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_16$$6, SL("name"), &intermediateFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _16$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _16$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105444,7 +97442,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_17$$6, SS("type"), 355); zephir_array_update_string(&_17$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_17$$6, SL("name"), &intermediateReferencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _17$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _17$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_18$$6); @@ -105452,7 +97450,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_18$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_18$$6, SL("domain"), &referencedModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_18$$6, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _18$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _18$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105528,7 +97526,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(joinItem, _2); - ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 345, manager, joinItem); + ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 310, manager, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, joinData, SL("source"), PH_NOISY, "phalcon/mvc/model/query.zep", 1334 TSRMLS_CC); @@ -105542,7 +97540,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { zephir_create_array(completeSource, 2, 0 TSRMLS_CC); zephir_array_fast_append(completeSource, source); zephir_array_fast_append(completeSource, schema); - ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 346, joinItem); + ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 311, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(aliasExpr); if (zephir_array_isset_string_fetch(&aliasExpr, joinItem, SS("alias"), 0 TSRMLS_CC)) { @@ -105610,7 +97608,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_GET_HVALUE(joinItem, _14); ZEPHIR_OBS_NVAR(joinExpr); if (zephir_array_isset_string_fetch(&joinExpr, joinItem, SS("conditions"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 339, joinExpr); + ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 304, joinExpr); zephir_check_call_status(); zephir_array_update_zval(&joinPreCondition, joinAliasName, &_15$$13, PH_COPY | PH_SEPARATE); } @@ -105707,10 +97705,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_CALL_METHOD(&_41$$23, relation, "isthrough", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_41$$23))) { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 347, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 312, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } else { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 348, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 313, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } if (zephir_array_isset_long(sqlJoin, 0)) { @@ -105781,7 +97779,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getOrderClause) { ) { ZEPHIR_GET_HVALUE(orderItem, _2); zephir_array_fetch_string(&_3$$5, orderItem, SL("column"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 1650 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 339, _3$$5); + ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 304, _3$$5); zephir_check_call_status(); if (zephir_array_isset_string_fetch(&orderSort, orderItem, SS("sort"), 1 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(orderPartSort); @@ -105833,13 +97831,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getGroupClause) { ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HVALUE(groupItem, _2$$3); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 339, groupItem); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 304, groupItem); zephir_check_call_status(); zephir_array_append(&groupParts, _3$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1684); } } else { zephir_create_array(groupParts, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 339, group); + ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 304, group); zephir_check_call_status(); zephir_array_fast_append(groupParts, _5$$5); } @@ -105864,13 +97862,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getLimitClause) { array_init(limit); ZEPHIR_OBS_VAR(number); if (zephir_array_isset_string_fetch(&number, limitClause, SS("number"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 339, number); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 304, number); zephir_check_call_status(); zephir_array_update_string(&limit, SL("number"), &_0$$3, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(offset); if (zephir_array_isset_string_fetch(&offset, limitClause, SS("offset"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 339, offset); + ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 304, offset); zephir_check_call_status(); zephir_array_update_string(&limit, SL("offset"), &_2$$4, PH_COPY | PH_SEPARATE); } @@ -106193,12 +98191,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { if (zephir_fast_count_int(automaticJoins TSRMLS_CC)) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(sqlJoins); @@ -106214,7 +98212,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { ; zephir_hash_move_forward_ex(_43, &_42) ) { ZEPHIR_GET_HVALUE(column, _44); - ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 350, column); + ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 315, column); zephir_check_call_status(); zephir_is_iterable(_45$$41, &_48$$41, &_47$$41, 0, 0, "phalcon/mvc/model/query.zep", 2024); for ( @@ -106263,31 +98261,31 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { } ZEPHIR_OBS_VAR(where); if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 339, where); + ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 304, where); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("where"), &_53$$51, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(groupBy); if (zephir_array_isset_string_fetch(&groupBy, ast, SS("groupBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 351, groupBy); + ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 316, groupBy); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("group"), &_55$$52, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(having); if (zephir_array_isset_string_fetch(&having, ast, SS("having"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 339, having); + ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 304, having); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("having"), &_56$$53, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(order); if (zephir_array_isset_string_fetch(&order, ast, SS("orderBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 352, order); + ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 317, order); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("order"), &_57$$54, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("limit"), &_58$$55, PH_COPY | PH_SEPARATE); } @@ -106385,7 +98383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareInsert) { } else { ZVAL_BOOL(_11$$9, 0); } - ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 339, exprValue, _11$$9); + ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 304, exprValue, _11$$9); zephir_check_call_status(); zephir_array_update_string(&_8$$9, SL("value"), &_10$$9, PH_COPY | PH_SEPARATE); zephir_array_append(&exprValues, _8$$9, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2139); @@ -106566,7 +98564,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_14$$17, 0); } - ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 339, _13$$17, _14$$17); + ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 304, _13$$17, _14$$17); zephir_check_call_status(); zephir_array_append(&sqlFields, _12$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2289); ZEPHIR_OBS_NVAR(exprColumn); @@ -106582,7 +98580,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_19$$17, 0); } - ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 339, exprColumn, _19$$17); + ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 304, exprColumn, _19$$17); zephir_check_call_status(); zephir_array_update_string(&_16$$17, SL("value"), &_18$$17, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlValues, _16$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2294); @@ -106597,13 +98595,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_21$$18); ZVAL_BOOL(_21$$18, 1); - ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 339, where, _21$$18); + ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 304, where, _21$$18); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("where"), &_20$$18, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("limit"), &_22$$19, PH_COPY | PH_SEPARATE); } @@ -106722,13 +98720,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareDelete) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_10$$14); ZVAL_BOOL(_10$$14, 1); - ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 339, where, _10$$14); + ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 304, where, _10$$14); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("where"), &_9$$14, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("limit"), &_11$$15, PH_COPY | PH_SEPARATE); } @@ -106776,22 +98774,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, parse) { zephir_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 344); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 309); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 354); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 319); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 355); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 320); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 356); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 321); zephir_check_call_status(); break; } @@ -107191,12 +99189,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeSelect) { } else { ZVAL_BOOL(_55$$53, 0); } - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 357, simpleColumnMap, resultObject, resultData, cache, _55$$53); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 322, simpleColumnMap, resultObject, resultData, cache, _55$$53); zephir_check_call_status(); RETURN_MM(); } object_init_ex(return_value, phalcon_mvc_model_resultset_complex_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 358, columns1, resultData, cache); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 323, columns1, resultData, cache); zephir_check_call_status(); RETURN_MM(); @@ -107356,7 +99354,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeInsert) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_CALL_METHOD(&_20, insertModel, "create", NULL, 0, insertValues); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 359, _20, insertModel); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 324, _20, insertModel); zephir_check_call_status(); RETURN_MM(); @@ -107486,13 +99484,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { zephir_array_update_zval(&updateValues, fieldName, &updateValue, PH_COPY | PH_SEPARATE); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, selectBindParams, selectBindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, selectBindParams, selectBindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_17$$19); ZVAL_BOOL(_17$$19, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _17$$19); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _17$$19); zephir_check_call_status(); RETURN_MM(); } @@ -107527,7 +99525,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_23$$24); ZVAL_BOOL(_23$$24, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _23$$24, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _23$$24, record); zephir_check_call_status(); RETURN_MM(); } @@ -107539,7 +99537,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_25); ZVAL_BOOL(_25, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _25); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _25); zephir_check_call_status(); RETURN_MM(); @@ -107571,13 +99569,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { ZEPHIR_CALL_METHOD(&model, _1$$4, "load", NULL, 0, modelName); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, bindParams, bindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_2$$5); ZVAL_BOOL(_2$$5, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _2$$5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _2$$5); zephir_check_call_status(); RETURN_MM(); } @@ -107612,7 +99610,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_8$$10); ZVAL_BOOL(_8$$10, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _8$$10, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _8$$10, record); zephir_check_call_status(); RETURN_MM(); } @@ -107624,7 +99622,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_10); ZVAL_BOOL(_10, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _10); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _10); zephir_check_call_status(); RETURN_MM(); @@ -107672,18 +99670,18 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getRelatedRecords) { } ZEPHIR_INIT_VAR(query); object_init_ex(query, phalcon_mvc_model_query_ce); - ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 361); + ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 326); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 362, _5); + ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 327, _5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 309); - ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 363, _2); + ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 328, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 364, selectIr); + ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 329, selectIr); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); RETURN_MM(); @@ -107804,22 +99802,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, execute) { zephir_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 366, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 331, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 367, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 332, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 368, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 333, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 369, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 334, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } @@ -107874,7 +99872,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSingleResult) { zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(_1, "getfirst", NULL, 0); zephir_check_call_status(); @@ -108071,7 +100069,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSql) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_bindTypes"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3$$3); ZVAL_BOOL(_3$$3, 1); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 366, intermediate, _1$$3, _2$$3, _3$$3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 331, intermediate, _1$$3, _2$$3, _3$$3); zephir_check_call_status(); RETURN_MM(); } @@ -109503,7 +101501,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, rollback) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_model_transaction_failed_ce); _2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackRecord"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 376, rollbackMessage, _2$$4); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 341, rollbackMessage, _2$$4); zephir_check_call_status(); zephir_throw_exception_debug(_1$$4, "phalcon/mvc/model/transaction.zep", 163 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -109522,7 +101520,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, getConnection) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackOnAbort"), PH_NOISY_CC); if (zephir_is_true(_0)) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 377); + ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 342); zephir_check_call_status(); if (zephir_is_true(_1$$3)) { ZEPHIR_INIT_VAR(_2$$4); @@ -110080,7 +102078,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -110458,9 +102456,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 335, _2, options); + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 300, _2, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110554,7 +102552,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110658,9 +102656,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 337, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 302, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110754,7 +102752,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110962,9 +102960,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 338, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 303, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -111058,7 +103056,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -111904,703 +103902,6 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getColumnMa - -const phql_token_names phql_tokens[] = -{ - { SL("INTEGER"), PHQL_T_INTEGER }, - { SL("DOUBLE"), PHQL_T_DOUBLE }, - { SL("STRING"), PHQL_T_STRING }, - { SL("IDENTIFIER"), PHQL_T_IDENTIFIER }, - { SL("HEXAINTEGER"), PHQL_T_HINTEGER }, - { SL("MINUS"), PHQL_T_MINUS }, - { SL("+"), PHQL_T_ADD }, - { SL("-"), PHQL_T_SUB }, - { SL("*"), PHQL_T_MUL }, - { SL("/"), PHQL_T_DIV }, - { SL("&"), PHQL_T_BITWISE_AND }, - { SL("|"), PHQL_T_BITWISE_OR }, - { SL("%%"), PHQL_T_MOD }, - { SL("AND"), PHQL_T_AND }, - { SL("OR"), PHQL_T_OR }, - { SL("LIKE"), PHQL_T_LIKE }, - { SL("ILIKE"), PHQL_T_ILIKE }, - { SL("DOT"), PHQL_T_DOT }, - { SL("COLON"), PHQL_T_COLON }, - { SL("COMMA"), PHQL_T_COMMA }, - { SL("EQUALS"), PHQL_T_EQUALS }, - { SL("NOT EQUALS"), PHQL_T_NOTEQUALS }, - { SL("NOT"), PHQL_T_NOT }, - { SL("<"), PHQL_T_LESS }, - { SL("<="), PHQL_T_LESSEQUAL }, - { SL(">"), PHQL_T_GREATER }, - { SL(">="), PHQL_T_GREATEREQUAL }, - { SL("("), PHQL_T_PARENTHESES_OPEN }, - { SL(")"), PHQL_T_PARENTHESES_CLOSE }, - { SL("NUMERIC PLACEHOLDER"), PHQL_T_NPLACEHOLDER }, - { SL("STRING PLACEHOLDER"), PHQL_T_SPLACEHOLDER }, - { SL("UPDATE"), PHQL_T_UPDATE }, - { SL("SET"), PHQL_T_SET }, - { SL("WHERE"), PHQL_T_WHERE }, - { SL("DELETE"), PHQL_T_DELETE }, - { SL("FROM"), PHQL_T_FROM }, - { SL("AS"), PHQL_T_AS }, - { SL("INSERT"), PHQL_T_INSERT }, - { SL("INTO"), PHQL_T_INTO }, - { SL("VALUES"), PHQL_T_VALUES }, - { SL("SELECT"), PHQL_T_SELECT }, - { SL("ORDER"), PHQL_T_ORDER }, - { SL("BY"), PHQL_T_BY }, - { SL("LIMIT"), PHQL_T_LIMIT }, - { SL("OFFSET"), PHQL_T_OFFSET }, - { SL("GROUP"), PHQL_T_GROUP }, - { SL("HAVING"), PHQL_T_HAVING }, - { SL("IN"), PHQL_T_IN }, - { SL("ON"), PHQL_T_ON }, - { SL("INNER"), PHQL_T_INNER }, - { SL("JOIN"), PHQL_T_JOIN }, - { SL("LEFT"), PHQL_T_LEFT }, - { SL("RIGHT"), PHQL_T_RIGHT }, - { SL("IS"), PHQL_T_IS }, - { SL("NULL"), PHQL_T_NULL }, - { SL("NOT IN"), PHQL_T_NOTIN }, - { SL("CROSS"), PHQL_T_CROSS }, - { SL("OUTER"), PHQL_T_OUTER }, - { SL("FULL"), PHQL_T_FULL }, - { SL("ASC"), PHQL_T_ASC }, - { SL("DESC"), PHQL_T_DESC }, - { SL("BETWEEN"), PHQL_T_BETWEEN }, - { SL("DISTINCT"), PHQL_T_DISTINCT }, - { SL("AGAINST"), PHQL_T_AGAINST }, - { SL("CAST"), PHQL_T_CAST }, - { SL("CONVERT"), PHQL_T_CONVERT }, - { SL("USING"), PHQL_T_USING }, - { SL("ALL"), PHQL_T_ALL }, - { SL("EXISTS"), PHQL_T_EXISTS }, - { SL("CASE"), PHQL_T_CASE }, - { SL("WHEN"), PHQL_T_WHEN }, - { SL("THEN"), PHQL_T_THEN }, - { SL("ELSE"), PHQL_T_ELSE }, - { SL("END"), PHQL_T_END }, - { SL("FOR"), PHQL_T_FOR }, - { SL("WITH"), PHQL_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phql_wrapper_alloc(size_t bytes) -{ - return emalloc(bytes); -} - -static void phql_wrapper_free(void *pointer) -{ - efree(pointer); -} - -static void phql_parse_with_token(void* phql_parser, int opcode, int parsercode, phql_scanner_token *token, phql_parser_status *parser_status) -{ - - phql_parser_token *pToken; - - pToken = emalloc(sizeof(phql_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - phql_(phql_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phql_scanner_error_msg(phql_parser_status *parser_status, zval **error_msg TSRMLS_DC) -{ - - char *error = NULL, *error_part; - unsigned int length; - phql_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_UNDEF(*error_msg); -#endif - - if (state->start) { - length = 64 + state->start_length + parser_status->phql_length; - error = emalloc(sizeof(char) * length); - if (state->start_length > 16) { - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' when parsing: %s (%d)", error_part, parser_status->phql, parser_status->phql_length); - efree(error_part); - } else { - snprintf(error, length, "Scanning error before '%s' when parsing: %s (%d)", state->start, parser_status->phql, parser_status->phql_length); - } - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - } else { -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, "Scanning error near to EOF", 1); -#else - ZVAL_STRING(*error_msg, "Scanning error near to EOF"); -#endif - } - - if (error) { - efree(error); - } -} - -static int phql_parse_phql(zval *result, zval *phql TSRMLS_DC) -{ -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval err_msg, *error_msg = &err_msg; - ZVAL_UNDEF(error_msg); -#endif - - ZVAL_NULL(result); - - if (phql_internal_parse_phql(&result, Z_STRVAL_P(phql), Z_STRLEN_P(phql), &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, Z_STRVAL_P(error_msg)); - return FAILURE; - } - - return SUCCESS; -} - -static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length, zval **error_msg TSRMLS_DC) -{ - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; - phql_parser_status *parser_status = NULL; - int scanner_status, status = SUCCESS, error_length, cache_level; - phql_scanner_state *state; - phql_scanner_token token; - void* phql_parser; - char *error; - unsigned long phql_key = 0; -#if PHP_VERSION_ID < 70000 - zval **temp_ast; -#else - zval *temp_ast; -#endif - - if (!phql) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL", 1); -#else - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL"); -#endif - return FAILURE; - } - - cache_level = phalcon_globals_ptr->orm.cache_level; - if (cache_level >= 0) { - phql_key = zend_inline_hash_func(phql, phql_length + 1); - if (phalcon_globals_ptr->orm.parser_cache != NULL) { -#if PHP_VERSION_ID < 70000 - if (zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key, (void**) &temp_ast) == SUCCESS) { - ZVAL_ZVAL(*result, *temp_ast, 1, 0); - Z_SET_REFCOUNT_P(*result, 1); - return SUCCESS; - } -#else - if ((temp_ast = zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key)) != NULL) { - ZVAL_ZVAL(*result, temp_ast, 1, 0); - Z_TRY_ADDREF_P(*result); - return SUCCESS; - } -#endif - } - } - - phql_parser = phql_Alloc(phql_wrapper_alloc); - - parser_status = emalloc(sizeof(phql_parser_status)); - state = emalloc(sizeof(phql_scanner_state)); - - parser_status->status = PHQL_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->syntax_error = NULL; - parser_status->token = &token; - parser_status->enable_literals = phalcon_globals_ptr->orm.enable_literals; - parser_status->phql = phql; - parser_status->phql_length = phql_length; - - state->active_token = 0; - state->start = phql; - state->start_length = 0; - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phql_get_token(state, &token))) { - - /* Calculate the 'start' length */ - state->start_length = (phql + phql_length - state->start); - - state->active_token = token.opcode; - - /* Parse the token found */ - switch (token.opcode) { - - case PHQL_T_IGNORE: - break; - - case PHQL_T_ADD: - phql_(phql_parser, PHQL_PLUS, NULL, parser_status); - break; - case PHQL_T_SUB: - phql_(phql_parser, PHQL_MINUS, NULL, parser_status); - break; - case PHQL_T_MUL: - phql_(phql_parser, PHQL_TIMES, NULL, parser_status); - break; - case PHQL_T_DIV: - phql_(phql_parser, PHQL_DIVIDE, NULL, parser_status); - break; - case PHQL_T_MOD: - phql_(phql_parser, PHQL_MOD, NULL, parser_status); - break; - case PHQL_T_AND: - phql_(phql_parser, PHQL_AND, NULL, parser_status); - break; - case PHQL_T_OR: - phql_(phql_parser, PHQL_OR, NULL, parser_status); - break; - case PHQL_T_EQUALS: - phql_(phql_parser, PHQL_EQUALS, NULL, parser_status); - break; - case PHQL_T_NOTEQUALS: - phql_(phql_parser, PHQL_NOTEQUALS, NULL, parser_status); - break; - case PHQL_T_LESS: - phql_(phql_parser, PHQL_LESS, NULL, parser_status); - break; - case PHQL_T_GREATER: - phql_(phql_parser, PHQL_GREATER, NULL, parser_status); - break; - case PHQL_T_GREATEREQUAL: - phql_(phql_parser, PHQL_GREATEREQUAL, NULL, parser_status); - break; - case PHQL_T_LESSEQUAL: - phql_(phql_parser, PHQL_LESSEQUAL, NULL, parser_status); - break; - - case PHQL_T_IDENTIFIER: - phql_parse_with_token(phql_parser, PHQL_T_IDENTIFIER, PHQL_IDENTIFIER, &token, parser_status); - break; - - case PHQL_T_DOT: - phql_(phql_parser, PHQL_DOT, NULL, parser_status); - break; - case PHQL_T_COMMA: - phql_(phql_parser, PHQL_COMMA, NULL, parser_status); - break; - - case PHQL_T_PARENTHESES_OPEN: - phql_(phql_parser, PHQL_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHQL_T_PARENTHESES_CLOSE: - phql_(phql_parser, PHQL_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHQL_T_LIKE: - phql_(phql_parser, PHQL_LIKE, NULL, parser_status); - break; - case PHQL_T_ILIKE: - phql_(phql_parser, PHQL_ILIKE, NULL, parser_status); - break; - case PHQL_T_NOT: - phql_(phql_parser, PHQL_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_AND: - phql_(phql_parser, PHQL_BITWISE_AND, NULL, parser_status); - break; - case PHQL_T_BITWISE_OR: - phql_(phql_parser, PHQL_BITWISE_OR, NULL, parser_status); - break; - case PHQL_T_BITWISE_NOT: - phql_(phql_parser, PHQL_BITWISE_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_XOR: - phql_(phql_parser, PHQL_BITWISE_XOR, NULL, parser_status); - break; - case PHQL_T_AGAINST: - phql_(phql_parser, PHQL_AGAINST, NULL, parser_status); - break; - case PHQL_T_CASE: - phql_(phql_parser, PHQL_CASE, NULL, parser_status); - break; - case PHQL_T_WHEN: - phql_(phql_parser, PHQL_WHEN, NULL, parser_status); - break; - case PHQL_T_THEN: - phql_(phql_parser, PHQL_THEN, NULL, parser_status); - break; - case PHQL_T_END: - phql_(phql_parser, PHQL_END, NULL, parser_status); - break; - case PHQL_T_ELSE: - phql_(phql_parser, PHQL_ELSE, NULL, parser_status); - break; - case PHQL_T_FOR: - phql_(phql_parser, PHQL_FOR, NULL, parser_status); - break; - case PHQL_T_WITH: - phql_(phql_parser, PHQL_WITH, NULL, parser_status); - break; - - case PHQL_T_INTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_INTEGER, PHQL_INTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_DOUBLE: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_DOUBLE, PHQL_DOUBLE, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_STRING: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_STRING, PHQL_STRING, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_TRUE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_TRUE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_FALSE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_FALSE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_HINTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_HINTEGER, PHQL_HINTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - - case PHQL_T_NPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_NPLACEHOLDER, PHQL_NPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_SPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_SPLACEHOLDER, PHQL_SPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_BPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_BPLACEHOLDER, PHQL_BPLACEHOLDER, &token, parser_status); - break; - - case PHQL_T_FROM: - phql_(phql_parser, PHQL_FROM, NULL, parser_status); - break; - case PHQL_T_UPDATE: - phql_(phql_parser, PHQL_UPDATE, NULL, parser_status); - break; - case PHQL_T_SET: - phql_(phql_parser, PHQL_SET, NULL, parser_status); - break; - case PHQL_T_WHERE: - phql_(phql_parser, PHQL_WHERE, NULL, parser_status); - break; - case PHQL_T_DELETE: - phql_(phql_parser, PHQL_DELETE, NULL, parser_status); - break; - case PHQL_T_INSERT: - phql_(phql_parser, PHQL_INSERT, NULL, parser_status); - break; - case PHQL_T_INTO: - phql_(phql_parser, PHQL_INTO, NULL, parser_status); - break; - case PHQL_T_VALUES: - phql_(phql_parser, PHQL_VALUES, NULL, parser_status); - break; - case PHQL_T_SELECT: - phql_(phql_parser, PHQL_SELECT, NULL, parser_status); - break; - case PHQL_T_AS: - phql_(phql_parser, PHQL_AS, NULL, parser_status); - break; - case PHQL_T_ORDER: - phql_(phql_parser, PHQL_ORDER, NULL, parser_status); - break; - case PHQL_T_BY: - phql_(phql_parser, PHQL_BY, NULL, parser_status); - break; - case PHQL_T_LIMIT: - phql_(phql_parser, PHQL_LIMIT, NULL, parser_status); - break; - case PHQL_T_OFFSET: - phql_(phql_parser, PHQL_OFFSET, NULL, parser_status); - break; - case PHQL_T_GROUP: - phql_(phql_parser, PHQL_GROUP, NULL, parser_status); - break; - case PHQL_T_HAVING: - phql_(phql_parser, PHQL_HAVING, NULL, parser_status); - break; - case PHQL_T_ASC: - phql_(phql_parser, PHQL_ASC, NULL, parser_status); - break; - case PHQL_T_DESC: - phql_(phql_parser, PHQL_DESC, NULL, parser_status); - break; - case PHQL_T_IN: - phql_(phql_parser, PHQL_IN, NULL, parser_status); - break; - case PHQL_T_ON: - phql_(phql_parser, PHQL_ON, NULL, parser_status); - break; - case PHQL_T_INNER: - phql_(phql_parser, PHQL_INNER, NULL, parser_status); - break; - case PHQL_T_JOIN: - phql_(phql_parser, PHQL_JOIN, NULL, parser_status); - break; - case PHQL_T_LEFT: - phql_(phql_parser, PHQL_LEFT, NULL, parser_status); - break; - case PHQL_T_RIGHT: - phql_(phql_parser, PHQL_RIGHT, NULL, parser_status); - break; - case PHQL_T_CROSS: - phql_(phql_parser, PHQL_CROSS, NULL, parser_status); - break; - case PHQL_T_FULL: - phql_(phql_parser, PHQL_FULL, NULL, parser_status); - break; - case PHQL_T_OUTER: - phql_(phql_parser, PHQL_OUTER, NULL, parser_status); - break; - case PHQL_T_IS: - phql_(phql_parser, PHQL_IS, NULL, parser_status); - break; - case PHQL_T_NULL: - phql_(phql_parser, PHQL_NULL, NULL, parser_status); - break; - case PHQL_T_BETWEEN: - phql_(phql_parser, PHQL_BETWEEN, NULL, parser_status); - break; - case PHQL_T_DISTINCT: - phql_(phql_parser, PHQL_DISTINCT, NULL, parser_status); - break; - case PHQL_T_ALL: - phql_(phql_parser, PHQL_ALL, NULL, parser_status); - break; - case PHQL_T_CAST: - phql_(phql_parser, PHQL_CAST, NULL, parser_status); - break; - case PHQL_T_CONVERT: - phql_(phql_parser, PHQL_CONVERT, NULL, parser_status); - break; - case PHQL_T_USING: - phql_(phql_parser, PHQL_USING, NULL, parser_status); - break; - case PHQL_T_EXISTS: - phql_(phql_parser, PHQL_EXISTS, NULL, parser_status); - break; - - default: - parser_status->status = PHQL_PARSING_FAILED; - error_length = sizeof(char) * 32; - error = emalloc(error_length); - snprintf(error, error_length, "Scanner: Unknown opcode %d", token.opcode); - error[error_length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - efree(error); - break; - } - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHQL_SCANNER_RETCODE_ERR: - case PHQL_SCANNER_RETCODE_IMPOSSIBLE: -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#endif - status = FAILURE; - break; - - default: - phql_(phql_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - ZVAL_STRING(*error_msg, parser_status->syntax_error); - } -#endif - efree(parser_status->syntax_error); - } - } - - phql_Free(phql_parser, phql_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHQL_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { -#endif - - if (phalcon_globals_ptr->orm.cache_level >= 1) { -#if PHP_VERSION_ID < 70000 - if (Z_TYPE_P(parser_status->ret) == IS_ARRAY) { - add_assoc_long(parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { - add_assoc_long(&parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#endif - } - -#if PHP_VERSION_ID < 70000 - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - - if (cache_level >= 0) { - - if (!phalcon_globals_ptr->orm.parser_cache) { - ALLOC_HASHTABLE(phalcon_globals_ptr->orm.parser_cache); - zend_hash_init(phalcon_globals_ptr->orm.parser_cache, 0, NULL, ZVAL_PTR_DTOR, 0); - } - -#if PHP_VERSION_ID < 70000 - - Z_ADDREF_PP(result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - result, - sizeof(zval *), - NULL - ); -#else - Z_TRY_ADDREF_P(*result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - *result - ); -#endif - } - - } else { -#if PHP_VERSION_ID < 70000 - efree(parser_status->ret); -#endif - } - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -113855,9 +105156,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { } else { ZEPHIR_CPY_WRT(attributeField, firstPrimaryKey); } - ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 370, attributeField); + ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 335, attributeField); zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$13); ZEPHIR_CONCAT_VSVSV(_9$$13, _6$$13, ".", _8$$13, " = ", conditions); @@ -113903,7 +105204,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { if (Z_TYPE_P(columnAlias) == IS_LONG) { zephir_array_append(&selectedColumns, column, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1135); } else { - ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 370, columnAlias); + ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 335, columnAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_15$$28); ZEPHIR_CONCAT_VSV(_15$$28, column, " AS ", _14$$28); @@ -113929,11 +105230,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HVALUE(model, _19$$31); ZEPHIR_INIT_NVAR(selectedColumn); if (Z_TYPE_P(modelColumnAlias) == IS_LONG) { - ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _20$$33, ".*"); } else { - ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 370, modelColumnAlias); + ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 335, modelColumnAlias); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _21$$34, ".*"); } @@ -113943,7 +105244,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { zephir_fast_join_str(_22$$31, SL(", "), selectedColumns TSRMLS_CC); zephir_concat_self(&phql, _22$$31 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_24$$35); ZEPHIR_CONCAT_VS(_24$$35, _23$$35, ".*"); @@ -113961,14 +105262,14 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HMKEY(modelAlias, _26$$36, _25$$36); ZEPHIR_GET_HVALUE(model, _27$$36); if (Z_TYPE_P(modelAlias) == IS_STRING) { - ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 370, modelAlias); + ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 335, modelAlias); zephir_check_call_status(); ZEPHIR_INIT_NVAR(selectedModel); ZEPHIR_CONCAT_VSV(selectedModel, _28$$38, " AS ", _29$$38); } else { - ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); } zephir_array_append(&selectedModels, selectedModel, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1184); @@ -113979,7 +105280,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_CONCAT_SV(_31$$36, " FROM ", _30$$36); zephir_concat_self(&phql, _31$$36 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_33$$40); ZEPHIR_CONCAT_SV(_33$$40, " FROM ", _32$$40); @@ -114003,20 +105304,20 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_OBS_NVAR(joinType); zephir_array_fetch_long(&joinType, join, 3, PH_NOISY, "phalcon/mvc/model/query/builder.zep", 1219 TSRMLS_CC); if (zephir_is_true(joinType)) { - ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_38$$43); ZEPHIR_CONCAT_SVSV(_38$$43, " ", joinType, " JOIN ", _37$$43); zephir_concat_self(&phql, _38$$43 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_40$$44); ZEPHIR_CONCAT_SV(_40$$44, " JOIN ", _39$$44); zephir_concat_self(&phql, _40$$44 TSRMLS_CC); } if (zephir_is_true(joinAlias)) { - ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 370, joinAlias); + ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 335, joinAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_42$$45); ZEPHIR_CONCAT_SV(_42$$45, " AS ", _41$$45); @@ -114061,7 +105362,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_50$$49, &_49$$49) ) { ZEPHIR_GET_HVALUE(groupItem, _51$$49); - ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 370, groupItem); + ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 335, groupItem); zephir_check_call_status(); zephir_array_append(&groupItems, _52$$52, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1268); } @@ -114092,7 +105393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_57$$56, &_56$$56) ) { ZEPHIR_GET_HVALUE(orderItem, _58$$56); - ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 370, orderItem); + ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 335, orderItem); zephir_check_call_status(); zephir_array_append(&orderItems, _59$$57, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1289); } @@ -114184,7 +105485,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getQuery) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 371); + ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 336); zephir_check_call_status(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); @@ -114378,4372 +105679,19 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Lang, parsePHQL) { - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || - spy->prec<0 || spx->prec==spy->prec ){ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 39 "parser.php5.lemon" + + +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -118751,41 +105699,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** PPCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** PPNOCODE is a number of type PPCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** PPFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** PPACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phql_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** PPMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phql_TOKENTYPE. The entry in the union +** for base tokens is called "pp0". +** PPSTACKDEPTH is the maximum depth of the parser's stack. +** phql_ARG_SDECL A static variable declaration for the %extra_argument +** phql_ARG_PDECL A parameter declaration for the %extra_argument +** phql_ARG_STORE Code to store %extra_argument into pppParser +** phql_ARG_FETCH Code to extract %extra_argument from pppParser +** PPNSTATE the combined number of states. +** PPNRULE the number of rules in the grammar +** PPERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define PPCODETYPE unsigned char +#define PPNOCODE 134 +#define PPACTIONTYPE unsigned short int +#define phql_TOKENTYPE phql_parser_token* +typedef union { + phql_TOKENTYPE pp0; + zval* pp162; + int pp267; +} PPMINORTYPE; +#define PPSTACKDEPTH 100 +#define phql_ARG_SDECL phql_parser_status *status; +#define phql_ARG_PDECL ,phql_parser_status *status +#define phql_ARG_FETCH phql_parser_status *status = pppParser->status +#define phql_ARG_STORE pppParser->status = status +#define PPNSTATE 293 +#define PPNRULE 161 +#define PPERRORSYMBOL 79 +#define PPERRSYMDT pp267 +#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) +#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) +#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -118795,741 +105760,126 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < PPNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == PPNSTATE+PPNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == PPNSTATE+PPNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused +** slots in the pp_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named pp_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** pp_action[ pp_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value pp_shift_ofst[S]+X is out of range or if the value +** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] +** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table +** and that pp_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the pp_reduce_ofst[] array is used in place of +** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of +** PP_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** pp_action[] A single table containing all actions. +** pp_lookahead[] A table containing the lookahead for each entry in +** pp_action. Used to detect hash collisions. +** pp_shift_ofst[] For each state, the offset into pp_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** pp_reduce_ofst[] For each state, the offset into pp_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. +** pp_default[] Default action for each state. */ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 39 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** PPCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** PPNOCODE is a number of type PPCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** PPFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** PPACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** PPMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "pp0". -** PPSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into pppParser -** phql_ARG_FETCH Code to extract %extra_argument from pppParser -** PPNSTATE the combined number of states. -** PPNRULE the number of rules in the grammar -** PPERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define PPCODETYPE unsigned char -#define PPNOCODE 134 -#define PPACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE pp0; - zval* pp162; - int pp267; -} PPMINORTYPE; -#define PPSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = pppParser->status -#define phql_ARG_STORE pppParser->status = status -#define PPNSTATE 293 -#define PPNRULE 161 -#define PPERRORSYMBOL 79 -#define PPERRSYMDT pp267 -#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) -#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) -#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < PPNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. -** -** N == PPNSTATE+PPNRULE A syntax error has occurred. -** -** N == PPNSTATE+PPNRULE+1 The parser accepts its input. -** -** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused -** slots in the pp_action[] table. -** -** The action table is constructed as a single large table named pp_action[]. -** Given state S and lookahead X, the action is computed as -** -** pp_action[ pp_shift_ofst[S] + X ] -** -** If the index value pp_shift_ofst[S]+X is out of range or if the value -** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] -** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table -** and that pp_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the pp_reduce_ofst[] array is used in place of -** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of -** PP_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** pp_action[] A single table containing all actions. -** pp_lookahead[] A table containing the lookahead for each entry in -** pp_action. Used to detect hash collisions. -** pp_shift_ofst[] For each state, the offset into pp_action for -** shifting terminals. -** pp_reduce_ofst[] For each state, the offset into pp_action for -** shifting non-terminals after a reduce. -** pp_default[] Default action for each state. -*/ -static PPACTIONTYPE pp_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, +static PPACTIONTYPE pp_action[] = { + /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, + /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, + /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, + /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, + /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, + /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, + /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, + /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, + /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, + /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, + /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, + /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, + /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, + /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, + /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, + /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, + /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, + /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, + /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, + /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, + /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, + /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, + /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, + /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, + /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, + /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, + /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, + /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, + /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, + /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, + /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, + /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, + /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, + /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, + /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, + /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, + /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, + /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, + /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, + /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, + /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, + /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, + /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, + /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, + /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, + /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, + /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, + /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, + /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, + /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, + /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, + /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, + /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, + /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, + /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, + /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, + /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, + /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, + /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, + /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, + /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, + /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, + /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, + /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, + /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, + /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, + /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, + /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, + /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, + /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, + /* 790 */ 118, 231, 243, 296, 116, 14, }; static PPCODETYPE pp_lookahead[] = { /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -124785,5139 +111135,823 @@ static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ +// 1 "scanner.re" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval* yy162; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ +#define PPCTYPE unsigned char +#define PPCURSOR (s->start) +#define PPLIMIT (s->end) +#define PPMARKER q -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ +static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ + char *q = PPCURSOR; + int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + +// 45 "scanner.c" + { + PPCTYPE ppch; + unsigned int ppaccept = 0; -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + ppch = *PPCURSOR; + switch (ppch) { + case 0x00: goto pp72; + case '\t': + case '\n': + case '\r': + case ' ': goto pp70; + case '!': goto pp53; + case '"': goto pp32; + case '%': goto pp45; + case '&': goto pp64; + case '\'': goto pp33; + case '(': goto pp49; + case ')': goto pp51; + case '*': goto pp41; + case '+': goto pp37; + case ',': goto pp47; + case '-': goto pp39; + case '.': goto pp11; + case '/': goto pp43; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp2; + case ':': goto pp15; + case '<': goto pp55; + case '=': goto pp59; + case '>': goto pp57; + case '?': goto pp13; + case '@': goto pp61; + case 'A': + case 'a': goto pp4; + case 'B': + case 'b': goto pp5; + case 'C': + case 'c': goto pp6; + case 'D': + case 'd': goto pp7; + case 'E': + case 'e': goto pp8; + case 'F': + case 'f': goto pp9; + case 'G': + case 'g': goto pp25; + case 'H': + case 'h': goto pp26; + case 'I': + case 'i': goto pp21; + case 'J': + case 'j': goto pp29; + case 'K': + case 'M': + case 'P': + case 'Q': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'k': + case 'm': + case 'p': + case 'q': + case 'y': + case 'z': goto pp35; + case 'L': + case 'l': goto pp27; + case 'N': + case 'n': goto pp28; + case 'O': + case 'o': goto pp24; + case 'R': + case 'r': goto pp30; + case 'S': + case 's': goto pp20; + case 'T': + case 't': goto pp31; + case 'U': + case 'u': goto pp18; + case 'V': + case 'v': goto pp22; + case 'W': + case 'w': goto pp23; + case '[': goto pp36; + case '\\': goto pp34; + case '^': goto pp68; + case 'x': goto pp10; + case '{': goto pp17; + case '|': goto pp62; + case '~': goto pp66; + default: goto pp74; + } +pp2: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '.': goto pp340; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp342; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'x': goto pp344; + default: goto pp3; + } +pp3: +// 46 "scanner.re" + { + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; + if (token->len > 2 && !memcmp(token->value, "0x", 2)) { + token->opcode = PHQL_T_HINTEGER; + } else { + int i, alpha = 0; + for (i = 0; i < token->len; i++) { + unsigned char ch = token->value[i]; + if (!((ch >= '0') && (ch <= '9'))) { + alpha = 1; + break; + } + } + if (alpha) { + token->opcode = PHQL_T_IDENTIFIER; + } else { + token->opcode = PHQL_T_INTEGER; + } + } + q = PPCURSOR; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy162)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy162; -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; -} - break; - case 5: -{ - yygotominor.yy162 = phql_ret_select_statement(yymsp[-6].minor.yy162, yymsp[-5].minor.yy162, yymsp[-2].minor.yy162, yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 6: -{ - yygotominor.yy162 = phql_ret_select_clause(yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - yygotominor.yy162 = phql_ret_distinct_all(1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - yygotominor.yy162 = phql_ret_distinct_all(0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - yygotominor.yy162 = NULL; -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[0].minor.yy162, NULL); -} - break; - case 12: - case 140: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-1].minor.yy162, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 21: - case 128: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 24: -{ - yygotominor.yy162 = phql_ret_join_item(yymsp[-3].minor.yy162, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 25: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-7].minor.yy162, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - yygotominor.yy162 = phql_ret_update_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 48: -{ - yygotominor.yy162 = phql_ret_update_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - yygotominor.yy162 = phql_ret_update_item(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - yygotominor.yy162 = phql_ret_delete_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 54: -{ - yygotominor.yy162 = phql_ret_delete_clause(yymsp[0].minor.yy162); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-1].minor.yy162, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 58: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-6].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-5].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-3].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[0].minor.yy162, 0); -} - break; - case 75: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - yygotominor.yy162 = phql_ret_for_update_clause(); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MINUS, NULL, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUB, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ADD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MUL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_DIV, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MOD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_XOR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTEQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATER, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATEREQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESSEQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NLIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ILIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NILIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_IN, yymsp[-4].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTIN, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUBQUERY, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EXISTS, NULL, yymsp[-1].minor.yy162); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AGAINST, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CAST, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CONVERT, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CASE, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_WHEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ELSE, yymsp[0].minor.yy162, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - yygotominor.yy162 = phql_ret_func_call(yymsp[-4].minor.yy0, yymsp[-1].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - yygotominor.yy162 = phql_ret_distinct(); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNULL, yymsp[-2].minor.yy162, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNOTNULL, yymsp[-3].minor.yy162, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BETWEEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ENCLOSED, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - +// 201 "scanner.c" +pp4: + ppch = *++PPCURSOR; + switch (ppch) { + case 'G': + case 'g': goto pp323; + case 'L': + case 'l': goto pp324; + case 'N': + case 'n': goto pp325; + case 'S': + case 's': goto pp326; + default: goto pp248; } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +pp5: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp314; + case 'Y': + case 'y': goto pp315; + default: goto pp248; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); +pp6: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp296; + case 'O': + case 'o': goto pp297; + case 'R': + case 'r': goto pp298; + default: goto pp248; + } +pp7: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp279; + case 'I': + case 'i': goto pp280; + default: goto pp248; + } +pp8: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp265; + case 'N': + case 'n': goto pp266; + case 'X': goto pp267; + case 'x': goto pp268; + default: goto pp248; + } +pp9: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp249; + case 'O': + case 'o': goto pp250; + case 'R': + case 'r': goto pp251; + case 'U': + case 'u': goto pp252; + default: goto pp248; + } +pp10: + ppch = *++PPCURSOR; + goto pp248; +pp11: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp244; + default: goto pp12; + } +pp12: +// 432 "scanner.re" + { + token->opcode = PHQL_T_DOT; + return 0; + } +// 292 "scanner.c" +pp13: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp241; + default: goto pp14; + } +pp14: +// 557 "scanner.re" + { + status = PHQL_SCANNER_RETCODE_ERR; + break; + } +// 314 "scanner.c" +pp15: + ppaccept = 0; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp237; + default: goto pp16; + } +pp16: +// 437 "scanner.re" + { + token->opcode = PHQL_T_COLON; + return 0; + } +// 391 "scanner.c" +pp17: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp233; + default: goto pp14; + } +pp18: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case 'P': + case 'p': goto pp222; + case 'S': + case 's': goto pp223; + default: goto pp101; + } +pp19: +// 380 "scanner.re" + { + token->opcode = PHQL_T_IDENTIFIER; + if ((PPCURSOR - q) > 1) { + if (q[0] == '\\') { + token->value = estrndup(q + 1, PPCURSOR - q - 1); + token->len = PPCURSOR - q - 1; } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; - } - - if (!token_found) { - if (token_name) { - efree(token_name); - } + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } + q = PPCURSOR; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval yy204; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ - -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); +// 491 "scanner.c" +pp20: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp214; + default: goto pp101; + } +pp21: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp193; + case 'N': + case 'n': goto pp194; + case 'S': + case 's': goto pp196; + default: goto pp101; + } +pp22: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp187; + default: goto pp101; + } +pp23: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp176; + case 'I': + case 'i': goto pp177; + default: goto pp101; + } +pp24: + ppch = *++PPCURSOR; + switch (ppch) { + case 'F': + case 'f': goto pp157; + case 'N': + case 'n': goto pp158; + case 'R': + case 'r': goto pp160; + case 'U': + case 'u': goto pp162; + default: goto pp101; + } +pp25: + ppch = *++PPCURSOR; + switch (ppch) { + case 'R': + case 'r': goto pp152; + default: goto pp101; + } +pp26: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp146; + default: goto pp101; + } +pp27: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp134; + case 'I': + case 'i': goto pp135; + default: goto pp101; + } +pp28: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp127; + case 'U': + case 'u': goto pp128; + default: goto pp101; + } +pp29: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp123; + default: goto pp101; + } +pp30: + ppch = *++PPCURSOR; + switch (ppch) { + case 'I': + case 'i': goto pp118; + default: goto pp101; + } +pp31: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp110; + case 'R': + case 'r': goto pp111; + default: goto pp101; + } +pp32: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp108; +pp33: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp103; +pp34: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp100; + default: goto pp14; + } +pp35: + ppch = *++PPCURSOR; + goto pp101; +pp36: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '\\': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp95; + default: goto pp14; + } +pp37: + ++PPCURSOR; +// 407 "scanner.re" + { + token->opcode = PHQL_T_ADD; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy204)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy204, 1, 1); -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; -} - break; - case 5: -{ - phql_ret_select_statement(&yygotominor.yy204, &yymsp[-6].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 6: -{ - phql_ret_select_clause(&yygotominor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - phql_ret_distinct_all(&yygotominor.yy204, 1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - phql_ret_distinct_all(&yygotominor.yy204, 0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - ZVAL_UNDEF(&yygotominor.yy204); -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); -} - break; - case 12: - case 140: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-2].minor.yy204, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-1].minor.yy204, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 21: - case 128: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 24: -{ - phql_ret_join_item(&yygotominor.yy204, &yymsp[-3].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 25: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-7].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - phql_ret_update_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 48: -{ - phql_ret_update_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - phql_ret_update_item(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - phql_ret_delete_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 54: -{ - phql_ret_delete_clause(&yygotominor.yy204, &yymsp[0].minor.yy204); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-1].minor.yy204, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 58: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-6].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-5].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-3].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, NULL, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[0].minor.yy204, 0); -} - break; - case 75: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - phql_ret_for_update_clause(&yygotominor.yy204); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MINUS, NULL, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUB, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ADD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MUL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_DIV, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MOD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_XOR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTEQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATER, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATEREQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESSEQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NLIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ILIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NILIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_IN, &yymsp[-4].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTIN, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUBQUERY, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EXISTS, NULL, &yymsp[-1].minor.yy204); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AGAINST, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CAST, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CONVERT, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_CASE, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_WHEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ELSE, &yymsp[0].minor.yy204, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - phql_ret_func_call(&yygotominor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - phql_ret_distinct(&yygotominor.yy204); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNULL, &yymsp[-2].minor.yy204, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNOTNULL, &yymsp[-3].minor.yy204, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BETWEEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ENCLOSED, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - - } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +// 732 "scanner.c" +pp39: + ++PPCURSOR; +// 412 "scanner.re" + { + token->opcode = PHQL_T_SUB; + return 0; + } +// 740 "scanner.c" +pp41: + ++PPCURSOR; +// 417 "scanner.re" + { + token->opcode = PHQL_T_MUL; + return 0; + } +// 748 "scanner.c" +pp43: + ++PPCURSOR; +// 422 "scanner.re" + { + token->opcode = PHQL_T_DIV; + return 0; + } +// 756 "scanner.c" +pp45: + ++PPCURSOR; +// 427 "scanner.re" + { + token->opcode = PHQL_T_MOD; + return 0; + } +// 764 "scanner.c" +pp47: + ++PPCURSOR; +// 442 "scanner.re" + { + token->opcode = PHQL_T_COMMA; + return 0; + } +// 772 "scanner.c" +pp49: + ++PPCURSOR; +// 447 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_OPEN; + return 0; + } +// 780 "scanner.c" +pp51: + ++PPCURSOR; +// 452 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_CLOSE; + return 0; + } +// 788 "scanner.c" +pp53: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '!': goto pp91; + case '=': goto pp93; + default: goto pp54; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); - } - } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; +pp54: +// 522 "scanner.re" + { + token->opcode = PHQL_T_NOT; + return 0; + } +// 802 "scanner.c" +pp55: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp87; + case '>': goto pp89; + default: goto pp56; } - - if (!token_found) { - if (token_name) { - efree(token_name); - } +pp56: +// 477 "scanner.re" + { + token->opcode = PHQL_T_LESS; + return 0; + } +// 816 "scanner.c" +pp57: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp85; + default: goto pp58; } +pp58: +// 482 "scanner.re" + { + token->opcode = PHQL_T_GREATER; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ -// 1 "scanner.re" - - -#ifdef HAVE_CONFIG_H -#endif - - - -#define PPCTYPE unsigned char -#define PPCURSOR (s->start) -#define PPLIMIT (s->end) -#define PPMARKER q - -static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { - - char *q = PPCURSOR; - int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; - - while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { - - -// 45 "scanner.c" - { - PPCTYPE ppch; - unsigned int ppaccept = 0; - - ppch = *PPCURSOR; - switch (ppch) { - case 0x00: goto pp72; - case '\t': - case '\n': - case '\r': - case ' ': goto pp70; - case '!': goto pp53; - case '"': goto pp32; - case '%': goto pp45; - case '&': goto pp64; - case '\'': goto pp33; - case '(': goto pp49; - case ')': goto pp51; - case '*': goto pp41; - case '+': goto pp37; - case ',': goto pp47; - case '-': goto pp39; - case '.': goto pp11; - case '/': goto pp43; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp2; - case ':': goto pp15; - case '<': goto pp55; - case '=': goto pp59; - case '>': goto pp57; - case '?': goto pp13; - case '@': goto pp61; - case 'A': - case 'a': goto pp4; - case 'B': - case 'b': goto pp5; - case 'C': - case 'c': goto pp6; - case 'D': - case 'd': goto pp7; - case 'E': - case 'e': goto pp8; - case 'F': - case 'f': goto pp9; - case 'G': - case 'g': goto pp25; - case 'H': - case 'h': goto pp26; - case 'I': - case 'i': goto pp21; - case 'J': - case 'j': goto pp29; - case 'K': - case 'M': - case 'P': - case 'Q': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'k': - case 'm': - case 'p': - case 'q': - case 'y': - case 'z': goto pp35; - case 'L': - case 'l': goto pp27; - case 'N': - case 'n': goto pp28; - case 'O': - case 'o': goto pp24; - case 'R': - case 'r': goto pp30; - case 'S': - case 's': goto pp20; - case 'T': - case 't': goto pp31; - case 'U': - case 'u': goto pp18; - case 'V': - case 'v': goto pp22; - case 'W': - case 'w': goto pp23; - case '[': goto pp36; - case '\\': goto pp34; - case '^': goto pp68; - case 'x': goto pp10; - case '{': goto pp17; - case '|': goto pp62; - case '~': goto pp66; - default: goto pp74; - } -pp2: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '.': goto pp340; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp342; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'x': goto pp344; - default: goto pp3; - } -pp3: -// 46 "scanner.re" - { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - if (token->len > 2 && !memcmp(token->value, "0x", 2)) { - token->opcode = PHQL_T_HINTEGER; - } else { - int i, alpha = 0; - for (i = 0; i < token->len; i++) { - unsigned char ch = token->value[i]; - if (!((ch >= '0') && (ch <= '9'))) { - alpha = 1; - break; - } - } - if (alpha) { - token->opcode = PHQL_T_IDENTIFIER; - } else { - token->opcode = PHQL_T_INTEGER; - } - } - q = PPCURSOR; - return 0; - } -// 201 "scanner.c" -pp4: - ppch = *++PPCURSOR; - switch (ppch) { - case 'G': - case 'g': goto pp323; - case 'L': - case 'l': goto pp324; - case 'N': - case 'n': goto pp325; - case 'S': - case 's': goto pp326; - default: goto pp248; - } -pp5: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp314; - case 'Y': - case 'y': goto pp315; - default: goto pp248; - } -pp6: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp296; - case 'O': - case 'o': goto pp297; - case 'R': - case 'r': goto pp298; - default: goto pp248; - } -pp7: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp279; - case 'I': - case 'i': goto pp280; - default: goto pp248; - } -pp8: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp265; - case 'N': - case 'n': goto pp266; - case 'X': goto pp267; - case 'x': goto pp268; - default: goto pp248; - } -pp9: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp249; - case 'O': - case 'o': goto pp250; - case 'R': - case 'r': goto pp251; - case 'U': - case 'u': goto pp252; - default: goto pp248; - } -pp10: - ppch = *++PPCURSOR; - goto pp248; -pp11: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp244; - default: goto pp12; - } -pp12: -// 432 "scanner.re" - { - token->opcode = PHQL_T_DOT; - return 0; - } -// 292 "scanner.c" -pp13: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp241; - default: goto pp14; - } -pp14: -// 557 "scanner.re" - { - status = PHQL_SCANNER_RETCODE_ERR; - break; - } -// 314 "scanner.c" -pp15: - ppaccept = 0; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp237; - default: goto pp16; - } -pp16: -// 437 "scanner.re" - { - token->opcode = PHQL_T_COLON; - return 0; - } -// 391 "scanner.c" -pp17: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case ':': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp233; - default: goto pp14; - } -pp18: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case 'P': - case 'p': goto pp222; - case 'S': - case 's': goto pp223; - default: goto pp101; - } -pp19: -// 380 "scanner.re" - { - token->opcode = PHQL_T_IDENTIFIER; - if ((PPCURSOR - q) > 1) { - if (q[0] == '\\') { - token->value = estrndup(q + 1, PPCURSOR - q - 1); - token->len = PPCURSOR - q - 1; - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - q = PPCURSOR; - return 0; - } -// 491 "scanner.c" -pp20: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp214; - default: goto pp101; - } -pp21: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp193; - case 'N': - case 'n': goto pp194; - case 'S': - case 's': goto pp196; - default: goto pp101; - } -pp22: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp187; - default: goto pp101; - } -pp23: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp176; - case 'I': - case 'i': goto pp177; - default: goto pp101; - } -pp24: - ppch = *++PPCURSOR; - switch (ppch) { - case 'F': - case 'f': goto pp157; - case 'N': - case 'n': goto pp158; - case 'R': - case 'r': goto pp160; - case 'U': - case 'u': goto pp162; - default: goto pp101; - } -pp25: - ppch = *++PPCURSOR; - switch (ppch) { - case 'R': - case 'r': goto pp152; - default: goto pp101; - } -pp26: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp146; - default: goto pp101; - } -pp27: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp134; - case 'I': - case 'i': goto pp135; - default: goto pp101; - } -pp28: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp127; - case 'U': - case 'u': goto pp128; - default: goto pp101; - } -pp29: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp123; - default: goto pp101; - } -pp30: - ppch = *++PPCURSOR; - switch (ppch) { - case 'I': - case 'i': goto pp118; - default: goto pp101; - } -pp31: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp110; - case 'R': - case 'r': goto pp111; - default: goto pp101; - } -pp32: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp108; -pp33: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp103; -pp34: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp100; - default: goto pp14; - } -pp35: - ppch = *++PPCURSOR; - goto pp101; -pp36: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '\\': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp95; - default: goto pp14; - } -pp37: - ++PPCURSOR; -// 407 "scanner.re" - { - token->opcode = PHQL_T_ADD; - return 0; - } -// 732 "scanner.c" -pp39: - ++PPCURSOR; -// 412 "scanner.re" - { - token->opcode = PHQL_T_SUB; - return 0; - } -// 740 "scanner.c" -pp41: - ++PPCURSOR; -// 417 "scanner.re" - { - token->opcode = PHQL_T_MUL; - return 0; - } -// 748 "scanner.c" -pp43: - ++PPCURSOR; -// 422 "scanner.re" - { - token->opcode = PHQL_T_DIV; - return 0; - } -// 756 "scanner.c" -pp45: - ++PPCURSOR; -// 427 "scanner.re" - { - token->opcode = PHQL_T_MOD; - return 0; - } -// 764 "scanner.c" -pp47: - ++PPCURSOR; -// 442 "scanner.re" - { - token->opcode = PHQL_T_COMMA; - return 0; - } -// 772 "scanner.c" -pp49: - ++PPCURSOR; -// 447 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_OPEN; - return 0; - } -// 780 "scanner.c" -pp51: - ++PPCURSOR; -// 452 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_CLOSE; - return 0; - } -// 788 "scanner.c" -pp53: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '!': goto pp91; - case '=': goto pp93; - default: goto pp54; - } -pp54: -// 522 "scanner.re" - { - token->opcode = PHQL_T_NOT; - return 0; - } -// 802 "scanner.c" -pp55: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp87; - case '>': goto pp89; - default: goto pp56; - } -pp56: -// 477 "scanner.re" - { - token->opcode = PHQL_T_LESS; - return 0; - } -// 816 "scanner.c" -pp57: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp85; - default: goto pp58; - } -pp58: -// 482 "scanner.re" - { - token->opcode = PHQL_T_GREATER; - return 0; - } -// 829 "scanner.c" -pp59: - ++PPCURSOR; -// 487 "scanner.re" - { - token->opcode = PHQL_T_EQUALS; - return 0; - } -// 837 "scanner.c" -pp61: - ppch = *++PPCURSOR; +// 829 "scanner.c" +pp59: + ++PPCURSOR; +// 487 "scanner.re" + { + token->opcode = PHQL_T_EQUALS; + return 0; + } +// 837 "scanner.c" +pp61: + ppch = *++PPCURSOR; switch (ppch) { case '>': goto pp81; case '@': goto pp83; @@ -135362,21643 +117396,9483 @@ static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { case 'x': goto pp344; default: goto pp3; } - } -// 562 "scanner.re" - - } - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { - - zval *success_param = NULL, *model = NULL; - zend_bool success; - - zephir_fetch_params(0, 1, 1, &success_param, &model); - - success = zephir_get_boolval(success_param); - if (!model) { - model = ZEPHIR_GLOBAL(global_null); - } - - - if (success) { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { - - - - RETURN_MEMBER(this_ptr, "_model"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { - - zval *model = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(model); - zephir_read_property_this(&model, this_ptr, SL("_model"), PH_NOISY_CC); - if (Z_TYPE_P(model) != IS_OBJECT) { - array_init(return_value); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(model, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { - - - - RETURN_MEMBER(this_ptr, "_success"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnTypes, *result = NULL, *cache = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); - - if (!result) { - result = ZEPHIR_GLOBAL(global_null); - } - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { - - zend_class_entry *_13$$15; - HashTable *_3, *_6$$11; - HashPosition _2, _5$$11; - zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; - zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; - int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); - RETURN_CCTOR(row); - } - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_INIT_NVAR(activeRow); - object_init_ex(activeRow, phalcon_mvc_model_row_ce); - if (zephir_has_constructor(activeRow TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); - zephir_check_call_status(); - } - break; - } - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - ZEPHIR_INIT_NVAR(activeRow); - array_init(activeRow); - break; - } - ZEPHIR_INIT_NVAR(activeRow); - object_init(activeRow); - break; - } while(0); - - dirtyState = 0; - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); - zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HMKEY(alias, _3, _2); - ZEPHIR_GET_HVALUE(column, _4); - if (Z_TYPE_P(column) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); - return; - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); - if (ZEPHIR_IS_STRING(type, "object")) { - ZEPHIR_OBS_NVAR(source); - zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); - ZEPHIR_OBS_NVAR(attributes); - zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); - ZEPHIR_OBS_NVAR(columnMap); - zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); - ZEPHIR_INIT_NVAR(rowModel); - array_init(rowModel); - zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); - for ( - ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) - ) { - ZEPHIR_GET_HVALUE(attribute, _7$$11); - ZEPHIR_OBS_NVAR(columnValue); - ZEPHIR_INIT_LNVAR(_8$$12); - ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); - zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); - zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); - } - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_OBS_NVAR(keepSnapshots); - if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(keepSnapshots); - ZVAL_BOOL(keepSnapshots, 0); - } - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_NVAR(_9$$15); - zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); - if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { - zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); - ZEPHIR_INIT_NVAR(modelName); - zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_12$$15); - ZVAL_LONG(_12$$15, dirtyState); - _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); - zephir_check_call_status(); - } else { - zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_16$$18); - ZVAL_LONG(_16$$18, dirtyState); - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - ZEPHIR_OBS_NVAR(attribute); - zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(sqlAlias); - if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { - ZEPHIR_OBS_NVAR(value); - zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(value); - zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); - } - if (zephir_array_isset_string(column, SS("balias"))) { - ZEPHIR_CPY_WRT(attribute, alias); - } else { - ZEPHIR_SINIT_NVAR(_18$$24); - ZVAL_STRING(&_18$$24, "_", 0); - ZEPHIR_SINIT_NVAR(_19$$24); - ZVAL_STRING(&_19$$24, "", 0); - ZEPHIR_INIT_NVAR(attribute); - zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); - } - } - if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { - do { - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); - break; - } - zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); - break; - } while(0); - - } - } - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { - - zval *records = NULL, *current = NULL, *_0 = NULL; - zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(records); - array_init(records); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0))) { - break; - } - ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 373); - zephir_check_call_status(); - zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); - zephir_check_call_status(); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { - - zval *_0; - zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(cache); - zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnTypes); - zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 4, 0 TSRMLS_CC); - zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_CCTOR(serialized); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - if (1) { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_2); - ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); - zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); - - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - if (!keepSnapshots) { - keepSnapshots = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { - - zend_class_entry *_5$$6; - zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; - zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_VAR(_0$$6); - zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); - if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { - _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(modelName); - zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_4$$6); - ZVAL_LONG(_4$$6, 0); - _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); - zephir_check_call_status(); - } else { - _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_9$$9); - ZVAL_LONG(_9$$9, 0); - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 374, _7$$9, row, columnMap, _9$$9, _8$$9); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 375, row, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { - - HashTable *_2$$7, *_5$$8; - HashPosition _1$$7, _4$$8; - zephir_fcall_cache_entry *_9 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; - zend_bool renameColumns; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &renameColumns_param); - - if (!renameColumns_param) { - renameColumns = 1; - } else { - renameColumns = zephir_get_boolval(renameColumns_param); - } - - - ZEPHIR_OBS_VAR(records); - zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); - if (Z_TYPE_P(records) != IS_ARRAY) { - ZEPHIR_OBS_VAR(result); - zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(_0$$3) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); - } - if (renameColumns) { - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - if (Z_TYPE_P(columnMap) != IS_ARRAY) { - RETURN_CCTOR(records); - } - ZEPHIR_INIT_VAR(renamedRecords); - array_init(renamedRecords); - if (Z_TYPE_P(records) == IS_ARRAY) { - zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); - for ( - ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) - ) { - ZEPHIR_GET_HVALUE(record, _3$$7); - ZEPHIR_INIT_NVAR(renamed); - array_init(renamed); - zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); - for ( - ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS - ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) - ) { - ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); - ZEPHIR_GET_HVALUE(value, _6$$8); - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(renamedKey) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_10$$12); - object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_11$$12); - ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); - } - zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); - } - } - RETURN_CCTOR(renamedRecords); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { - - zval *_1 = NULL, *_2 = NULL, *_3; - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 6, 0 TSRMLS_CC); - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(_3); - ZVAL_BOOL(_3, 0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); - zephir_check_call_status(); - zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); - zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_3); - ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); - zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); - zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, *record = NULL; - zval *message = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &record); - - if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(message_param) == IS_STRING)) { - zephir_get_strval(message, message_param); - } else { - ZEPHIR_INIT_VAR(message); - ZVAL_EMPTY_STRING(message); - } - if (!record) { - record = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { - - zval *record = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(record); - zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); - if (Z_TYPE_P(record) != IS_NULL) { - ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { - - - - RETURN_MEMBER(this_ptr, "_record"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *dependencyInjector = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &dependencyInjector); - - if (!dependencyInjector) { - ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(dependencyInjector); - } - - - if (!(zephir_is_true(dependencyInjector))) { - ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); - return; - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { - - zval *service_param = NULL; - zval *service = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &service_param); - - if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(service_param) == IS_STRING)) { - zephir_get_strval(service, service_param); - } else { - ZEPHIR_INIT_VAR(service); - ZVAL_EMPTY_STRING(service); - } - - - zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { - - - - RETURN_MEMBER(this_ptr, "_service"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { - - zval *rollbackPendent_param = NULL; - zend_bool rollbackPendent; - - zephir_fetch_params(0, 1, 0, &rollbackPendent_param); - - rollbackPendent = zephir_get_boolval(rollbackPendent_param); - - - if (rollbackPendent) { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { - - - - RETURN_MEMBER(this_ptr, "_rollbackPendent"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { - - zval *_0; - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { - - zval *_2$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); - if (zephir_is_true(_1$$3)) { - ZEPHIR_INIT_VAR(_2$$4); - zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$4, this_ptr); - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "rollbackPendent", 1); - zephir_array_fast_append(_2$$4, _3$$4); - ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 378, _2$$4); - zephir_check_call_status(); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(_4); - if (autoBegin) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { - - HashTable *_2$$5; - HashPosition _1$$5; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(transaction, _3$$5); - if (Z_TYPE_P(transaction) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_BOOL(_4$$7, 0); - ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); - zephir_check_call_status(); - RETURN_CCTOR(transaction); - } - } - } - } - ZEPHIR_INIT_NVAR(transaction); - object_init_ex(transaction, phalcon_mvc_model_transaction_ce); - _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_6); - if (autoBegin) { - ZVAL_BOOL(_6, 1); - } else { - ZVAL_BOOL(_6, 0); - } - ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 379, dependencyInjector, _6, _5); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 380, this_ptr); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); - RETURN_CCTOR(transaction); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { - - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { - - HashTable *_1$$3; - HashPosition _0$$3; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &collect); - - if (!collect) { - collect = ZEPHIR_GLOBAL(global_true); - } - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); - zephir_check_call_status(); - } - if (zephir_is_true(collect)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(newTransactions); - array_init(newTransactions); - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); - if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { - zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); - } else { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - } - zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { - - HashTable *_2$$3; - HashPosition _1$$3; - zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_0$$3); - zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); - for ( - ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) - ) { - ZEPHIR_GET_HVALUE(_0$$3, _3$$3); - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 274); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { - - zval *_5$$7; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if (zephir_fast_in_array(value, domain TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_4$$7); - ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_4$$7); - zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { - - zval *_8$$9; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(strict); - ZVAL_BOOL(strict, 0); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_4)) { - if (Z_TYPE_P(strict) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); - return; - } - ZEPHIR_INIT_VAR(_5$$7); - ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); - zephir_check_temp_parameter(_5$$7); - zephir_check_call_status(); - } - ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 381, value, domain, strict); - zephir_check_call_status(); - if (!(zephir_is_true(_6))) { - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_8$$9); - zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_7$$9); - zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_7$$9); - ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { - - zval *_6, *_12$$5; - zend_bool _5; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_1); - ZVAL_LONG(_1, (1048576 | 2097152)); - ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_2)) { - ZEPHIR_INIT_VAR(allowPrivate); - ZVAL_LONG(allowPrivate, 0); - } else { - ZEPHIR_INIT_NVAR(allowPrivate); - ZVAL_LONG(allowPrivate, 8388608); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_3)) { - ZEPHIR_INIT_VAR(allowReserved); - ZVAL_LONG(allowReserved, 0); - } else { - ZEPHIR_INIT_NVAR(allowReserved); - ZVAL_LONG(allowReserved, 4194304); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_NVAR(_1); - ZVAL_BOOL(_1, 0); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _5 = zephir_is_true(_4); - if (_5) { - _5 = ZEPHIR_IS_EMPTY(value); - } - if (_5) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(options); - zephir_create_array(options, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_6); - zephir_create_array(_6, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_VAR(_7); - zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); - ZEPHIR_INIT_VAR(_8); - zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); - zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 275); - ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); - zephir_check_call_status(); - if (!(zephir_is_true(_9))) { - ZEPHIR_INIT_VAR(_10$$5); - ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_11$$5); - ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_temp_parameter(_11$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_12$$5); - zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$5); - ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { - - zval *_4$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - if (!(zephir_is_numeric(value))) { - ZEPHIR_INIT_VAR(_3$$5); - ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field :field must be numeric", 1); - } - ZEPHIR_INIT_VAR(_4$$5); - zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$5); - ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { - - zval *_4$$4; - zend_bool _1, _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - _1 = Z_TYPE_P(value) == IS_NULL; - if (!(_1)) { - _2 = Z_TYPE_P(value) == IS_STRING; - if (_2) { - _2 = !(zephir_fast_strlen_ev(value)); - } - _1 = _2; - } - if (_1) { - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "':field' is required", 1); - } - ZEPHIR_INIT_VAR(_4$$4); - zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$4); - ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { - - zval *_6$$8; - zend_bool failed = 0, _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (!(zephir_is_true(_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - failed = 0; - ZEPHIR_INIT_VAR(matches); - ZVAL_NULL(matches); - ZEPHIR_INIT_NVAR(_0); - zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); - if (zephir_is_true(_0)) { - zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); - failed = !ZEPHIR_IS_EQUAL(_4$$6, value); - } else { - failed = 1; - } - if (failed == 1) { - ZEPHIR_INIT_VAR(_5$$8); - ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); - } - ZEPHIR_INIT_VAR(_6$$8); - zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$8); - ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { - - zval *_6$$9, *_11$$12; - zend_bool _1, _3; - zephir_fcall_cache_entry *_8 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _1 = !zephir_is_true(isSetMin); - if (_1) { - _1 = !zephir_is_true(isSetMax); - } - if (_1) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 382, value); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(length); - ZVAL_LONG(length, zephir_fast_strlen_ev(value)); - } - if (zephir_is_true(isSetMax)) { - ZEPHIR_INIT_VAR(_4$$8); - ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); - zephir_check_temp_parameter(_4$$8); - zephir_check_call_status(); - if (ZEPHIR_GT(length, maximum)) { - ZEPHIR_INIT_VAR(_5$$9); - ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); - } - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$9); - ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - if (zephir_is_true(isSetMin)) { - ZEPHIR_INIT_VAR(_9$$11); - ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); - zephir_check_temp_parameter(_9$$11); - zephir_check_call_status(); - if (ZEPHIR_LT(length, minimum)) { - ZEPHIR_INIT_VAR(_10$$12); - ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); - } - ZEPHIR_INIT_VAR(_11$$12); - zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$12); - ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { - - HashTable *_2$$5, *_22$$16; - HashPosition _1$$5, _21$$16; - zend_class_entry *_33; - zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; - int ZEPHIR_LAST_CALL_STATUS, number = 0; - zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(bindTypes); - array_init(bindTypes); - ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); - zephir_check_call_status(); - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_INIT_VAR(conditions); - array_init(conditions); - ZEPHIR_INIT_VAR(bindParams); - array_init(bindParams); - number = 0; - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(composeField, _3$$5); - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_4$$8); - object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_5$$8); - ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, composeField); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_SINIT_NVAR(_9$$6); - ZVAL_LONG(&_9$$6, number); - ZEPHIR_INIT_LNVAR(_10$$6); - ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); - zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); - ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); - number++; - } - } else { - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_13$$13); - object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_14$$13); - ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, field); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_15$$15); - object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_16$$15); - ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(_17$$11); - ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); - zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); - ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); - number++; - } - ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_19, 2)) { - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); - zephir_check_call_status(); - zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) - ) { - ZEPHIR_GET_HVALUE(primaryField, _23$$16); - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_24$$20); - object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_25$$20); - ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); - zephir_check_call_status(); - zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(attributeField); - if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_26$$22); - object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_27$$22); - ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); - zephir_check_call_status(); - zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(attributeField, primaryField); - } - ZEPHIR_SINIT_NVAR(_28$$19); - ZVAL_LONG(&_28$$19, number); - ZEPHIR_INIT_LNVAR(_29$$19); - ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); - zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); - ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); - number++; - } - } - ZEPHIR_INIT_VAR(params); - array_init(params); - zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_0); - zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); - zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(className); - zephir_get_class(className, record, 0 TSRMLS_CC); - _33 = zephir_fetch_class(className TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); - zephir_check_call_status(); - if (!ZEPHIR_IS_LONG(_32, 0)) { - ZEPHIR_INIT_VAR(_34$$24); - ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(replacePairs); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_35$$25); - zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); - } - } else { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); - } - } - ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_34$$24); - ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 273); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, ":field does not have a valid url format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { - - zval *_0; - zval *handler_param = NULL, *prefix_param = NULL; - zval *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { - - zval *_0; - zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; - zval *module = NULL, *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_array_fast_append(_0, module); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { - - zend_bool _5$$6; - HashTable *_3, *_9$$14, *_13$$16, *_17$$18; - HashPosition _2, _8$$14, _12$$16, _16$$18; - zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; - zval *uri = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &uri_param); - - if (!uri_param) { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } else { - if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { - zephir_get_strval(uri, uri_param); - } else { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } - } - - - if (!(!(!uri) && Z_STRLEN_P(uri))) { - ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(realUri, uri); - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); - return; - } - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(handlers); - zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(controllerSuffix); - zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); - zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HVALUE(scope, _4); - if (Z_TYPE_P(scope) != IS_ARRAY) { - continue; - } - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); - _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); - if (_5$$6) { - _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); - } - if (_5$$6) { - continue; - } - ZEPHIR_OBS_NVAR(handler); - zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); - if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { - ZEPHIR_INIT_NVAR(controllerName); - zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(namespaceName); - zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(controllerName, handler); - ZEPHIR_OBS_NVAR(namespaceName); - zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); - } - zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(sufixed); - ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); - if (Z_TYPE_P(namespaceName) != IS_NULL) { - ZEPHIR_INIT_LNVAR(_6$$11); - ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); - ZEPHIR_CPY_WRT(sufixed, _6$$11); - } - ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); - zephir_check_call_status(); - if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { - continue; - } - ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(annotations) == IS_ARRAY) { - zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); - for ( - ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) - ) { - ZEPHIR_GET_HVALUE(annotation, _10$$14); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); - zephir_check_call_status(); - } - } - } - ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(lowerControllerName); - zephir_uncamelize(lowerControllerName, controllerName, NULL ); - zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); - for ( - ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) - ) { - ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); - ZEPHIR_GET_HVALUE(collection, _14$$16); - if (Z_TYPE_P(collection) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS - ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) - ) { - ZEPHIR_GET_HVALUE(annotation, _18$$18); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); - zephir_check_call_status(); - } - } - } - } - } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 383, realUri); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; - zval *handler = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &handler_param, &annotation); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - - - ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { - ZEPHIR_INIT_VAR(_2$$3); - ZVAL_LONG(_2$$3, 0); - ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { - - HashTable *_7$$22, *_11$$24; - HashPosition _6$$22, _10$$24; - zend_bool isRoute = 0, _14$$9, _5$$20; - zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; - zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { - zephir_get_strval(namespaceName, namespaceName_param); - } else { - ZEPHIR_INIT_VAR(namespaceName); - ZVAL_EMPTY_STRING(namespaceName); - } - if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { - zephir_get_strval(controller, controller_param); - } else { - ZEPHIR_INIT_VAR(controller); - ZVAL_EMPTY_STRING(controller); - } - if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(action_param) == IS_STRING)) { - zephir_get_strval(action, action_param); - } else { - ZEPHIR_INIT_VAR(action); - ZVAL_EMPTY_STRING(action); - } - - - isRoute = 0; - ZEPHIR_INIT_VAR(methods); - ZVAL_NULL(methods); - ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); - zephir_check_call_status(); - do { - if (ZEPHIR_IS_STRING(name, "Route")) { - isRoute = 1; - break; - } - if (ZEPHIR_IS_STRING(name, "Get")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "GET", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Post")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "POST", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Put")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "PUT", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Delete")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "DELETE", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Options")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "OPTIONS", 1); - break; - } - } while(0); - - if (isRoute == 1) { - ZEPHIR_INIT_VAR(_0$$9); - _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_2$$9); - ZVAL_STRING(&_2$$9, "", 0); - zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); - ZEPHIR_INIT_VAR(actionName); - zephir_fast_strtolower(actionName, _0$$9); - ZEPHIR_OBS_VAR(routePrefix); - zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_3$$9); - ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(paths) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(paths); - array_init(paths); - } - if (!(ZEPHIR_IS_EMPTY(module))) { - zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); - } - if (!(ZEPHIR_IS_EMPTY(namespaceName))) { - zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_LONG(_3$$9, 0); - ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(value) != IS_NULL) { - if (!ZEPHIR_IS_STRING(value, "/")) { - ZEPHIR_INIT_VAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, value); - } else { - if (Z_TYPE_P(routePrefix) != IS_NULL) { - ZEPHIR_CPY_WRT(uri, routePrefix); - } else { - ZEPHIR_CPY_WRT(uri, value); - } - } - } else { - ZEPHIR_INIT_NVAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); - } - ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); - zephir_check_call_status(); - if (Z_TYPE_P(methods) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(_4$$20); - ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); - zephir_check_temp_parameter(_4$$20); - zephir_check_call_status(); - _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; - if (!(_5$$20)) { - _5$$20 = Z_TYPE_P(methods) == IS_STRING; - } - if (_5$$20) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); - for ( - ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS - ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) - ) { - ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); - ZEPHIR_GET_HVALUE(convert, _8$$22); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); - for ( - ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS - ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) - ) { - ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); - ZEPHIR_GET_HVALUE(convert, _12$$24); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; - if (!(_14$$9)) { - _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; - } - if (_14$$9) { - ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(routeName) == IS_STRING) { - ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); - zephir_check_call_status(); - } - RETURN_MM_BOOL(1); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { - - zval *controllerSuffix_param = NULL; - zval *controllerSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &controllerSuffix_param); - - if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { - zephir_get_strval(controllerSuffix, controllerSuffix_param); - } else { - ZEPHIR_INIT_VAR(controllerSuffix); - ZVAL_EMPTY_STRING(controllerSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { - - zval *actionSuffix_param = NULL; - zval *actionSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &actionSuffix_param); - - if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { - zephir_get_strval(actionSuffix, actionSuffix_param); - } else { - ZEPHIR_INIT_VAR(actionSuffix); - ZVAL_EMPTY_STRING(actionSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { - - - - RETURN_MEMBER(this_ptr, "_handlers"); - -} - -zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { - - zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; - - ZEPHIR_MM_GROW(); - - { - zval *this_ptr = NULL; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); - if (Z_TYPE_P(_0) == IS_NULL) { - ZEPHIR_INIT_VAR(_1$$3); - array_init(_1$$3); - zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); - } - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); - if (Z_TYPE_P(_2) == IS_NULL) { - ZEPHIR_INIT_VAR(_3$$4); - array_init(_3$$4); - zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); - } - _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); - if (Z_TYPE_P(_4) == IS_NULL) { - ZEPHIR_INIT_VAR(_5$$5); - array_init(_5$$5); - zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJVAL_P(this_ptr); - } - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *paths = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - _0 = Z_TYPE_P(paths) == IS_ARRAY; - if (!(_0)) { - _0 = Z_TYPE_P(paths) == IS_STRING; - } - if (_0) { - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - } - if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - zephir_get_strval(hostname, hostname_param); - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - zephir_get_strval(prefix, prefix_param); - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { - - - - RETURN_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { - - zval *beforeMatch; - - zephir_fetch_params(0, 1, 0, &beforeMatch); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { - - zval *paths; - - zephir_fetch_params(0, 1, 0, &paths); - - - - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { - - - - RETURN_MEMBER(this_ptr, "_routes"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - - zval *_0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - array_init(_0); - zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(defaultPaths); - zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); - if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(processedPaths, paths); - } - if (Z_TYPE_P(processedPaths) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedPaths); - zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); - } - } else { - ZEPHIR_CPY_WRT(mergedPaths, paths); - } - ZEPHIR_INIT_VAR(route); - object_init_ex(route, phalcon_mvc_router_route_ce); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_2); - ZEPHIR_CONCAT_VV(_2, _1, pattern); - ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 384, this_ptr); - zephir_check_call_status(); - RETURN_CCTOR(route); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - ZEPHIR_OBS_VAR(uniqueId); - zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); - if (Z_TYPE_P(uniqueId) == IS_NULL) { - ZEPHIR_INIT_NVAR(uniqueId); - ZVAL_LONG(uniqueId, 0); - } - ZEPHIR_CPY_WRT(routeId, uniqueId); - zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { - - zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { - ZEPHIR_INIT_VAR(idPattern); - ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); - if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { - ZEPHIR_INIT_VAR(_0$$4); - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_STRING(&_1$$4, "/:module", 0); - zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _0$$4); - } - if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { - ZEPHIR_INIT_VAR(_2$$5); - ZEPHIR_SINIT_VAR(_3$$5); - ZVAL_STRING(&_3$$5, "/:controller", 0); - zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _2$$5); - } - if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_SINIT_VAR(_5$$6); - ZVAL_STRING(&_5$$6, "/:namespace", 0); - zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _4$$6); - } - if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_SINIT_VAR(_7$$7); - ZVAL_STRING(&_7$$7, "/:action", 0); - zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _6$$7); - } - if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { - ZEPHIR_INIT_VAR(_8$$8); - ZEPHIR_SINIT_VAR(_9$$8); - ZVAL_STRING(&_9$$8, "/:params", 0); - ZEPHIR_SINIT_VAR(_10$$8); - ZVAL_STRING(&_10$$8, "(/.*)*", 0); - zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); - zephir_get_strval(pattern, _8$$8); - } - if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_SINIT_VAR(_12$$9); - ZVAL_STRING(&_12$$9, "/:int", 0); - ZEPHIR_SINIT_VAR(_13$$9); - ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); - zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); - zephir_get_strval(pattern, _11$$9); - } - } - if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - RETURN_CTOR(pattern); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { - - long _0, _5$$11, _26$$19; - zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; - int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; - char ch = 0, prevCh; - zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; - zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - prevCh = '\0'; - bracketCount = 0; - parenthesesCount = 0; - foundPattern = 0; - intermediate = 0; - numberMatches = 0; - if (zephir_fast_strlen_ev(pattern) <= 0) { - RETURN_MM_BOOL(0); - } - ZEPHIR_INIT_VAR(matches); - array_init(matches); - ZEPHIR_INIT_VAR(route); - ZVAL_EMPTY_STRING(route); - for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { - cursor = _0; - ch = ZEPHIR_STRING_OFFSET(pattern, _0); - if (parenthesesCount == 0) { - if (ch == '{') { - if (bracketCount == 0) { - marker = (cursor + 1); - intermediate = 0; - notValid = 0; - } - bracketCount++; - } else { - if (ch == '}') { - bracketCount--; - if (intermediate > 0) { - if (bracketCount == 0) { - numberMatches++; - ZEPHIR_INIT_NVAR(variable); - ZVAL_EMPTY_STRING(variable); - ZEPHIR_INIT_NVAR(regexp); - ZVAL_EMPTY_STRING(regexp); - ZEPHIR_SINIT_NVAR(_1$$11); - ZVAL_LONG(&_1$$11, marker); - ZEPHIR_SINIT_NVAR(_2$$11); - ZVAL_LONG(&_2$$11, (cursor - marker)); - ZEPHIR_INIT_NVAR(_3$$11); - zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); - zephir_get_strval(_4$$11, _3$$11); - ZEPHIR_CPY_WRT(item, _4$$11); - for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { - cursorVar = _5$$11; - ch = ZEPHIR_STRING_OFFSET(item, _5$$11); - if (ch == '\0') { - break; - } - _6$$12 = cursorVar == 0; - if (_6$$12) { - _7$$12 = ch >= 'a'; - if (_7$$12) { - _7$$12 = ch <= 'z'; - } - _8$$12 = _7$$12; - if (!(_8$$12)) { - _9$$12 = ch >= 'A'; - if (_9$$12) { - _9$$12 = ch <= 'Z'; - } - _8$$12 = _9$$12; - } - _6$$12 = !(_8$$12); - } - if (_6$$12) { - notValid = 1; - break; - } - _10$$12 = ch >= 'a'; - if (_10$$12) { - _10$$12 = ch <= 'z'; - } - _11$$12 = _10$$12; - if (!(_11$$12)) { - _12$$12 = ch >= 'A'; - if (_12$$12) { - _12$$12 = ch <= 'Z'; - } - _11$$12 = _12$$12; - } - _13$$12 = _11$$12; - if (!(_13$$12)) { - _14$$12 = ch >= '0'; - if (_14$$12) { - _14$$12 = ch <= '9'; - } - _13$$12 = _14$$12; - } - _15$$12 = _13$$12; - if (!(_15$$12)) { - _15$$12 = ch == '-'; - } - _16$$12 = _15$$12; - if (!(_16$$12)) { - _16$$12 = ch == '_'; - } - _17$$12 = _16$$12; - if (!(_17$$12)) { - _17$$12 = ch == ':'; - } - if (_17$$12) { - if (ch == ':') { - ZEPHIR_SINIT_NVAR(_18$$16); - ZVAL_LONG(&_18$$16, 0); - ZEPHIR_SINIT_NVAR(_19$$16); - ZVAL_LONG(&_19$$16, cursorVar); - ZEPHIR_INIT_NVAR(_20$$16); - zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); - zephir_get_strval(_21$$16, _20$$16); - ZEPHIR_CPY_WRT(variable, _21$$16); - ZEPHIR_SINIT_NVAR(_22$$16); - ZVAL_LONG(&_22$$16, (cursorVar + 1)); - ZEPHIR_INIT_NVAR(_23$$16); - zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_get_strval(_24$$16, _23$$16); - ZEPHIR_CPY_WRT(regexp, _24$$16); - break; - } - } else { - notValid = 1; - break; - } - } - if (!(notValid)) { - tmp = numberMatches; - _25$$18 = zephir_is_true(variable); - if (_25$$18) { - _25$$18 = zephir_is_true(regexp); - } - if (_25$$18) { - foundPattern = 0; - for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { - ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); - if (ch == '\0') { - break; - } - if (!(foundPattern)) { - if (ch == '(') { - foundPattern = 1; - } - } else { - if (ch == ')') { - foundPattern = 2; - break; - } - } - } - if (foundPattern != 2) { - ZEPHIR_INIT_LNVAR(_27$$26); - ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); - zephir_concat_self(&route, _27$$26 TSRMLS_CC); - } else { - zephir_concat_self(&route, regexp TSRMLS_CC); - } - ZEPHIR_INIT_NVAR(_28$$19); - ZVAL_LONG(_28$$19, tmp); - zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_29$$28); - ZVAL_LONG(_29$$28, tmp); - zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_LNVAR(_30$$29); - ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); - zephir_concat_self(&route, _30$$29 TSRMLS_CC); - } - continue; - } - } - } - } - } - if (bracketCount == 0) { - if (ch == '(') { - parenthesesCount++; - } else { - if (ch == ')') { - parenthesesCount--; - if (parenthesesCount == 0) { - numberMatches++; - } - } - } - } - if (bracketCount > 0) { - intermediate++; - } else { - _31$$36 = parenthesesCount == 0; - if (_31$$36) { - _31$$36 = prevCh != '\\'; - } - if (_31$$36) { - _32$$37 = ch == '.'; - if (!(_32$$37)) { - _32$$37 = ch == '+'; - } - _33$$37 = _32$$37; - if (!(_33$$37)) { - _33$$37 = ch == '|'; - } - _34$$37 = _33$$37; - if (!(_34$$37)) { - _34$$37 = ch == '#'; - } - if (_34$$37) { - zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); - } - } - zephir_concat_self_char(&route, ch TSRMLS_CC); - prevCh = ch; - } - } - zephir_create_array(return_value, 2, 0 TSRMLS_CC); - zephir_array_fast_append(return_value, route); - zephir_array_fast_append(return_value, matches); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); - zephir_check_call_status(); - if (!(zephir_start_with_str(pattern, SL("#")))) { - if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { - ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(pcrePattern); - zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_VAR(_0$$4); - zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); - zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); - ZEPHIR_CPY_WRT(routePaths, _0$$4); - } else { - ZEPHIR_CPY_WRT(pcrePattern, pattern); - } - ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(compiledPattern, pattern); - } - zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { - - int _0$$4; - zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(paths) != IS_NULL) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_INIT_VAR(moduleName); - ZVAL_NULL(moduleName); - ZEPHIR_INIT_VAR(controllerName); - ZVAL_NULL(controllerName); - ZEPHIR_INIT_VAR(actionName); - ZVAL_NULL(actionName); - ZEPHIR_INIT_VAR(parts); - zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); - do { - _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); - if (_0$$4 == 3) { - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); - break; - } - if (_0$$4 == 2) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); - break; - } - if (_0$$4 == 1) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); - break; - } - } while(0); - - ZEPHIR_INIT_VAR(routePaths); - array_init(routePaths); - if (Z_TYPE_P(moduleName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(controllerName) != IS_NULL) { - if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { - ZEPHIR_INIT_VAR(realClassName); - zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(namespaceName); - zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); - if (zephir_is_true(namespaceName)) { - zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(realClassName, controllerName); - } - ZEPHIR_INIT_VAR(_1$$9); - zephir_uncamelize(_1$$9, realClassName, NULL ); - zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(actionName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(routePaths, paths); - } - } else { - ZEPHIR_INIT_NVAR(routePaths); - array_init(routePaths); - } - if (Z_TYPE_P(routePaths) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); - return; - } - RETURN_CCTOR(routePaths); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { - - - - RETURN_MEMBER(this_ptr, "_name"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { - - zval *name_param = NULL; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - zephir_get_strval(name, name_param); - - - zephir_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { - - - - RETURN_MEMBER(this_ptr, "_match"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { - - - - RETURN_MEMBER(this_ptr, "_id"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { - - - - RETURN_MEMBER(this_ptr, "_pattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { - - - - RETURN_MEMBER(this_ptr, "_compiledPattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { - - HashTable *_2; - HashPosition _1; - zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(reversed); - array_init(reversed); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); - zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HMKEY(path, _2, _1); - ZEPHIR_GET_HVALUE(position, _3); - zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); - } - RETURN_CCTOR(reversed); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { - - - - RETURN_MEMBER(this_ptr, "_methods"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { - zephir_get_strval(hostname, hostname_param); - } else { - ZEPHIR_INIT_VAR(hostname); - ZVAL_EMPTY_STRING(hostname); - } - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { - - zval *group; - - zephir_fetch_params(0, 1, 0, &group); - - - - zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { - - - - RETURN_MEMBER(this_ptr, "_group"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { - - zval *name_param = NULL, *converter; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &converter); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { - - - - RETURN_MEMBER(this_ptr, "_converters"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { - - - - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - - -#ifdef HAVE_CONFIG_H -#endif - - - -#if PHP_VERSION_ID < 70000 -#else -#endif - - -static void phalcon_get_uri(zval *return_value, zval *path) -{ - int i, found = 0, mark = 0; - char *cursor, *str, ch; - - if (Z_TYPE_P(path) != IS_STRING) { - RETURN_EMPTY_STRING(); - } - - if (Z_STRLEN_P(path) > 0) { - cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; - for (i = Z_STRLEN_P(path); i > 0; i--) { - ch = *cursor; - if (ch == '/' || ch == '\\') { - found++; - if (found == 1) { - mark = i - 1; - } else { - str = emalloc(mark - i + 1); - memcpy(str, Z_STRVAL_P(path) + i, mark - i); - str[mark - i] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, str, mark - i, 0); -#else - ZVAL_STRINGL(return_value, str, mark - i); -#endif - return; - } - } - cursor--; - } - } - - RETURN_EMPTY_STRING(); -} - -zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) -{ - unsigned int length = 0, variable_length, ch, j; - char *item = NULL, *cursor_var, *variable = NULL; - int not_valid = 0; -#if PHP_VERSION_ID < 70000 - int result = FAILURE; - zval **zv, **tmp; -#else - zval *zv, *tmp; -#endif - - if (named) { - length = cursor - marker - 1; - item = estrndup(marker + 1, length); - cursor_var = item; - marker = item; - for (j = 0; j < length; j++) { - ch = *cursor_var; - if (ch == '\0') { - not_valid = 1; - break; - } - if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ - not_valid = 1; - break; - } - if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { - if (ch == ':') { - variable_length = cursor_var - marker; - variable = estrndup(marker, variable_length); - break; - } - } else { - not_valid = 1; - break; - } - cursor_var++; - } - } - - if (!not_valid) { - - if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { - if (named) { - if (variable) { - efree(item); - item = variable; - length = variable_length; - } -#if PHP_VERSION_ID < 70000 - if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { - efree(item); - (*position)++; - return *zv; - } - } -#else - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { - if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { - efree(item); - (*position)++; - return zv; - } - } -#endif - } else { -#if PHP_VERSION_ID < 70000 - if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { - if (Z_TYPE_PP(zv) == IS_STRING) { - if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { - (*position)++; - return *tmp; - } - } - } - } -#else - if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { - if (Z_TYPE_P(zv) == IS_STRING) { - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { - if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { - (*position)++; - return tmp; - } - } - } - } -#endif - } - } - - (*position)++; - } - - if (item) { - efree(item); - } - - return NULL; -} - -static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) -{ - - char *cursor, *marker = NULL; - unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; - unsigned char ch; - smart_str route_str = {0}; - ulong position = 1; - int i; - zval *replace, replace_copy; - int use_copy, looking_placeholder = 0; - - if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { - ZVAL_NULL(return_value); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); - return; - } - - if (Z_STRLEN_P(pattern) <= 0) { - ZVAL_FALSE(return_value); - return; - } - - cursor = Z_STRVAL_P(pattern); - if (*cursor == '/') { - ++cursor; - i = 1; - } - else { - i = 0; - } - - if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); -#else - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); -#endif - return; - } - - for (; i < Z_STRLEN_P(pattern); ++i) { - - ch = *cursor; - if (ch == '\0') { - break; - } - - if (parentheses_count == 0 && !looking_placeholder) { - if (ch == '{') { - if (bracket_count == 0) { - marker = cursor; - intermediate = 0; - } - bracket_count++; - } else { - if (ch == '}') { - bracket_count--; - if (intermediate > 0) { - if (bracket_count == 0) { - replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && !looking_placeholder) { - if (ch == '(') { - if (parentheses_count == 0) { - marker = cursor; - intermediate = 0; - } - parentheses_count++; - } else { - if (ch == ')') { - parentheses_count--; - if (intermediate > 0) { - if (parentheses_count == 0) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && parentheses_count == 0) { - if (looking_placeholder) { - if (intermediate > 0) { - if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - looking_placeholder = 0; - continue; - } - } - } else { - if (ch == ':') { - looking_placeholder = 1; - marker = cursor; - intermediate = 0; - } - } - } - - if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { - intermediate++; - } else { - smart_str_appendc(&route_str, ch); - } - - cursor++; - } - smart_str_0(&route_str); - -#if PHP_VERSION_ID < 70000 - if (route_str.len) { - RETURN_STRINGL(route_str.c, route_str.len, 0); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#else - if (route_str.s) { - RETURN_STR(route_str.s); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#endif -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { - - zval *view, *dependencyInjector = NULL; - - zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); - - if (!dependencyInjector) { - dependencyInjector = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { - - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *_0; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { - - - - RETURN_MEMBER(this_ptr, "_view"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { - - - - RETURN_MEMBER(this_ptr, "_registeredEngines"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &options_param); - - if (!options_param) { - ZEPHIR_INIT_VAR(options); - array_init(options); - } else { - zephir_get_arrval(options, options_param); - } - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { - - zval *viewsDir_param = NULL; - zval *viewsDir = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewsDir_param); - - if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { - zephir_get_strval(viewsDir, viewsDir_param); - } else { - ZEPHIR_INIT_VAR(viewsDir); - ZVAL_EMPTY_STRING(viewsDir); - } - - - zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { - - - - RETURN_MEMBER(this_ptr, "_viewsDir"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { - - zval *engines_param = NULL; - zval *engines = NULL; - - zephir_fetch_params(0, 1, 0, &engines_param); - - engines = engines_param; - - - zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(engines); - array_init(engines); - ZEPHIR_OBS_VAR(registeredEngines); - zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); - if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); - zephir_check_call_status(); - zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); - } else { - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); - return; - } - ZEPHIR_INIT_VAR(arguments); - zephir_create_array(arguments, 2, 0 TSRMLS_CC); - zephir_array_fast_append(arguments, this_ptr); - zephir_array_fast_append(arguments, dependencyInjector); - zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(engineService, _3$$5); - if (Z_TYPE_P(engineService) == IS_OBJECT) { - if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_NVAR(engineObject); - ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(engineObject, engineService); - } - } else { - if (Z_TYPE_P(engineService) == IS_STRING) { - ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_5$$13); - object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_LNVAR(_6$$13); - ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); - ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); - } - } - zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - } - RETURN_CCTOR(engines); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { - - HashTable *_4; - HashPosition _3; - zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; - zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - - - ZEPHIR_OBS_VAR(eventsManager); - zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_1$$4); - ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { - RETURN_MM_NULL(); - } - } - notExists = 1; - mustClean = 1; - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(viewsDirPath); - ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); - ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); - for ( - ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS - ; zephir_hash_move_forward_ex(_4, &_3) - ) { - ZEPHIR_GET_HMKEY(extension, _4, _3); - ZEPHIR_GET_HVALUE(engine, _5); - ZEPHIR_INIT_LNVAR(_6$$6); - ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); - if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); - } else { - _7$$8 = zephir_is_true(extension); - if (_7$$8) { - ZEPHIR_SINIT_NVAR(_8$$8); - ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); - ZEPHIR_INIT_NVAR(_9$$8); - zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); - _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); - } - _10$$8 = _7$$8; - if (_10$$8) { - _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); - } - if (_10$$8) { - ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); - } else { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZVAL_STRING(viewEnginePath, "", 1); - } - } - if (zephir_is_true(viewEnginePath)) { - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_12$$12); - ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); - zephir_check_temp_parameter(_12$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { - continue; - } - } - ZEPHIR_INIT_NVAR(_14$$11); - if (mustClean) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); - zephir_check_call_status(); - notExists = 0; - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_15$$14); - ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); - zephir_check_temp_parameter(_15$$14); - zephir_check_call_status(); - } - break; - } - } - if (notExists == 1) { - ZEPHIR_INIT_VAR(_17$$15); - object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_18$$15); - ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); - ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_19$$16); - ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); - zephir_check_temp_parameter(_19$$16); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { - - zend_bool _3$$12; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { - ZEPHIR_INIT_VAR(key); - ZVAL_NULL(key); - ZEPHIR_INIT_VAR(lifetime); - ZVAL_NULL(lifetime); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(key); - zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); - } - if (Z_TYPE_P(key) == IS_NULL) { - ZEPHIR_INIT_NVAR(key); - zephir_md5(key, path); - } - ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); - zephir_check_call_status(); - if (Z_TYPE_P(content) != IS_NULL) { - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_CCTOR(content); - } - } - } - ZEPHIR_INIT_VAR(_1); - zephir_create_symbol_table(TSRMLS_C); - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(params) == IS_ARRAY) { - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - } else { - ZEPHIR_CPY_WRT(mergedParams, viewParams); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, path, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_2$$12); - if (_3$$12) { - ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_4$$12); - } - if (_3$$12) { - ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - RETURN_MM_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_INIT_VAR(_0$$3); - zephir_create_symbol_table(TSRMLS_C); - - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, partialPath, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); - zend_print_zval(_1, 0); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - - zephir_get_arrval(options, options_param); - - - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { - - - - RETURN_MEMBER(this_ptr, "_cacheOptions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { - - zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); - return; - } - ZEPHIR_INIT_VAR(cacheService); - ZVAL_STRING(cacheService, "viewCache", 1); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - if (zephir_array_isset_string(cacheOptions, SS("service"))) { - ZEPHIR_OBS_NVAR(cacheService); - zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); - } - } - ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(viewCache, _0); - if (Z_TYPE_P(viewCache) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); - return; - } - RETURN_CCTOR(viewCache); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { - - zend_bool _1; - zval *_0, *_2, *_3$$3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = zephir_is_true(_0); - if (_1) { - ZEPHIR_OBS_VAR(_2); - zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = Z_TYPE_P(_2) != IS_OBJECT; - } - if (_1) { - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); - } - RETURN_MM_MEMBER(this_ptr, "_cache"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { - - zval *options = NULL; - - zephir_fetch_params(0, 0, 1, &options); - - if (!options) { - options = ZEPHIR_GLOBAL(global_true); - } - - - if (Z_TYPE_P(options) == IS_ARRAY) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - } else { - if (zephir_is_true(options)) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } else { - if (0) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { - - zend_bool merge, _0; - zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; - zval *params = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); - - params = params_param; - if (!merge_param) { - merge = 1; - } else { - merge = zephir_get_boolval(merge_param); - } - - - _0 = merge; - if (_0) { - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); - _0 = Z_TYPE_P(_1) == IS_ARRAY; - } - if (_0) { - ZEPHIR_INIT_VAR(_2$$3); - _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); - } - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { - - - - RETURN_MEMBER(this_ptr, "_viewParams"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { - - zval *content_param = NULL; - zval *content = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &content_param); - - if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(content_param) == IS_STRING)) { - zephir_get_strval(content, content_param); - } else { - ZEPHIR_INIT_VAR(content); - ZVAL_EMPTY_STRING(content); - } - - - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { - - - - RETURN_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { - - - - RETURN_MEMBER(this_ptr, "_activeRenderPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean == 1) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean == 1) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { - - zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(compiler); - zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); - if (Z_TYPE_P(compiler) != IS_OBJECT) { - ZEPHIR_INIT_NVAR(compiler); - object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 389, _0$$3); - zephir_check_call_status(); - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); - if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 390, dependencyInjector); - zephir_check_call_status(); - } - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 391, options); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); - } - RETURN_CCTOR(compiler); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *item; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); - - - - _0 = Z_TYPE_P(item) == IS_OBJECT; - if (!(_0)) { - _0 = Z_TYPE_P(item) == IS_ARRAY; - } - if (_0) { - RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 382, item); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_MM_LONG(zephir_fast_strlen_ev(item)); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &needle, &haystack); - - - - if (Z_TYPE_P(haystack) == IS_ARRAY) { - RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); - } - if (Z_TYPE_P(haystack) == IS_STRING) { - if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 392, haystack, needle); - zephir_check_call_status(); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); - } - ZEPHIR_INIT_VAR(_1$$4); - zephir_fast_strpos(_1$$4, haystack, needle, 0 ); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { - - zend_bool _0, _1; - int ZEPHIR_LAST_CALL_STATUS; - zval *text_param = NULL, *from_param = NULL, *to_param = NULL; - zval *text = NULL, *from = NULL, *to = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); - - zephir_get_strval(text, text_param); - if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(from_param) == IS_STRING)) { - zephir_get_strval(from, from_param); - } else { - ZEPHIR_INIT_VAR(from); - ZVAL_EMPTY_STRING(from); - } - if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(to_param) == IS_STRING)) { - zephir_get_strval(to, to_param); - } else { - ZEPHIR_INIT_VAR(to); - ZVAL_EMPTY_STRING(to); - } - - - _0 = ZEPHIR_IS_STRING(from, "latin1"); - if (!(_0)) { - _0 = ZEPHIR_IS_STRING(to, "utf8"); - } - if (_0) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 393, text); - zephir_check_call_status(); - RETURN_MM(); - } - _1 = ZEPHIR_IS_STRING(to, "latin1"); - if (!(_1)) { - _1 = ZEPHIR_IS_STRING(from, "utf8"); - } - if (_1) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 394, text); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 395, from, to, text); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { - - zend_bool _1$$5; - zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; - int start, ZEPHIR_LAST_CALL_STATUS, position = 0; - zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &value, &start_param, &end); - - if (!start_param) { - start = 0; - } else { - start = zephir_get_intval(start_param); - } - if (!end) { - ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(end); - } - - - if (Z_TYPE_P(value) == IS_OBJECT) { - if (Z_TYPE_P(end) == IS_NULL) { - ZEPHIR_INIT_NVAR(end); - ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); - } - position = 0; - ZEPHIR_INIT_VAR(slice); - array_init(slice); - ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0$$3))) { - break; - } - _1$$5 = position >= start; - if (_1$$5) { - _1$$5 = ZEPHIR_GE_LONG(end, position); - } - if (_1$$5) { - ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); - zephir_check_call_status(); - zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); - } - ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); - zephir_check_call_status(); - position++; - } - RETURN_CCTOR(slice); - } - ZEPHIR_INIT_VAR(length); - if (Z_TYPE_P(end) != IS_NULL) { - ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); - } else { - ZVAL_NULL(length); - } - if (Z_TYPE_P(value) == IS_ARRAY) { - ZEPHIR_SINIT_VAR(_5$$9); - ZVAL_LONG(&_5$$9, start); - ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 396, value, &_5$$9, length); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_6$$11); - ZVAL_LONG(&_6$$11, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_6$$11, length); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_8$$10); - ZVAL_LONG(&_8$$10, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_8$$10); - zephir_check_call_status(); - RETURN_MM(); - } - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_9$$12); - ZVAL_LONG(&_9$$12, start); - zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, start); - zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *value_param = NULL; - zval *value = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value_param); - - zephir_get_arrval(value, value_param); - - - ZEPHIR_MAKE_REF(value); - ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 398, value); - ZEPHIR_UNREF(value); - zephir_check_call_status(); - RETURN_CTOR(value); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *arguments = NULL; - zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; - zval *name = NULL, *_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments_param) { - ZEPHIR_INIT_VAR(arguments); - array_init(arguments); - } else { - zephir_get_arrval(arguments, arguments_param); - } - - - ZEPHIR_OBS_VAR(macro); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_1$$3); - object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_2$$3); - ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 399, macro, arguments); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - - -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ - - phvolt_parser_token *pToken; - - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ - - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); - - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; - - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} - -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ - - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); - } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); - } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); - } - - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); -} - -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif - - ZVAL_NULL(result); - -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif - - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; - } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; - } - - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; - } - - return 1; -} - -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { - - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; - - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } - - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; - } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; - } - - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; - - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; - - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; - - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); - } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; - } - } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); - } else { - efree(token.value); - } - break; - - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; - - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; - - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; - - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; - - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; - - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; - - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; - - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; - - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; - - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; - - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; - - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; - - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; - - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; - - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; - - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; - - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; - - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; - } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; - } - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); -#endif - efree(parser_status->syntax_error); - } - } - - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { - - zval *view = NULL; - - zephir_fetch_params(0, 0, 1, &view); - - if (!view) { - view = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(view) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { - - zval *option_param = NULL, *value; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &option_param, &value); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { - - zval *option_param = NULL, *value = NULL, *_0; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &option_param); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { - - zval *_3$$6 = NULL, *_4$$7 = NULL; - HashTable *_1$$3; - HashPosition _0$$3; - int ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments) { - arguments = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(extension, _2$$3); - if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(arguments) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_3$$6); - zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$6, extension); - zephir_array_fast_append(_3$$6, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_4$$7); - zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_4$$7, extension); - zephir_array_fast_append(_4$$7, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC(status, _4$$7); - zephir_check_call_status(); - } - if (Z_TYPE_P(status) == IS_STRING) { - RETURN_CCTOR(status); - } - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *extension; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &extension); - - - - if (Z_TYPE_P(extension) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); - return; - } - if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); - zephir_check_call_status(); - } - zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { - - - - RETURN_MEMBER(this_ptr, "_extensions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { - - - - RETURN_MEMBER(this_ptr, "_functions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { - - - - RETURN_MEMBER(this_ptr, "_filters"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { - - zval *_7$$5; - zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - ZEPHIR_INIT_VAR(_1$$3); - _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); - zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(_3); - zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_3) == IS_OBJECT) { - ZEPHIR_OBS_VAR(_4$$4); - zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_5$$5); - _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_7$$5); - zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_7$$5, this_ptr); - ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); - } - } - ZEPHIR_OBS_VAR(_8); - zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_8) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); - return; - } - RETURN_MM_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { - - zend_bool _3$$5, _8$$8; - zephir_fcall_cache_entry *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; - zval *expr = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - ZEPHIR_OBS_VAR(left); - zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); - zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 265)) { - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); - if (ZEPHIR_IS_STRING(variable, "loop")) { - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); - zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); - } else { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; - if (_3$$5) { - ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); - zephir_check_call_status(); - _3$$5 = zephir_is_true(_4$$5); - } - if (_3$$5) { - ZEPHIR_INIT_VAR(_5$$6); - ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); - zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_CONCAT_SV(_6$$7, "$", variable); - zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); - } - } - } else { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(leftType); - zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); - _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); - if (_8$$8) { - _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); - } - if (_8$$8) { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } else { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } - } - zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); - ZEPHIR_OBS_VAR(right); - zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); - zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_9, 265)) { - zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); - zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); - } else { - ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); - } - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { - - zend_bool _8$$5; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; - zval *expr = NULL, *_1$$6, *_3$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(arguments); - ZVAL_STRING(arguments, "", 1); - } - ZEPHIR_OBS_VAR(nameExpr); - zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_VAR(nameType); - zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - if (ZEPHIR_IS_LONG(nameType, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_1$$6); - zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_1$$6, name); - zephir_array_fast_append(_1$$6, arguments); - zephir_array_fast_append(_1$$6, funcArguments); - ZEPHIR_INIT_VAR(_2$$6); - ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _2$$6, _1$$6); - zephir_check_temp_parameter(_2$$6); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(functions); - zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); - if (Z_TYPE_P(functions) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_3$$12); - zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$12, arguments); - zephir_array_fast_append(_3$$12, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_4$$9); - object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); - zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$9); - ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); - ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); - if (!(_8$$5)) { - _8$$5 = ZEPHIR_IS_STRING(name, "content"); - } - if (_8$$5) { - RETURN_MM_STRING("$this->getContent()", 1); - } - if (ZEPHIR_IS_STRING(name, "partial")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "super")) { - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { - ZEPHIR_OBS_VAR(currentBlock); - zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(block); - if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { - ZEPHIR_OBS_VAR(exprLevel); - zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 402, block); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, code); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, code TSRMLS_CC); - } - } else { - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, block); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, block TSRMLS_CC); - } - } - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - RETURN_CCTOR(escapedCode); - } - ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); - RETURN_MM(); - } - } - RETURN_MM_STRING("''", 1); - } - ZEPHIR_INIT_VAR(_9$$5); - zephir_camelize(_9$$5, name, NULL ); - ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(className); - ZVAL_STRING(className, "Phalcon\\Tag", 1); - if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { - ZEPHIR_OBS_VAR(arrayHelpers); - zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); - if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(arrayHelpers); - zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); - zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); - } - if (zephir_array_isset(arrayHelpers, name)) { - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "static_url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "date")) { - ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "time")) { - RETURN_MM_STRING("time()", 1); - } - if (ZEPHIR_IS_STRING(name, "dump")) { - ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "version")) { - RETURN_MM_STRING("Phalcon\\Version::get()", 1); - } - if (ZEPHIR_IS_STRING(name, "version_id")) { - RETURN_MM_STRING("Phalcon\\Version::getId()", 1); - } - if (ZEPHIR_IS_STRING(name, "constant")) { - ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 400, nameExpr); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { - - zephir_fcall_cache_entry *_2 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; - zval *test = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &test_param, &left_param); - - test = test_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); - if (ZEPHIR_IS_STRING(name, "empty")) { - ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "even")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "odd")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "numeric")) { - ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "scalar")) { - ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "iterable")) { - ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); - RETURN_MM(); - } - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_OBS_VAR(testName); - zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { - if (ZEPHIR_IS_STRING(name, "divisibleby")) { - zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 400, _1$$12); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sameas")) { - zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 400, _4$$13); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "type")) { - zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 400, _6$$14); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); - RETURN_MM(); - } - } - } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 400, test); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { - - zend_bool _13, _14, _15; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; - zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &filter_param, &left_param); - - filter = filter_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); - } else { - if (!ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_INIT_VAR(_0$$5); - object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); - ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_VAR(functionName); - zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_INIT_VAR(arguments); - ZVAL_NULL(arguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { - if (!ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_OBS_VAR(file); - zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_OBS_VAR(line); - zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_INIT_VAR(_4$$7); - zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); - add_assoc_long_ex(_5$$7, SS("type"), 364); - zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - ZEPHIR_MAKE_REF(funcArguments); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, funcArguments, _4$$7); - ZEPHIR_UNREF(funcArguments); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(arguments, left); - } - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_6$$9, name); - zephir_array_fast_append(_6$$9, arguments); - zephir_array_fast_append(_6$$9, funcArguments); - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _7$$9, _6$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(filters); - zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); - if (Z_TYPE_P(filters) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_8$$15); - zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_8$$15, arguments); - zephir_array_fast_append(_8$$15, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_9$$12); - object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); - zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$12); - ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - if (ZEPHIR_IS_STRING(name, "length")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); - RETURN_MM(); - } - _13 = ZEPHIR_IS_STRING(name, "e"); - if (!(_13)) { - _13 = ZEPHIR_IS_STRING(name, "escape"); - } - if (_13) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_css")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_js")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_attr")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "trim")) { - ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "left_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "right_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "striptags")) { - ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slashes")) { - ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "stripslashes")) { - ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "nl2br")) { - ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "keys")) { - ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "join")) { - ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); - RETURN_MM(); - } - _14 = ZEPHIR_IS_STRING(name, "lower"); - if (!(_14)) { - _14 = ZEPHIR_IS_STRING(name, "lowercase"); - } - if (_14) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); - RETURN_MM(); - } - _15 = ZEPHIR_IS_STRING(name, "upper"); - if (!(_15)) { - _15 = ZEPHIR_IS_STRING(name, "uppercase"); - } - if (_15) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "capitalize")) { - ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sort")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_decode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "format")) { - ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "abs")) { - ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slice")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "convert_encoding")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_16); - object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_INIT_VAR(_19); - ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); - ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); - zephir_check_call_status(); - zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { - - HashTable *_4$$6; - HashPosition _3$$6; - zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; - zval *expr = NULL, *_0$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - while (1) { - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_0$$4); - zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_0$$4, expr); - ZEPHIR_INIT_NVAR(_1$$4); - ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 401, _1$$4, _0$$4); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (Z_TYPE_P(exprCode) == IS_STRING) { - break; - } - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(items); - array_init(items); - zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); - for ( - ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) - ) { - ZEPHIR_GET_HVALUE(singleExpr, _5$$6); - zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 400, _6$$7); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_LNVAR(_8$$8); - ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); - zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); - } else { - zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); - } - } - ZEPHIR_INIT_NVAR(exprCode); - zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, '.')) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(left); - if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - } - if (ZEPHIR_IS_LONG(type, 311)) { - zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 124)) { - zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 404, _12$$13, leftCode); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(right); - if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_NULL(exprCode); - do { - if (ZEPHIR_IS_LONG(type, '!')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '*')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '+')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '-')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '/')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 37)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '<')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 61)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 62)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 126)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 278)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 360)) { - ZEPHIR_INIT_NVAR(exprCode); - if (zephir_array_isset_string(expr, SS("left"))) { - ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); - } else { - ZVAL_STRING(exprCode, "[]", 1); - } - break; - } - if (ZEPHIR_IS_LONG(type, 258)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 259)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 260)) { - ZEPHIR_INIT_NVAR(_14$$31); - zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); - ZEPHIR_SINIT_NVAR(_16$$31); - ZVAL_STRING(&_16$$31, "'", 0); - ZEPHIR_SINIT_NVAR(_17$$31); - ZVAL_STRING(&_17$$31, "\\'", 0); - zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); - break; - } - if (ZEPHIR_IS_LONG(type, 261)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "null", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 262)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "false", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 263)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "true", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 265)) { - zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); - break; - } - if (ZEPHIR_IS_LONG(type, 266)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 267)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 270)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 271)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 272)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 273)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 274)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 275)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 276)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 356)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 361)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); - break; - } - if (ZEPHIR_IS_LONG(type, 365)) { - ZEPHIR_OBS_NVAR(start); - if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 400, start); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(startCode); - ZVAL_STRING(startCode, "null", 1); - } - ZEPHIR_OBS_NVAR(end); - if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 400, end); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(endCode); - ZVAL_STRING(endCode, "null", 1); - } - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 362)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 363)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 392)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 386)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 393)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 387)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 394)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 388)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 395)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 389)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 396)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 390)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 397)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 391)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 367)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 366)) { - zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 400, _21$$69); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 368)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 369)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 364)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); - break; - } - ZEPHIR_INIT_NVAR(_22$$73); - object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_25$$73); - ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); - ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); - zephir_check_call_status(); - zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - break; - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { - - HashTable *_1$$4; - HashPosition _0$$4; - zend_bool isStatementList = 0; - int ZEPHIR_LAST_CALL_STATUS; - zval *statements, *statement = NULL, **_2$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statements); - - - - if (Z_TYPE_P(statements) != IS_ARRAY) { - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - } - isStatementList = 1; - if (!(zephir_array_isset_string(statements, SS("type")))) { - zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(statement, _2$$4); - if (Z_TYPE_P(statement) != IS_ARRAY) { - isStatementList = 0; - break; - } - } - } - if (isStatementList == 1) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 405, statements); - zephir_check_call_status(); - RETURN_MM(); - } - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { - - HashTable *_2$$4; - HashPosition _1$$4; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_array_isset_string(statement, SS("expr")))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "", 1); - ZEPHIR_INIT_VAR(forElse); - ZVAL_NULL(forElse); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(prefixLevel); - ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); - ZEPHIR_OBS_VAR(expr); - zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(blockStatements); - zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); - ZEPHIR_INIT_NVAR(forElse); - ZVAL_BOOL(forElse, 0); - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); - for ( - ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) - ) { - ZEPHIR_GET_HVALUE(bstatement, _3$$4); - if (Z_TYPE_P(bstatement) != IS_ARRAY) { - break; - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_INIT_LNVAR(_4$$8); - ZEPHIR_CONCAT_SVS(_4$$8, ""); - zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); - ZEPHIR_CPY_WRT(forElse, prefixLevel); - zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); - break; - } - } - } - ZEPHIR_INIT_VAR(_5); - if (extendsMode) { - ZVAL_BOOL(_5, 1); - } else { - ZVAL_BOOL(_5, 0); - } - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 405, blockStatements, _5); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(loopContext); - zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_6$$9); - ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); - zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_10$$9); - ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); - zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); - zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$9); - ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); - zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_13$$9); - ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); - zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_14$$9); - ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); - zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(iterator); - ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); - } else { - ZEPHIR_CPY_WRT(iterator, exprCode); - } - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); - ZEPHIR_OBS_VAR(key); - if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_15$$11); - ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); - zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_16$$12); - ZEPHIR_CONCAT_SVSVS(_16$$12, ""); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); - } - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_19$$15); - ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); - zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_20$$15); - ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); - zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$15); - ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_22$$15); - ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_23$$15); - ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_24$$15); - ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); - zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - ZEPHIR_INIT_VAR(_25$$16); - ZEPHIR_CONCAT_SVS(_25$$16, ""); - zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); - } - zephir_concat_self(&compilation, code TSRMLS_CC); - if (zephir_array_isset_string(statement, SS("if_expr"))) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } else { - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_26$$20); - ZEPHIR_CONCAT_SVS(_26$$20, ""); - zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { - - zval *level = NULL, *prefix = NULL, *_0, *_1$$3; - - - level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(_1$$3, level)) { - ZEPHIR_CONCAT_SVSVS(return_value, ""); - return; - } - ZEPHIR_CONCAT_SVS(return_value, ""); - return; - } - RETURN_STRING("", 1); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { - - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3); - if (extendsMode) { - ZVAL_BOOL(_3, 1); - } else { - ZVAL_BOOL(_3, 0); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 405, _2, _3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVSV(compilation, "", _1); - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_6$$4); - if (extendsMode) { - ZVAL_BOOL(_6$$4, 1); - } else { - ZVAL_BOOL(_6$$4, 0); - } - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 405, blockStatements, _6$$4); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_7$$4); - ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); - zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); - } - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { - - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); - ZEPHIR_OBS_VAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); - zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); - zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_3$$4, 265)) { - zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$5); - ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); - zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$6); - ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); - zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); - } - } else { - ZEPHIR_INIT_VAR(_8$$7); - ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); - zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_9); - ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); - zephir_concat_self(&compilation, _9 TSRMLS_CC); - zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12); - if (extendsMode) { - ZVAL_BOOL(_12, 1); - } else { - ZVAL_BOOL(_12, 0); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 405, _11, _12); - zephir_check_call_status(); - zephir_concat_self(&compilation, _10 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_13$$8, 265)) { - zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); - ZEPHIR_INIT_VAR(_15$$9); - ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); - zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); - ZEPHIR_INIT_VAR(_17$$10); - ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); - zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_18$$8); - ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_19$$11); - ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { - - HashTable *_1; - HashPosition _0; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(assignments); - if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(autoescape); - if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); - return; - } - ZEPHIR_OBS_VAR(oldAutoescape); - zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 405, _0, _1); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 350)) { - zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); - zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_1$$4, 265)) { - zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); - if (ZEPHIR_IS_STRING(_2$$5, "super")) { - RETURN_CCTOR(exprCode); - } - } - } - _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); - if (zephir_is_true(_3)) { - ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - - zephir_fcall_cache_entry *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(pathExpr); - if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); - return; - } - zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 260)) { - if (!(zephir_array_isset_string(statement, SS("params")))) { - ZEPHIR_OBS_VAR(path); - zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_1$$5); - ZVAL_BOOL(_1$$5, 0); - ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(compilation); - zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - } - } - ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 400, pathExpr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(params); - if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { - ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 400, params); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { - - HashTable *_6$$6; - HashPosition _5$$6; - zephir_fcall_cache_entry *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(name); - if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (zephir_array_isset(_0, name)) { - ZEPHIR_INIT_VAR(_1$$4); - object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); - ZEPHIR_INIT_VAR(macroName); - ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); - ZEPHIR_INIT_VAR(code); - ZVAL_STRING(code, ""); - zephir_concat_self(&code, _3$$5 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); - zephir_concat_self(&code, _4$$6 TSRMLS_CC); - zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); - for ( - ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) - ) { - ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); - ZEPHIR_GET_HVALUE(parameter, _7$$6); - ZEPHIR_OBS_NVAR(variableName); - zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_8$$7); - ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); - zephir_concat_self(&code, _8$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_9$$7); - ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); - zephir_concat_self(&code, _9$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_10$$7); - ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); - zephir_concat_self(&code, _10$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_11$$7); - ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); - zephir_concat_self(&code, _11$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_OBS_NVAR(defaultValue); - if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 400, defaultValue); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_14$$8); - ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); - zephir_concat_self(&code, _14$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_LNVAR(_15$$9); - ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); - zephir_concat_self(&code, _15$$9 TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); - } - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_17$$10); - if (extendsMode) { - ZVAL_BOOL(_17$$10, 1); - } else { - ZVAL_BOOL(_17$$10, 0); - } - ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 405, blockStatements, _17$$10); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_18$$10); - ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); - zephir_concat_self(&code, _19 TSRMLS_CC); - RETURN_CCTOR(code); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL; - zval *statement = NULL; - - zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { - - HashTable *_2; - HashPosition _1; - zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode, _0; - zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; - zval *statements = NULL, *_9$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - - statements = statements_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_fast_count_int(statements TSRMLS_CC))) { - RETURN_MM_STRING("", 1); - } - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - _0 = zephir_is_true(extended); - if (!(_0)) { - _0 = extendsMode; - } - ZEPHIR_INIT_VAR(blockMode); - ZVAL_BOOL(blockMode, _0); - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HVALUE(statement, _3); - if (Z_TYPE_P(statement) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); - return; - } - if (!(zephir_array_isset_string(statement, SS("type")))) { - ZEPHIR_INIT_NVAR(_4$$7); - object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_7$$7); - ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); - ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_9$$8); - zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_9$$8, statement); - ZEPHIR_INIT_NVAR(_10$$8); - ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 401, _10$$8, _9$$8); - zephir_check_temp_parameter(_10$$8); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_STRING) { - zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); - continue; - } - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); - do { - if (ZEPHIR_IS_LONG(type, 357)) { - zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); - zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_INIT_NVAR(_14$$11); - if (extendsMode) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); - zephir_check_call_status(); - zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 302)) { - ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 304)) { - ZEPHIR_INIT_NVAR(_19$$13); - if (extendsMode) { - ZVAL_BOOL(_19$$13, 1); - } else { - ZVAL_BOOL(_19$$13, 0); - } - ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); - zephir_check_call_status(); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 359)) { - ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 307)) { - ZEPHIR_OBS_NVAR(blockName); - zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blockStatements); - zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - if (zephir_is_true(blockMode)) { - if (Z_TYPE_P(blocks) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(blocks); - array_init(blocks); - } - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); - ZEPHIR_INIT_NVAR(compilation); - ZVAL_NULL(compilation); - } - zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); - } else { - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_26$$21); - if (extendsMode) { - ZVAL_BOOL(_26$$21, 1); - } else { - ZVAL_BOOL(_26$$21, 0); - } - ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 405, blockStatements, _26$$21); - zephir_check_call_status(); - zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); - } - } - break; - } - if (ZEPHIR_IS_LONG(type, 310)) { - ZEPHIR_OBS_NVAR(path); - zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); - zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(extended); - ZVAL_BOOL(extended, 1); - ZEPHIR_INIT_NVAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(tempCompilation); - zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); - ZEPHIR_CPY_WRT(blockMode, extended); - break; - } - if (ZEPHIR_IS_LONG(type, 313)) { - ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 314)) { - ZEPHIR_INIT_NVAR(_34$$25); - if (extendsMode) { - ZVAL_BOOL(_34$$25, 1); - } else { - ZVAL_BOOL(_34$$25, 0); - } - ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); - zephir_check_call_status(); - zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 316)) { - ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 327)) { - ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 317)) { - ZEPHIR_INIT_NVAR(_41$$28); - if (extendsMode) { - ZVAL_BOOL(_41$$28, 1); - } else { - ZVAL_BOOL(_41$$28, 0); - } - ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); - zephir_check_call_status(); - zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 319)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 320)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); - zephir_check_call_status(); - zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 322)) { - ZEPHIR_INIT_NVAR(_46$$32); - if (extendsMode) { - ZVAL_BOOL(_46$$32, 1); - } else { - ZVAL_BOOL(_46$$32, 0); - } - ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); - zephir_check_call_status(); - zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 325)) { - ZEPHIR_INIT_NVAR(_49$$33); - if (extendsMode) { - ZVAL_BOOL(_49$$33, 1); - } else { - ZVAL_BOOL(_49$$33, 0); - } - ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); - zephir_check_call_status(); - zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 358)) { - break; - } - ZEPHIR_INIT_NVAR(_51$$35); - object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_54$$35); - ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); - ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); - zephir_check_call_status(); - zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - } - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); - if (ZEPHIR_IS_LONG(level, 1)) { - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - - HashTable *_3$$7; - HashPosition _2$$7; - zephir_fcall_cache_entry *_1 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(currentPath); - zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_OBS_VAR(autoescape); - if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { - if (Z_TYPE_P(autoescape) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); - return; - } - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(intermediate); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(intermediate) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); - return; - } - ZEPHIR_INIT_VAR(_0); - if (extendsMode) { - ZVAL_BOOL(_0, 1); - } else { - ZVAL_BOOL(_0, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 405, intermediate, _0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { - ZEPHIR_INIT_VAR(finalCompilation); - if (extendsMode == 1) { - array_init(finalCompilation); - } else { - ZVAL_NULL(finalCompilation); - } - ZEPHIR_OBS_VAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); - for ( - ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) - ) { - ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); - ZEPHIR_GET_HVALUE(block, _4$$7); - if (Z_TYPE_P(name) == IS_STRING) { - if (zephir_array_isset(blocks, name)) { - ZEPHIR_OBS_NVAR(localBlock); - zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, localBlock); - zephir_check_call_status(); - } else { - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, block); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(blockCompilation, block); - } - } - if (extendsMode == 1) { - zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); - } - } else { - if (extendsMode == 1) { - zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); - } else { - zephir_concat_self(&finalCompilation, block TSRMLS_CC); - } - } - } - RETURN_CCTOR(finalCompilation); - } - if (extendsMode == 1) { - RETURN_MM_MEMBER(this_ptr, "_blocks"); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_STRING(_0, "eval code", 1); - zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; - zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { - zephir_get_strval(compiledPath, compiledPath_param); - } else { - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_EMPTY_STRING(compiledPath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (ZEPHIR_IS_EQUAL(path, compiledPath)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); - return; - } - if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_1$$4); - ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(viewCode); - zephir_file_get_contents(viewCode, path TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { - ZEPHIR_INIT_VAR(_2$$5); - object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); - ZEPHIR_INIT_VAR(_4); - if (extendsMode) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_ARRAY) { - ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(finalCompilation, compilation); - } - ZEPHIR_INIT_VAR(_5); - zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); - return; - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - - zval *_2$$23; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (0) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(stat); - ZVAL_BOOL(stat, 1); - ZEPHIR_INIT_VAR(compileAlways); - ZVAL_BOOL(compileAlways, 0); - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_STRING(compiledPath, "", 1); - ZEPHIR_INIT_VAR(prefix); - ZVAL_NULL(prefix); - ZEPHIR_INIT_VAR(compiledSeparator); - ZVAL_STRING(compiledSeparator, "%%", 1); - ZEPHIR_INIT_VAR(compiledExtension); - ZVAL_STRING(compiledExtension, ".php", 1); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (zephir_array_isset_string(options, SS("compileAlways"))) { - ZEPHIR_OBS_NVAR(compileAlways); - zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); - if (Z_TYPE_P(compileAlways) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); - return; - } - } - if (zephir_array_isset_string(options, SS("prefix"))) { - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); - if (Z_TYPE_P(prefix) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledPath"))) { - ZEPHIR_OBS_NVAR(compiledPath); - zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); - if (Z_TYPE_P(compiledPath) != IS_STRING) { - if (Z_TYPE_P(compiledPath) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); - return; - } - } - } - if (zephir_array_isset_string(options, SS("compiledSeparator"))) { - ZEPHIR_OBS_NVAR(compiledSeparator); - zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); - if (Z_TYPE_P(compiledSeparator) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledExtension"))) { - ZEPHIR_OBS_NVAR(compiledExtension); - zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); - if (Z_TYPE_P(compiledExtension) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); - return; - } - } - if (zephir_array_isset_string(options, SS("stat"))) { - ZEPHIR_OBS_NVAR(stat); - zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); - } - } - if (Z_TYPE_P(compiledPath) == IS_STRING) { - if (!(ZEPHIR_IS_EMPTY(compiledPath))) { - ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(templateSepPath); - zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(templateSepPath, templatePath); - } - ZEPHIR_INIT_VAR(compiledTemplatePath); - if (extendsMode == 1) { - ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); - } else { - ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); - } - } else { - if (Z_TYPE_P(compiledPath) == IS_OBJECT) { - if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$23); - zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$23, templatePath); - zephir_array_fast_append(_2$$23, options); - ZEPHIR_INIT_VAR(_3$$23); - ZVAL_BOOL(_3$$23, extendsMode); - zephir_array_fast_append(_2$$23, _3$$23); - ZEPHIR_INIT_NVAR(compiledTemplatePath); - ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); - zephir_check_call_status(); - if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); - return; - } - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); - return; - } - } - } - ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); - if (zephir_is_true(compileAlways)) { - ZEPHIR_INIT_VAR(_4$$26); - if (extendsMode) { - ZVAL_BOOL(_4$$26, 1); - } else { - ZVAL_BOOL(_4$$26, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); - zephir_check_call_status(); - } else { - if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { - if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_VAR(_6$$29); - if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_7$$30); - if (extendsMode) { - ZVAL_BOOL(_7$$30, 1); - } else { - ZVAL_BOOL(_7$$30, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); - zephir_check_call_status(); - } else { - if (extendsMode == 1) { - ZEPHIR_INIT_VAR(blocksCode); - zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { - ZEPHIR_INIT_VAR(_8$$33); - object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_9$$33); - ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); - zephir_check_call_status(); - zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (zephir_is_true(blocksCode)) { - ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(compilation); - array_init(compilation); - } - } - } - } else { - ZEPHIR_INIT_VAR(_10$$36); - if (extendsMode) { - ZVAL_BOOL(_10$$36, 1); - } else { - ZVAL_BOOL(_10$$36, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); - zephir_check_call_status(); - } - } else { - if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_11$$38); - object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_12$$38); - ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); - zephir_check_call_status(); - zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - } - zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_currentPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *viewCode_param = NULL, *currentPath = NULL; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewCode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - - - ZEPHIR_INIT_VAR(currentPath); - ZVAL_STRING(currentPath, "eval code", 1); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &path_param); - - zephir_get_strval(path, path_param); - - - ZEPHIR_OBS_VAR(view); - zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); - if (Z_TYPE_P(view) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { - zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(viewsDir, _2$$4); - ZEPHIR_INIT_LNVAR(_3$$5); - ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); - if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } - } - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } else { - ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); - RETURN_MM(); - } - } - RETURN_CTOR(path); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -%% -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -%% -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval* vv40; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; + } +// 562 "scanner.re" -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ + } -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; + return status; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; +#ifdef HAVE_CONFIG_H #endif -} -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); + return SUCCESS; + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 155 "parser.php5.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); - } - efree((vvpminor->vv0)); +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { + + zval *success_param = NULL, *model = NULL; + zend_bool success; + + zephir_fetch_params(0, 1, 1, &success_param, &model); + + success = zephir_get_boolval(success_param); + if (!model) { + model = ZEPHIR_GLOBAL(global_null); } -} -// 1133 "parser.php5.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 172 "parser.php5.lemon" -{ -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(vvpminor->vv40)); -#endif -} -// 1175 "parser.php5.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; -} + if (success) { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} + + + RETURN_MEMBER(this_ptr, "_model"); -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *model = NULL; + int ZEPHIR_LAST_CALL_STATUS; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 164 "parser.php5.lemon" -{ - status->ret = vvmsp[0].minor.vv40; -} -// 1544 "parser.php5.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 168 "parser.php5.lemon" -{ - vvgotominor.vv40 = vvmsp[0].minor.vv40; -} -// 1572 "parser.php5.c" - break; - case 2: -// 178 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); -} -// 1579 "parser.php5.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 182 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); -} -// 1590 "parser.php5.c" - break; - case 24: -// 278 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1603 "parser.php5.c" - break; - case 25: -// 282 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1616 "parser.php5.c" - break; - case 26: -// 286 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1632 "parser.php5.c" - break; - case 27: -// 290 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1648 "parser.php5.c" - break; - case 28: -// 294 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1664 "parser.php5.c" - break; - case 29: -// 304 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1674 "parser.php5.c" - break; - case 30: -// 314 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1684 "parser.php5.c" - break; - case 31: -// 324 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1698 "parser.php5.c" - break; - case 32: -// 328 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1713 "parser.php5.c" - break; - case 33: -// 332 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1728 "parser.php5.c" - break; - case 34: -// 336 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1744 "parser.php5.c" - break; - case 35: -// 346 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1754 "parser.php5.c" - break; - case 36: - case 48: - case 134: - case 141: -// 356 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); - vv_destructor(2,&vvmsp[-1].minor); -} -// 1765 "parser.php5.c" - break; - case 38: -// 370 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); -} -// 1773 "parser.php5.c" - break; - case 39: -// 374 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); -} -// 1781 "parser.php5.c" - break; - case 40: -// 378 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); -} -// 1789 "parser.php5.c" - break; - case 41: -// 382 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); -} -// 1797 "parser.php5.c" - break; - case 42: -// 386 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); -} -// 1805 "parser.php5.c" - break; - case 43: - case 67: - case 133: - case 145: -// 390 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); -} -// 1815 "parser.php5.c" - break; - case 44: - case 127: -// 394 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); -} -// 1825 "parser.php5.c" - break; - case 45: - case 116: -// 398 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); } -// 1834 "parser.php5.c" - break; - case 46: -// 408 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { + + + + RETURN_MEMBER(this_ptr, "_success"); + } -// 1849 "parser.php5.c" - break; - case 47: -// 412 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); + + return SUCCESS; + } -// 1864 "parser.php5.c" - break; - case 50: -// 436 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); + return SUCCESS; + } -// 1871 "parser.php5.c" - break; - case 51: -// 440 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnTypes, *result = NULL, *cache = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); + + if (!result) { + result = ZEPHIR_GLOBAL(global_null); + } + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1879 "parser.php5.c" - break; - case 52: - case 66: - case 132: - case 146: -// 444 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { + + zend_class_entry *_13$$15; + HashTable *_3, *_6$$11; + HashPosition _2, _5$$11; + zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; + zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; + int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); + RETURN_CCTOR(row); + } + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_INIT_NVAR(activeRow); + object_init_ex(activeRow, phalcon_mvc_model_row_ce); + if (zephir_has_constructor(activeRow TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); + zephir_check_call_status(); + } + break; + } + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + ZEPHIR_INIT_NVAR(activeRow); + array_init(activeRow); + break; + } + ZEPHIR_INIT_NVAR(activeRow); + object_init(activeRow); + break; + } while(0); + + dirtyState = 0; + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); + zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HMKEY(alias, _3, _2); + ZEPHIR_GET_HVALUE(column, _4); + if (Z_TYPE_P(column) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); + return; + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); + if (ZEPHIR_IS_STRING(type, "object")) { + ZEPHIR_OBS_NVAR(source); + zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); + ZEPHIR_OBS_NVAR(attributes); + zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); + ZEPHIR_OBS_NVAR(columnMap); + zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); + ZEPHIR_INIT_NVAR(rowModel); + array_init(rowModel); + zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); + for ( + ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) + ) { + ZEPHIR_GET_HVALUE(attribute, _7$$11); + ZEPHIR_OBS_NVAR(columnValue); + ZEPHIR_INIT_LNVAR(_8$$12); + ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); + zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); + zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); + } + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_OBS_NVAR(keepSnapshots); + if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(keepSnapshots); + ZVAL_BOOL(keepSnapshots, 0); + } + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_NVAR(_9$$15); + zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); + if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { + zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); + ZEPHIR_INIT_NVAR(modelName); + zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_12$$15); + ZVAL_LONG(_12$$15, dirtyState); + _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); + zephir_check_call_status(); + } else { + zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_16$$18); + ZVAL_LONG(_16$$18, dirtyState); + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + ZEPHIR_OBS_NVAR(attribute); + zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(sqlAlias); + if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { + ZEPHIR_OBS_NVAR(value); + zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(value); + zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); + } + if (zephir_array_isset_string(column, SS("balias"))) { + ZEPHIR_CPY_WRT(attribute, alias); + } else { + ZEPHIR_SINIT_NVAR(_18$$24); + ZVAL_STRING(&_18$$24, "_", 0); + ZEPHIR_SINIT_NVAR(_19$$24); + ZVAL_STRING(&_19$$24, "", 0); + ZEPHIR_INIT_NVAR(attribute); + zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); + } + } + if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { + do { + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); + break; + } + zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); + break; + } while(0); + + } + } + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1889 "parser.php5.c" - break; - case 53: - case 147: -// 448 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { + + zval *records = NULL, *current = NULL, *_0 = NULL; + zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(records); + array_init(records); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0))) { + break; + } + ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 338); + zephir_check_call_status(); + zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); + zephir_check_call_status(); + } + RETURN_CCTOR(records); + } -// 1897 "parser.php5.c" - break; - case 54: - case 148: -// 452 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { + + zval *_0; + zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(cache); + zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnTypes); + zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 4, 0 TSRMLS_CC); + zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_CCTOR(serialized); + } -// 1905 "parser.php5.c" - break; - case 55: - case 149: -// 456 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + if (1) { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_2); + ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); + zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1914 "parser.php5.c" - break; - case 56: - case 150: -// 460 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 1923 "parser.php5.c" - break; - case 57: - case 151: -// 464 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); + + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + if (!keepSnapshots) { + keepSnapshots = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1932 "parser.php5.c" - break; - case 58: -// 474 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { + + zend_class_entry *_5$$6; + zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_VAR(_0$$6); + zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); + if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { + _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(modelName); + zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_4$$6); + ZVAL_LONG(_4$$6, 0); + _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); + zephir_check_call_status(); + } else { + _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_9$$9); + ZVAL_LONG(_9$$9, 0); + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 339, _7$$9, row, columnMap, _9$$9, _8$$9); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 340, row, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1947 "parser.php5.c" - break; - case 59: -// 478 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { + + HashTable *_2$$7, *_5$$8; + HashPosition _1$$7, _4$$8; + zephir_fcall_cache_entry *_9 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; + zend_bool renameColumns; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &renameColumns_param); + + if (!renameColumns_param) { + renameColumns = 1; + } else { + renameColumns = zephir_get_boolval(renameColumns_param); + } + + + ZEPHIR_OBS_VAR(records); + zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); + if (Z_TYPE_P(records) != IS_ARRAY) { + ZEPHIR_OBS_VAR(result); + zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(_0$$3) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); + } + if (renameColumns) { + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + RETURN_CCTOR(records); + } + ZEPHIR_INIT_VAR(renamedRecords); + array_init(renamedRecords); + if (Z_TYPE_P(records) == IS_ARRAY) { + zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); + for ( + ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) + ) { + ZEPHIR_GET_HVALUE(record, _3$$7); + ZEPHIR_INIT_NVAR(renamed); + array_init(renamed); + zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); + for ( + ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS + ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) + ) { + ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); + ZEPHIR_GET_HVALUE(value, _6$$8); + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(renamedKey) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_10$$12); + object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_11$$12); + ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); + } + zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); + } + } + RETURN_CCTOR(renamedRecords); + } + RETURN_CCTOR(records); + } -// 1962 "parser.php5.c" - break; - case 60: -// 488 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { + + zval *_1 = NULL, *_2 = NULL, *_3; + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 6, 0 TSRMLS_CC); + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 0); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); + zephir_check_call_status(); + zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1971 "parser.php5.c" - break; - case 61: -// 498 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); + zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_3); + ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); + zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); + zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1980 "parser.php5.c" - break; - case 62: -// 508 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1993 "parser.php5.c" - break; - case 63: -// 512 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2006 "parser.php5.c" - break; - case 64: -// 522 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *message_param = NULL, *record = NULL; + zval *message = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &record); + + if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(message, message_param); + } else { + ZEPHIR_INIT_VAR(message); + ZVAL_EMPTY_STRING(message); + } + if (!record) { + record = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2019 "parser.php5.c" - break; - case 65: -// 526 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { + + zval *record = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(record); + zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); + if (Z_TYPE_P(record) != IS_NULL) { + ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2032 "parser.php5.c" - break; - case 68: -// 550 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { + + + + RETURN_MEMBER(this_ptr, "_record"); + } -// 2045 "parser.php5.c" - break; - case 69: -// 560 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2055 "parser.php5.c" - break; - case 70: -// 570 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *dependencyInjector = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &dependencyInjector); + + if (!dependencyInjector) { + ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(dependencyInjector); + } + + + if (!(zephir_is_true(dependencyInjector))) { + ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); + return; + } + ZEPHIR_MM_RESTORE(); + } -// 2065 "parser.php5.c" - break; - case 71: -// 574 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2076 "parser.php5.c" - break; - case 72: -// 584 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2086 "parser.php5.c" - break; - case 73: -// 594 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { + + zval *service_param = NULL; + zval *service = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &service_param); + + if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(service_param) == IS_STRING)) { + zephir_get_strval(service, service_param); + } else { + ZEPHIR_INIT_VAR(service); + ZVAL_EMPTY_STRING(service); + } + + + zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); + RETURN_THIS(); + } -// 2096 "parser.php5.c" - break; - case 74: -// 604 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { + + + + RETURN_MEMBER(this_ptr, "_service"); + } -// 2110 "parser.php5.c" - break; - case 75: -// 608 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { + + zval *rollbackPendent_param = NULL; + zend_bool rollbackPendent; + + zephir_fetch_params(0, 1, 0, &rollbackPendent_param); + + rollbackPendent = zephir_get_boolval(rollbackPendent_param); + + + if (rollbackPendent) { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_THISW(); + } -// 2124 "parser.php5.c" - break; - case 76: -// 618 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { + + + + RETURN_MEMBER(this_ptr, "_rollbackPendent"); + } -// 2134 "parser.php5.c" - break; - case 77: -// 628 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { + + zval *_0; + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); + } -// 2144 "parser.php5.c" - break; - case 78: -// 638 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { + + zval *_2$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); + if (zephir_is_true(_1$$3)) { + ZEPHIR_INIT_VAR(_2$$4); + zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$4, this_ptr); + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "rollbackPendent", 1); + zephir_array_fast_append(_2$$4, _3$$4); + ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 343, _2$$4); + zephir_check_call_status(); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(_4); + if (autoBegin) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); + zephir_check_call_status(); + RETURN_MM(); + } -// 2151 "parser.php5.c" - break; - case 79: -// 648 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { + + HashTable *_2$$5; + HashPosition _1$$5; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(transaction, _3$$5); + if (Z_TYPE_P(transaction) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_BOOL(_4$$7, 0); + ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); + zephir_check_call_status(); + RETURN_CCTOR(transaction); + } + } + } + } + ZEPHIR_INIT_NVAR(transaction); + object_init_ex(transaction, phalcon_mvc_model_transaction_ce); + _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_6); + if (autoBegin) { + ZVAL_BOOL(_6, 1); + } else { + ZVAL_BOOL(_6, 0); + } + ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 344, dependencyInjector, _6, _5); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 345, this_ptr); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); + RETURN_CCTOR(transaction); + } -// 2159 "parser.php5.c" - break; - case 80: -// 652 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { + + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2167 "parser.php5.c" - break; - case 81: -// 656 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2175 "parser.php5.c" - break; - case 82: -// 660 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { + + HashTable *_1$$3; + HashPosition _0$$3; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &collect); + + if (!collect) { + collect = ZEPHIR_GLOBAL(global_true); + } + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); + zephir_check_call_status(); + } + if (zephir_is_true(collect)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2183 "parser.php5.c" - break; - case 83: -// 664 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2191 "parser.php5.c" - break; - case 84: -// 668 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2200 "parser.php5.c" - break; - case 85: -// 672 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(newTransactions); + array_init(newTransactions); + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); + if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { + zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); + } else { + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + } + zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2208 "parser.php5.c" - break; - case 86: -// 676 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { + + HashTable *_2$$3; + HashPosition _1$$3; + zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_0$$3); + zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); + for ( + ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) + ) { + ZEPHIR_GET_HVALUE(_0$$3, _3$$3); + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2217 "parser.php5.c" - break; - case 87: -// 680 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); + + return SUCCESS; + } -// 2225 "parser.php5.c" - break; - case 88: -// 684 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); + + return SUCCESS; + } -// 2233 "parser.php5.c" - break; - case 89: -// 688 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 274); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2241 "parser.php5.c" - break; - case 90: -// 692 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); + + return SUCCESS; + } -// 2249 "parser.php5.c" - break; - case 91: -// 696 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { + + zval *_5$$7; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if (zephir_fast_in_array(value, domain TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4$$7); + ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_4$$7); + zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2257 "parser.php5.c" - break; - case 92: -// 700 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); + + return SUCCESS; + } -// 2265 "parser.php5.c" - break; - case 93: -// 704 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { + + zval *_8$$9; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(strict); + ZVAL_BOOL(strict, 0); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_4)) { + if (Z_TYPE_P(strict) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); + return; + } + ZEPHIR_INIT_VAR(_5$$7); + ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); + zephir_check_temp_parameter(_5$$7); + zephir_check_call_status(); + } + ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 346, value, domain, strict); + zephir_check_call_status(); + if (!(zephir_is_true(_6))) { + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_8$$9); + zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_7$$9); + zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_7$$9); + ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2273 "parser.php5.c" - break; - case 94: -// 708 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); + + return SUCCESS; + } -// 2282 "parser.php5.c" - break; - case 95: -// 712 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { + + zval *_6, *_12$$5; + zend_bool _5; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, (1048576 | 2097152)); + ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_2)) { + ZEPHIR_INIT_VAR(allowPrivate); + ZVAL_LONG(allowPrivate, 0); + } else { + ZEPHIR_INIT_NVAR(allowPrivate); + ZVAL_LONG(allowPrivate, 8388608); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_3)) { + ZEPHIR_INIT_VAR(allowReserved); + ZVAL_LONG(allowReserved, 0); + } else { + ZEPHIR_INIT_NVAR(allowReserved); + ZVAL_LONG(allowReserved, 4194304); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_NVAR(_1); + ZVAL_BOOL(_1, 0); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _5 = zephir_is_true(_4); + if (_5) { + _5 = ZEPHIR_IS_EMPTY(value); + } + if (_5) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(options); + zephir_create_array(options, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_6); + zephir_create_array(_6, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_VAR(_7); + zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); + ZEPHIR_INIT_VAR(_8); + zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); + zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_NVAR(_7); + ZVAL_LONG(&_7, 275); + ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); + zephir_check_call_status(); + if (!(zephir_is_true(_9))) { + ZEPHIR_INIT_VAR(_10$$5); + ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_11$$5); + ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_temp_parameter(_11$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_12$$5); + zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2291 "parser.php5.c" - break; - case 96: -// 716 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); + + return SUCCESS; + +} + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { + + zval *_4$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + if (!(zephir_is_numeric(value))) { + ZEPHIR_INIT_VAR(_3$$5); + ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field :field must be numeric", 1); + } + ZEPHIR_INIT_VAR(_4$$5); + zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$5); + ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2300 "parser.php5.c" - break; - case 97: -// 720 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); + + return SUCCESS; + } -// 2309 "parser.php5.c" - break; - case 98: -// 724 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { + + zval *_4$$4; + zend_bool _1, _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + _1 = Z_TYPE_P(value) == IS_NULL; + if (!(_1)) { + _2 = Z_TYPE_P(value) == IS_STRING; + if (_2) { + _2 = !(zephir_fast_strlen_ev(value)); + } + _1 = _2; + } + if (_1) { + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "':field' is required", 1); + } + ZEPHIR_INIT_VAR(_4$$4); + zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$4); + ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2318 "parser.php5.c" - break; - case 99: -// 728 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); + + return SUCCESS; + } -// 2327 "parser.php5.c" - break; - case 100: -// 732 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { + + zval *_6$$8; + zend_bool failed = 0, _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (!(zephir_is_true(_1))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + failed = 0; + ZEPHIR_INIT_VAR(matches); + ZVAL_NULL(matches); + ZEPHIR_INIT_NVAR(_0); + zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); + if (zephir_is_true(_0)) { + zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); + failed = !ZEPHIR_IS_EQUAL(_4$$6, value); + } else { + failed = 1; + } + if (failed == 1) { + ZEPHIR_INIT_VAR(_5$$8); + ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); + } + ZEPHIR_INIT_VAR(_6$$8); + zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$8); + ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2336 "parser.php5.c" - break; - case 101: -// 736 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); + + return SUCCESS; + } -// 2345 "parser.php5.c" - break; - case 102: -// 740 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { + + zval *_6$$9, *_11$$12; + zend_bool _1, _3; + zephir_fcall_cache_entry *_8 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _1 = !zephir_is_true(isSetMin); + if (_1) { + _1 = !zephir_is_true(isSetMax); + } + if (_1) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 347, value); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(length); + ZVAL_LONG(length, zephir_fast_strlen_ev(value)); + } + if (zephir_is_true(isSetMax)) { + ZEPHIR_INIT_VAR(_4$$8); + ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); + zephir_check_temp_parameter(_4$$8); + zephir_check_call_status(); + if (ZEPHIR_GT(length, maximum)) { + ZEPHIR_INIT_VAR(_5$$9); + ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); + } + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$9); + ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + if (zephir_is_true(isSetMin)) { + ZEPHIR_INIT_VAR(_9$$11); + ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); + zephir_check_temp_parameter(_9$$11); + zephir_check_call_status(); + if (ZEPHIR_LT(length, minimum)) { + ZEPHIR_INIT_VAR(_10$$12); + ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); + } + ZEPHIR_INIT_VAR(_11$$12); + zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$12); + ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + RETURN_MM_BOOL(1); + } -// 2354 "parser.php5.c" - break; - case 103: -// 744 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); + + return SUCCESS; + } -// 2363 "parser.php5.c" - break; - case 104: -// 748 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { + + HashTable *_2$$5, *_22$$16; + HashPosition _1$$5, _21$$16; + zend_class_entry *_33; + zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; + int ZEPHIR_LAST_CALL_STATUS, number = 0; + zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(bindTypes); + array_init(bindTypes); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_INIT_VAR(conditions); + array_init(conditions); + ZEPHIR_INIT_VAR(bindParams); + array_init(bindParams); + number = 0; + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(composeField, _3$$5); + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_4$$8); + object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_5$$8); + ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, composeField); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_SINIT_NVAR(_9$$6); + ZVAL_LONG(&_9$$6, number); + ZEPHIR_INIT_LNVAR(_10$$6); + ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); + zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); + ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); + number++; + } + } else { + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_13$$13); + object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_14$$13); + ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, field); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_15$$15); + object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_16$$15); + ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(_17$$11); + ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); + zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); + ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); + number++; + } + ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(_19, 2)) { + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); + zephir_check_call_status(); + zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) + ) { + ZEPHIR_GET_HVALUE(primaryField, _23$$16); + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_24$$20); + object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_25$$20); + ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); + zephir_check_call_status(); + zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(attributeField); + if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_26$$22); + object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_27$$22); + ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); + zephir_check_call_status(); + zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(attributeField, primaryField); + } + ZEPHIR_SINIT_NVAR(_28$$19); + ZVAL_LONG(&_28$$19, number); + ZEPHIR_INIT_LNVAR(_29$$19); + ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); + zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); + ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); + number++; + } + } + ZEPHIR_INIT_VAR(params); + array_init(params); + zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_0); + zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); + zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(className); + zephir_get_class(className, record, 0 TSRMLS_CC); + _33 = zephir_fetch_class(className TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); + zephir_check_call_status(); + if (!ZEPHIR_IS_LONG(_32, 0)) { + ZEPHIR_INIT_VAR(_34$$24); + ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(replacePairs); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_35$$25); + zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); + } + } else { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); + } + } + ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_34$$24); + ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2372 "parser.php5.c" - break; - case 105: -// 752 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); + + return SUCCESS; + } -// 2381 "parser.php5.c" - break; - case 106: -// 756 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 273); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, ":field does not have a valid url format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2390 "parser.php5.c" - break; - case 107: -// 760 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; + return SUCCESS; + } -// 2399 "parser.php5.c" - break; - case 108: -// 764 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { + + zval *_0; + zval *handler_param = NULL, *prefix_param = NULL; + zval *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2407 "parser.php5.c" - break; - case 109: -// 768 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { + + zval *_0; + zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; + zval *module = NULL, *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_array_fast_append(_0, module); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2415 "parser.php5.c" - break; - case 110: -// 772 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { + + zend_bool _5$$6; + HashTable *_3, *_9$$14, *_13$$16, *_17$$18; + HashPosition _2, _8$$14, _12$$16, _16$$18; + zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; + zval *uri = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &uri_param); + + if (!uri_param) { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } else { + if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(uri, uri_param); + } else { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } + } + + + if (!(!(!uri) && Z_STRLEN_P(uri))) { + ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(realUri, uri); + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); + return; + } + ZEPHIR_INIT_VAR(_1); + ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); + zephir_check_temp_parameter(_1); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(handlers); + zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(controllerSuffix); + zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); + zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HVALUE(scope, _4); + if (Z_TYPE_P(scope) != IS_ARRAY) { + continue; + } + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); + _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); + if (_5$$6) { + _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); + } + if (_5$$6) { + continue; + } + ZEPHIR_OBS_NVAR(handler); + zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); + if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { + ZEPHIR_INIT_NVAR(controllerName); + zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(namespaceName); + zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(controllerName, handler); + ZEPHIR_OBS_NVAR(namespaceName); + zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); + } + zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(sufixed); + ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); + if (Z_TYPE_P(namespaceName) != IS_NULL) { + ZEPHIR_INIT_LNVAR(_6$$11); + ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); + ZEPHIR_CPY_WRT(sufixed, _6$$11); + } + ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); + zephir_check_call_status(); + if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(annotations) == IS_ARRAY) { + zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); + for ( + ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) + ) { + ZEPHIR_GET_HVALUE(annotation, _10$$14); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); + zephir_check_call_status(); + } + } + } + ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(lowerControllerName); + zephir_uncamelize(lowerControllerName, controllerName, NULL ); + zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); + for ( + ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) + ) { + ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); + ZEPHIR_GET_HVALUE(collection, _14$$16); + if (Z_TYPE_P(collection) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS + ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) + ) { + ZEPHIR_GET_HVALUE(annotation, _18$$18); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); + zephir_check_call_status(); + } + } + } + } + } + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 348, realUri); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2423 "parser.php5.c" - break; - case 111: -// 776 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; + zval *handler = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &handler_param, &annotation); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + + + ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { + ZEPHIR_INIT_VAR(_2$$3); + ZVAL_LONG(_2$$3, 0); + ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2431 "parser.php5.c" - break; - case 112: -// 780 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { + + HashTable *_7$$22, *_11$$24; + HashPosition _6$$22, _10$$24; + zend_bool isRoute = 0, _14$$9, _5$$20; + zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; + zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { + zephir_get_strval(namespaceName, namespaceName_param); + } else { + ZEPHIR_INIT_VAR(namespaceName); + ZVAL_EMPTY_STRING(namespaceName); + } + if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { + zephir_get_strval(controller, controller_param); + } else { + ZEPHIR_INIT_VAR(controller); + ZVAL_EMPTY_STRING(controller); + } + if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(action_param) == IS_STRING)) { + zephir_get_strval(action, action_param); + } else { + ZEPHIR_INIT_VAR(action); + ZVAL_EMPTY_STRING(action); + } + + + isRoute = 0; + ZEPHIR_INIT_VAR(methods); + ZVAL_NULL(methods); + ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); + zephir_check_call_status(); + do { + if (ZEPHIR_IS_STRING(name, "Route")) { + isRoute = 1; + break; + } + if (ZEPHIR_IS_STRING(name, "Get")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "GET", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Post")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "POST", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Put")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "PUT", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Delete")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "DELETE", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Options")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "OPTIONS", 1); + break; + } + } while(0); + + if (isRoute == 1) { + ZEPHIR_INIT_VAR(_0$$9); + _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); + ZEPHIR_SINIT_VAR(_2$$9); + ZVAL_STRING(&_2$$9, "", 0); + zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); + ZEPHIR_INIT_VAR(actionName); + zephir_fast_strtolower(actionName, _0$$9); + ZEPHIR_OBS_VAR(routePrefix); + zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_3$$9); + ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(paths) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(paths); + array_init(paths); + } + if (!(ZEPHIR_IS_EMPTY(module))) { + zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); + } + if (!(ZEPHIR_IS_EMPTY(namespaceName))) { + zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_LONG(_3$$9, 0); + ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(value) != IS_NULL) { + if (!ZEPHIR_IS_STRING(value, "/")) { + ZEPHIR_INIT_VAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, value); + } else { + if (Z_TYPE_P(routePrefix) != IS_NULL) { + ZEPHIR_CPY_WRT(uri, routePrefix); + } else { + ZEPHIR_CPY_WRT(uri, value); + } + } + } else { + ZEPHIR_INIT_NVAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); + } + ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); + zephir_check_call_status(); + if (Z_TYPE_P(methods) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(_4$$20); + ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); + zephir_check_temp_parameter(_4$$20); + zephir_check_call_status(); + _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; + if (!(_5$$20)) { + _5$$20 = Z_TYPE_P(methods) == IS_STRING; + } + if (_5$$20) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); + for ( + ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS + ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) + ) { + ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); + ZEPHIR_GET_HVALUE(convert, _8$$22); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); + for ( + ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS + ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) + ) { + ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); + ZEPHIR_GET_HVALUE(convert, _12$$24); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; + if (!(_14$$9)) { + _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; + } + if (_14$$9) { + ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(routeName) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); + zephir_check_call_status(); + } + RETURN_MM_BOOL(1); + } + ZEPHIR_MM_RESTORE(); + } -// 2439 "parser.php5.c" - break; - case 113: -// 784 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { + + zval *controllerSuffix_param = NULL; + zval *controllerSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &controllerSuffix_param); + + if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { + zephir_get_strval(controllerSuffix, controllerSuffix_param); + } else { + ZEPHIR_INIT_VAR(controllerSuffix); + ZVAL_EMPTY_STRING(controllerSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2447 "parser.php5.c" - break; - case 114: -// 788 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { + + zval *actionSuffix_param = NULL; + zval *actionSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &actionSuffix_param); + + if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { + zephir_get_strval(actionSuffix, actionSuffix_param); + } else { + ZEPHIR_INIT_VAR(actionSuffix); + ZVAL_EMPTY_STRING(actionSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2455 "parser.php5.c" - break; - case 115: -// 792 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { + + + + RETURN_MEMBER(this_ptr, "_handlers"); + } -// 2463 "parser.php5.c" - break; - case 117: -// 800 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { + + zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; + + ZEPHIR_MM_GROW(); + + { + zval *this_ptr = NULL; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); + if (Z_TYPE_P(_0) == IS_NULL) { + ZEPHIR_INIT_VAR(_1$$3); + array_init(_1$$3); + zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); + } + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); + if (Z_TYPE_P(_2) == IS_NULL) { + ZEPHIR_INIT_VAR(_3$$4); + array_init(_3$$4); + zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); + } + _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); + if (Z_TYPE_P(_4) == IS_NULL) { + ZEPHIR_INIT_VAR(_5$$5); + array_init(_5$$5); + zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJVAL_P(this_ptr); + } + } -// 2471 "parser.php5.c" - break; - case 118: -// 804 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2480 "parser.php5.c" - break; - case 119: -// 808 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); + return SUCCESS; + } -// 2488 "parser.php5.c" - break; - case 120: -// 812 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *paths = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + _0 = Z_TYPE_P(paths) == IS_ARRAY; + if (!(_0)) { + _0 = Z_TYPE_P(paths) == IS_STRING; + } + if (_0) { + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + } + if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2496 "parser.php5.c" - break; - case 121: -// 816 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + zephir_get_strval(hostname, hostname_param); + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 2504 "parser.php5.c" - break; - case 122: -// 820 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 2513 "parser.php5.c" - break; - case 123: -// 824 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + zephir_get_strval(prefix, prefix_param); + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2522 "parser.php5.c" - break; - case 124: -// 828 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { + + + + RETURN_MEMBER(this_ptr, "_prefix"); + } -// 2531 "parser.php5.c" - break; - case 125: -// 832 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { + + zval *beforeMatch; + + zephir_fetch_params(0, 1, 0, &beforeMatch); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); + RETURN_THISW(); + } -// 2540 "parser.php5.c" - break; - case 126: -// 836 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 2549 "parser.php5.c" - break; - case 128: -// 844 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { + + zval *paths; + + zephir_fetch_params(0, 1, 0, &paths); + + + + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + RETURN_THISW(); + } -// 2558 "parser.php5.c" - break; - case 129: -// 848 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 2568 "parser.php5.c" - break; - case 130: -// 852 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { + + + + RETURN_MEMBER(this_ptr, "_routes"); + } -// 2578 "parser.php5.c" - break; - case 131: -// 856 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); + zephir_check_call_status(); + RETURN_MM(); + } -// 2588 "parser.php5.c" - break; - case 136: - case 144: -// 894 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2597 "parser.php5.c" - break; - case 137: - case 143: -// 898 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2605 "parser.php5.c" - break; - case 139: -// 912 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2614 "parser.php5.c" - break; - case 140: -// 916 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2623 "parser.php5.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php5.lemon" +static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - { + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + zval *_0; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + ZEPHIR_INIT_VAR(_0); + array_init(_0); + zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); - } +} - } else { +static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; + zval *pattern = NULL; - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } - } - } + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } - smart_str_0(&error_str); -#if PHP_VERSION_ID < 70000 - if (error_str.len) { - status->syntax_error = error_str.c; - status->syntax_error_len = error_str.len; + ZEPHIR_OBS_VAR(defaultPaths); + zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); + if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); + zephir_check_call_status(); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(processedPaths, paths); } -#else - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); + if (Z_TYPE_P(processedPaths) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedPaths); + zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); } -#endif + } else { + ZEPHIR_CPY_WRT(mergedPaths, paths); } + ZEPHIR_INIT_VAR(route); + object_init_ex(route, phalcon_mvc_router_route_ce); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_2); + ZEPHIR_CONCAT_VV(_2, _1, pattern); + ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); + ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 349, this_ptr); + zephir_check_call_status(); + RETURN_CCTOR(route); - status->status = PHVOLT_PARSING_FAILED; - -// 2774 "parser.php5.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } +#ifdef HAVE_CONFIG_H #endif - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); + + return SUCCESS; + } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php7.lemon" +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval vv146; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; -} -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; + + +#ifdef HAVE_CONFIG_H #endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); + return SUCCESS; + } -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; +static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + ZEPHIR_OBS_VAR(uniqueId); + zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); + if (Z_TYPE_P(uniqueId) == IS_NULL) { + ZEPHIR_INIT_NVAR(uniqueId); + ZVAL_LONG(uniqueId, 0); + } + ZEPHIR_CPY_WRT(routeId, uniqueId); + zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 146 "parser.php7.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); +static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { + + zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { + ZEPHIR_INIT_VAR(idPattern); + ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); + if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { + ZEPHIR_INIT_VAR(_0$$4); + ZEPHIR_SINIT_VAR(_1$$4); + ZVAL_STRING(&_1$$4, "/:module", 0); + zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _0$$4); + } + if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { + ZEPHIR_INIT_VAR(_2$$5); + ZEPHIR_SINIT_VAR(_3$$5); + ZVAL_STRING(&_3$$5, "/:controller", 0); + zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _2$$5); + } + if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_SINIT_VAR(_5$$6); + ZVAL_STRING(&_5$$6, "/:namespace", 0); + zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _4$$6); + } + if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_SINIT_VAR(_7$$7); + ZVAL_STRING(&_7$$7, "/:action", 0); + zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _6$$7); + } + if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { + ZEPHIR_INIT_VAR(_8$$8); + ZEPHIR_SINIT_VAR(_9$$8); + ZVAL_STRING(&_9$$8, "/:params", 0); + ZEPHIR_SINIT_VAR(_10$$8); + ZVAL_STRING(&_10$$8, "(/.*)*", 0); + zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); + zephir_get_strval(pattern, _8$$8); + } + if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_SINIT_VAR(_12$$9); + ZVAL_STRING(&_12$$9, "/:int", 0); + ZEPHIR_SINIT_VAR(_13$$9); + ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); + zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); + zephir_get_strval(pattern, _11$$9); } - efree((vvpminor->vv0)); } -} -// 1133 "parser.php7.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 163 "parser.php7.lemon" -{ - zval_ptr_dtor(&(vvpminor->vv146)); -} -// 1173 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } + if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + RETURN_CTOR(pattern); + } -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; +static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; } -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); +static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { + + long _0, _5$$11, _26$$19; + zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; + int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; + char ch = 0, prevCh; + zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; + zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + prevCh = '\0'; + bracketCount = 0; + parenthesesCount = 0; + foundPattern = 0; + intermediate = 0; + numberMatches = 0; + if (zephir_fast_strlen_ev(pattern) <= 0) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(matches); + array_init(matches); + ZEPHIR_INIT_VAR(route); + ZVAL_EMPTY_STRING(route); + for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { + cursor = _0; + ch = ZEPHIR_STRING_OFFSET(pattern, _0); + if (parenthesesCount == 0) { + if (ch == '{') { + if (bracketCount == 0) { + marker = (cursor + 1); + intermediate = 0; + notValid = 0; + } + bracketCount++; + } else { + if (ch == '}') { + bracketCount--; + if (intermediate > 0) { + if (bracketCount == 0) { + numberMatches++; + ZEPHIR_INIT_NVAR(variable); + ZVAL_EMPTY_STRING(variable); + ZEPHIR_INIT_NVAR(regexp); + ZVAL_EMPTY_STRING(regexp); + ZEPHIR_SINIT_NVAR(_1$$11); + ZVAL_LONG(&_1$$11, marker); + ZEPHIR_SINIT_NVAR(_2$$11); + ZVAL_LONG(&_2$$11, (cursor - marker)); + ZEPHIR_INIT_NVAR(_3$$11); + zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); + zephir_get_strval(_4$$11, _3$$11); + ZEPHIR_CPY_WRT(item, _4$$11); + for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { + cursorVar = _5$$11; + ch = ZEPHIR_STRING_OFFSET(item, _5$$11); + if (ch == '\0') { + break; + } + _6$$12 = cursorVar == 0; + if (_6$$12) { + _7$$12 = ch >= 'a'; + if (_7$$12) { + _7$$12 = ch <= 'z'; + } + _8$$12 = _7$$12; + if (!(_8$$12)) { + _9$$12 = ch >= 'A'; + if (_9$$12) { + _9$$12 = ch <= 'Z'; + } + _8$$12 = _9$$12; + } + _6$$12 = !(_8$$12); + } + if (_6$$12) { + notValid = 1; + break; + } + _10$$12 = ch >= 'a'; + if (_10$$12) { + _10$$12 = ch <= 'z'; + } + _11$$12 = _10$$12; + if (!(_11$$12)) { + _12$$12 = ch >= 'A'; + if (_12$$12) { + _12$$12 = ch <= 'Z'; + } + _11$$12 = _12$$12; + } + _13$$12 = _11$$12; + if (!(_13$$12)) { + _14$$12 = ch >= '0'; + if (_14$$12) { + _14$$12 = ch <= '9'; + } + _13$$12 = _14$$12; + } + _15$$12 = _13$$12; + if (!(_15$$12)) { + _15$$12 = ch == '-'; + } + _16$$12 = _15$$12; + if (!(_16$$12)) { + _16$$12 = ch == '_'; + } + _17$$12 = _16$$12; + if (!(_17$$12)) { + _17$$12 = ch == ':'; + } + if (_17$$12) { + if (ch == ':') { + ZEPHIR_SINIT_NVAR(_18$$16); + ZVAL_LONG(&_18$$16, 0); + ZEPHIR_SINIT_NVAR(_19$$16); + ZVAL_LONG(&_19$$16, cursorVar); + ZEPHIR_INIT_NVAR(_20$$16); + zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); + zephir_get_strval(_21$$16, _20$$16); + ZEPHIR_CPY_WRT(variable, _21$$16); + ZEPHIR_SINIT_NVAR(_22$$16); + ZVAL_LONG(&_22$$16, (cursorVar + 1)); + ZEPHIR_INIT_NVAR(_23$$16); + zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_get_strval(_24$$16, _23$$16); + ZEPHIR_CPY_WRT(regexp, _24$$16); + break; + } + } else { + notValid = 1; + break; + } + } + if (!(notValid)) { + tmp = numberMatches; + _25$$18 = zephir_is_true(variable); + if (_25$$18) { + _25$$18 = zephir_is_true(regexp); + } + if (_25$$18) { + foundPattern = 0; + for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { + ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); + if (ch == '\0') { + break; + } + if (!(foundPattern)) { + if (ch == '(') { + foundPattern = 1; + } + } else { + if (ch == ')') { + foundPattern = 2; + break; + } + } + } + if (foundPattern != 2) { + ZEPHIR_INIT_LNVAR(_27$$26); + ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); + zephir_concat_self(&route, _27$$26 TSRMLS_CC); + } else { + zephir_concat_self(&route, regexp TSRMLS_CC); + } + ZEPHIR_INIT_NVAR(_28$$19); + ZVAL_LONG(_28$$19, tmp); + zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_29$$28); + ZVAL_LONG(_29$$28, tmp); + zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_INIT_LNVAR(_30$$29); + ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); + zephir_concat_self(&route, _30$$29 TSRMLS_CC); + } + continue; + } + } + } + } + } + if (bracketCount == 0) { + if (ch == '(') { + parenthesesCount++; + } else { + if (ch == ')') { + parenthesesCount--; + if (parenthesesCount == 0) { + numberMatches++; + } + } + } + } + if (bracketCount > 0) { + intermediate++; + } else { + _31$$36 = parenthesesCount == 0; + if (_31$$36) { + _31$$36 = prevCh != '\\'; + } + if (_31$$36) { + _32$$37 = ch == '.'; + if (!(_32$$37)) { + _32$$37 = ch == '+'; + } + _33$$37 = _32$$37; + if (!(_33$$37)) { + _33$$37 = ch == '|'; + } + _34$$37 = _33$$37; + if (!(_34$$37)) { + _34$$37 = ch == '#'; + } + if (_34$$37) { + zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); + } + } + zephir_concat_self_char(&route, ch TSRMLS_CC); + prevCh = ch; + } + } + zephir_create_array(return_value, 2, 0 TSRMLS_CC); + zephir_array_fast_append(return_value, route); + zephir_array_fast_append(return_value, matches); + RETURN_MM(); + } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); + zephir_check_call_status(); + if (!(zephir_start_with_str(pattern, SL("#")))) { + if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { + ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(pcrePattern); + zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_VAR(_0$$4); + zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); + zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); + ZEPHIR_CPY_WRT(routePaths, _0$$4); + } else { + ZEPHIR_CPY_WRT(pcrePattern, pattern); + } + ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(compiledPattern, pattern); + } + zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { + + int _0$$4; + zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(paths) != IS_NULL) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_INIT_VAR(moduleName); + ZVAL_NULL(moduleName); + ZEPHIR_INIT_VAR(controllerName); + ZVAL_NULL(controllerName); + ZEPHIR_INIT_VAR(actionName); + ZVAL_NULL(actionName); + ZEPHIR_INIT_VAR(parts); + zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); + do { + _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); + if (_0$$4 == 3) { + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); + break; + } + if (_0$$4 == 2) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); + break; + } + if (_0$$4 == 1) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); + break; + } + } while(0); + + ZEPHIR_INIT_VAR(routePaths); + array_init(routePaths); + if (Z_TYPE_P(moduleName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(controllerName) != IS_NULL) { + if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { + ZEPHIR_INIT_VAR(realClassName); + zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(namespaceName); + zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); + if (zephir_is_true(namespaceName)) { + zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(realClassName, controllerName); + } + ZEPHIR_INIT_VAR(_1$$9); + zephir_uncamelize(_1$$9, realClassName, NULL ); + zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(actionName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(routePaths, paths); + } + } else { + ZEPHIR_INIT_NVAR(routePaths); + array_init(routePaths); + } + if (Z_TYPE_P(routePaths) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); + return; + } + RETURN_CCTOR(routePaths); + } -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif +static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { + + + + RETURN_MEMBER(this_ptr, "_name"); + } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *name_param = NULL; + zval *name = NULL; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 155 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); -} -// 1542 "parser.php7.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 159 "parser.php7.lemon" -{ - vvgotominor.vv146 = vvmsp[0].minor.vv146; -} -// 1570 "parser.php7.c" - break; - case 2: -// 167 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); -} -// 1577 "parser.php7.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 171 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); -} -// 1588 "parser.php7.c" - break; - case 24: -// 263 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1601 "parser.php7.c" - break; - case 25: -// 267 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1614 "parser.php7.c" - break; - case 26: -// 271 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1630 "parser.php7.c" - break; - case 27: -// 275 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1646 "parser.php7.c" - break; - case 28: -// 279 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1662 "parser.php7.c" - break; - case 29: -// 287 "parser.php7.lemon" -{ - phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1672 "parser.php7.c" - break; - case 30: -// 295 "parser.php7.lemon" -{ - phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); } -// 1682 "parser.php7.c" - break; - case 31: -// 303 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1696 "parser.php7.c" - break; - case 32: -// 307 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 1711 "parser.php7.c" - break; - case 33: -// 311 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1726 "parser.php7.c" - break; - case 34: -// 315 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { + + + + RETURN_MEMBER(this_ptr, "_match"); + } -// 1742 "parser.php7.c" - break; - case 35: -// 323 "parser.php7.lemon" -{ - phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { + + + + RETURN_MEMBER(this_ptr, "_id"); + } -// 1752 "parser.php7.c" - break; - case 36: - case 48: - case 134: - case 141: -// 331 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); - vv_destructor(2,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { + + + + RETURN_MEMBER(this_ptr, "_pattern"); + } -// 1763 "parser.php7.c" - break; - case 38: -// 343 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { + + + + RETURN_MEMBER(this_ptr, "_compiledPattern"); + } -// 1771 "parser.php7.c" - break; - case 39: -// 347 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 1779 "parser.php7.c" - break; - case 40: -// 351 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { + + HashTable *_2; + HashPosition _1; + zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(reversed); + array_init(reversed); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); + zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HMKEY(path, _2, _1); + ZEPHIR_GET_HVALUE(position, _3); + zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); + } + RETURN_CCTOR(reversed); + } -// 1787 "parser.php7.c" - break; - case 41: -// 355 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); + } -// 1795 "parser.php7.c" - break; - case 42: -// 359 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { + + + + RETURN_MEMBER(this_ptr, "_methods"); + } -// 1803 "parser.php7.c" - break; - case 43: - case 67: - case 133: - case 145: -// 363 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { + zephir_get_strval(hostname, hostname_param); + } else { + ZEPHIR_INIT_VAR(hostname); + ZVAL_EMPTY_STRING(hostname); + } + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 1813 "parser.php7.c" - break; - case 44: - case 127: -// 367 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 1823 "parser.php7.c" - break; - case 45: - case 116: -// 371 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { + + zval *group; + + zephir_fetch_params(0, 1, 0, &group); + + + + zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); + RETURN_THISW(); + } -// 1832 "parser.php7.c" - break; - case 46: -// 379 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { + + + + RETURN_MEMBER(this_ptr, "_group"); + } -// 1847 "parser.php7.c" - break; - case 47: -// 383 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { + + zval *name_param = NULL, *converter; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &converter); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); + RETURN_THIS(); + } -// 1862 "parser.php7.c" - break; - case 50: -// 403 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { + + + + RETURN_MEMBER(this_ptr, "_converters"); + } -// 1869 "parser.php7.c" - break; - case 51: -// 407 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { + + + + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } -// 1877 "parser.php7.c" - break; - case 52: - case 66: - case 132: - case 146: -// 411 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); + + return SUCCESS; + } -// 1887 "parser.php7.c" - break; - case 53: - case 147: -// 415 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1895 "parser.php7.c" - break; - case 54: - case 148: -// 419 "parser.php7.lemon" + + + + + +#ifdef HAVE_CONFIG_H +#endif + + + +#if PHP_VERSION_ID < 70000 +#else +#endif + + +static void phalcon_get_uri(zval *return_value, zval *path) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + int i, found = 0, mark = 0; + char *cursor, *str, ch; + + if (Z_TYPE_P(path) != IS_STRING) { + RETURN_EMPTY_STRING(); + } + + if (Z_STRLEN_P(path) > 0) { + cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; + for (i = Z_STRLEN_P(path); i > 0; i--) { + ch = *cursor; + if (ch == '/' || ch == '\\') { + found++; + if (found == 1) { + mark = i - 1; + } else { + str = emalloc(mark - i + 1); + memcpy(str, Z_STRVAL_P(path) + i, mark - i); + str[mark - i] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, str, mark - i, 0); +#else + ZVAL_STRINGL(return_value, str, mark - i); +#endif + return; + } + } + cursor--; + } + } + + RETURN_EMPTY_STRING(); } -// 1903 "parser.php7.c" - break; - case 55: - case 149: -// 423 "parser.php7.lemon" + +zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + unsigned int length = 0, variable_length, ch, j; + char *item = NULL, *cursor_var, *variable = NULL; + int not_valid = 0; +#if PHP_VERSION_ID < 70000 + int result = FAILURE; + zval **zv, **tmp; +#else + zval *zv, *tmp; +#endif + + if (named) { + length = cursor - marker - 1; + item = estrndup(marker + 1, length); + cursor_var = item; + marker = item; + for (j = 0; j < length; j++) { + ch = *cursor_var; + if (ch == '\0') { + not_valid = 1; + break; + } + if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ + not_valid = 1; + break; + } + if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { + if (ch == ':') { + variable_length = cursor_var - marker; + variable = estrndup(marker, variable_length); + break; + } + } else { + not_valid = 1; + break; + } + cursor_var++; + } + } + + if (!not_valid) { + + if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { + if (named) { + if (variable) { + efree(item); + item = variable; + length = variable_length; + } +#if PHP_VERSION_ID < 70000 + if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { + efree(item); + (*position)++; + return *zv; + } + } +#else + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { + if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { + efree(item); + (*position)++; + return zv; + } + } +#endif + } else { +#if PHP_VERSION_ID < 70000 + if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { + if (Z_TYPE_PP(zv) == IS_STRING) { + if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { + (*position)++; + return *tmp; + } + } + } + } +#else + if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { + if (Z_TYPE_P(zv) == IS_STRING) { + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { + (*position)++; + return tmp; + } + } + } + } +#endif + } + } + + (*position)++; + } + + if (item) { + efree(item); + } + + return NULL; } -// 1912 "parser.php7.c" - break; - case 56: - case 150: -// 427 "parser.php7.lemon" + +static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + char *cursor, *marker = NULL; + unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; + unsigned char ch; + smart_str route_str = {0}; + ulong position = 1; + int i; + zval *replace, replace_copy; + int use_copy, looking_placeholder = 0; + + if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { + ZVAL_NULL(return_value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); + return; + } + + if (Z_STRLEN_P(pattern) <= 0) { + ZVAL_FALSE(return_value); + return; + } + + cursor = Z_STRVAL_P(pattern); + if (*cursor == '/') { + ++cursor; + i = 1; + } + else { + i = 0; + } + + if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); +#else + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); +#endif + return; + } + + for (; i < Z_STRLEN_P(pattern); ++i) { + + ch = *cursor; + if (ch == '\0') { + break; + } + + if (parentheses_count == 0 && !looking_placeholder) { + if (ch == '{') { + if (bracket_count == 0) { + marker = cursor; + intermediate = 0; + } + bracket_count++; + } else { + if (ch == '}') { + bracket_count--; + if (intermediate > 0) { + if (bracket_count == 0) { + replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && !looking_placeholder) { + if (ch == '(') { + if (parentheses_count == 0) { + marker = cursor; + intermediate = 0; + } + parentheses_count++; + } else { + if (ch == ')') { + parentheses_count--; + if (intermediate > 0) { + if (parentheses_count == 0) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && parentheses_count == 0) { + if (looking_placeholder) { + if (intermediate > 0) { + if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + looking_placeholder = 0; + continue; + } + } + } else { + if (ch == ':') { + looking_placeholder = 1; + marker = cursor; + intermediate = 0; + } + } + } + + if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { + intermediate++; + } else { + smart_str_appendc(&route_str, ch); + } + + cursor++; + } + smart_str_0(&route_str); + +#if PHP_VERSION_ID < 70000 + if (route_str.len) { + RETURN_STRINGL(route_str.c, route_str.len, 0); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#else + if (route_str.s) { + RETURN_STR(route_str.s); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#endif } -// 1921 "parser.php7.c" - break; - case 57: - case 151: -// 431 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1930 "parser.php7.c" - break; - case 58: -// 439 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1945 "parser.php7.c" - break; - case 59: -// 443 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1960 "parser.php7.c" - break; - case 60: -// 451 "parser.php7.lemon" -{ - phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); + return SUCCESS; + } -// 1969 "parser.php7.c" - break; - case 61: -// 459 "parser.php7.lemon" -{ - phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { + + zval *view, *dependencyInjector = NULL; + + zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); + + if (!dependencyInjector) { + dependencyInjector = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 1978 "parser.php7.c" - break; - case 62: -// 467 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { + + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1991 "parser.php7.c" - break; - case 63: -// 471 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *_0; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); + zephir_check_call_status(); + RETURN_MM(); + } -// 2004 "parser.php7.c" - break; - case 64: -// 479 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { + + + + RETURN_MEMBER(this_ptr, "_view"); + } -// 2017 "parser.php7.c" - break; - case 65: -// 483 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); + + return SUCCESS; + } -// 2030 "parser.php7.c" - break; - case 68: -// 503 "parser.php7.lemon" -{ - phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2043 "parser.php7.c" - break; - case 69: -// 511 "parser.php7.lemon" -{ - phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); + return SUCCESS; + } -// 2053 "parser.php7.c" - break; - case 70: -// 519 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { + + + + RETURN_MEMBER(this_ptr, "_registeredEngines"); + } -// 2063 "parser.php7.c" - break; - case 71: -// 523 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &options_param); + + if (!options_param) { + ZEPHIR_INIT_VAR(options); + array_init(options); + } else { + zephir_get_arrval(options, options_param); + } + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2074 "parser.php7.c" - break; - case 72: -// 531 "parser.php7.lemon" -{ - phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { + + zval *viewsDir_param = NULL; + zval *viewsDir = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewsDir_param); + + if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { + zephir_get_strval(viewsDir, viewsDir_param); + } else { + ZEPHIR_INIT_VAR(viewsDir); + ZVAL_EMPTY_STRING(viewsDir); + } + + + zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2084 "parser.php7.c" - break; - case 73: -// 539 "parser.php7.lemon" -{ - phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { + + + + RETURN_MEMBER(this_ptr, "_viewsDir"); + } -// 2094 "parser.php7.c" - break; - case 74: -// 547 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { + + zval *engines_param = NULL; + zval *engines = NULL; + + zephir_fetch_params(0, 1, 0, &engines_param); + + engines = engines_param; + + + zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); + } -// 2108 "parser.php7.c" - break; - case 75: -// 551 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { + + HashTable *_2$$5; + HashPosition _1$$5; + zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(engines); + array_init(engines); + ZEPHIR_OBS_VAR(registeredEngines); + zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); + if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); + zephir_check_call_status(); + zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); + return; + } + ZEPHIR_INIT_VAR(arguments); + zephir_create_array(arguments, 2, 0 TSRMLS_CC); + zephir_array_fast_append(arguments, this_ptr); + zephir_array_fast_append(arguments, dependencyInjector); + zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(engineService, _3$$5); + if (Z_TYPE_P(engineService) == IS_OBJECT) { + if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_NVAR(engineObject); + ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(engineObject, engineService); + } + } else { + if (Z_TYPE_P(engineService) == IS_STRING) { + ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_5$$13); + object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_LNVAR(_6$$13); + ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); + ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); + } + } + zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + } + RETURN_CCTOR(engines); + } -// 2122 "parser.php7.c" - break; - case 76: -// 559 "parser.php7.lemon" -{ - phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { + + HashTable *_4; + HashPosition _3; + zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; + zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + + + ZEPHIR_OBS_VAR(eventsManager); + zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { + RETURN_MM_NULL(); + } + } + notExists = 1; + mustClean = 1; + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(viewsDirPath); + ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); + ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); + for ( + ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS + ; zephir_hash_move_forward_ex(_4, &_3) + ) { + ZEPHIR_GET_HMKEY(extension, _4, _3); + ZEPHIR_GET_HVALUE(engine, _5); + ZEPHIR_INIT_LNVAR(_6$$6); + ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); + if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); + } else { + _7$$8 = zephir_is_true(extension); + if (_7$$8) { + ZEPHIR_SINIT_NVAR(_8$$8); + ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); + ZEPHIR_INIT_NVAR(_9$$8); + zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); + _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); + } + _10$$8 = _7$$8; + if (_10$$8) { + _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); + } + if (_10$$8) { + ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); + } else { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZVAL_STRING(viewEnginePath, "", 1); + } + } + if (zephir_is_true(viewEnginePath)) { + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_12$$12); + ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); + zephir_check_temp_parameter(_12$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { + continue; + } + } + ZEPHIR_INIT_NVAR(_14$$11); + if (mustClean) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); + zephir_check_call_status(); + notExists = 0; + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_15$$14); + ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); + zephir_check_temp_parameter(_15$$14); + zephir_check_call_status(); + } + break; + } + } + if (notExists == 1) { + ZEPHIR_INIT_VAR(_17$$15); + object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_18$$15); + ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); + ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_19$$16); + ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); + zephir_check_temp_parameter(_19$$16); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2132 "parser.php7.c" - break; - case 77: -// 567 "parser.php7.lemon" -{ - phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { + + zend_bool _3$$12; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { + ZEPHIR_INIT_VAR(key); + ZVAL_NULL(key); + ZEPHIR_INIT_VAR(lifetime); + ZVAL_NULL(lifetime); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(key); + zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); + } + if (Z_TYPE_P(key) == IS_NULL) { + ZEPHIR_INIT_NVAR(key); + zephir_md5(key, path); + } + ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); + zephir_check_call_status(); + if (Z_TYPE_P(content) != IS_NULL) { + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_CCTOR(content); + } + } + } + ZEPHIR_INIT_VAR(_1); + zephir_create_symbol_table(TSRMLS_C); + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(params) == IS_ARRAY) { + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + } else { + ZEPHIR_CPY_WRT(mergedParams, viewParams); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, path, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_2$$12); + if (_3$$12) { + ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_4$$12); + } + if (_3$$12) { + ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + RETURN_MM_MEMBER(this_ptr, "_content"); + +} + +static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_INIT_VAR(_0$$3); + zephir_create_symbol_table(TSRMLS_C); + + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, partialPath, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); + zend_print_zval(_1, 0); + ZEPHIR_MM_RESTORE(); + } -// 2142 "parser.php7.c" - break; - case 78: -// 575 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &options_param); + + zephir_get_arrval(options, options_param); + + + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + RETURN_THIS(); + } -// 2149 "parser.php7.c" - break; - case 79: -// 583 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { + + + + RETURN_MEMBER(this_ptr, "_cacheOptions"); + } -// 2157 "parser.php7.c" - break; - case 80: -// 587 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { + + zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); + return; + } + ZEPHIR_INIT_VAR(cacheService); + ZVAL_STRING(cacheService, "viewCache", 1); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + if (zephir_array_isset_string(cacheOptions, SS("service"))) { + ZEPHIR_OBS_NVAR(cacheService); + zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); + } + } + ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(viewCache, _0); + if (Z_TYPE_P(viewCache) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); + return; + } + RETURN_CCTOR(viewCache); + } -// 2165 "parser.php7.c" - break; - case 81: -// 591 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { + + zend_bool _1; + zval *_0, *_2, *_3$$3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = zephir_is_true(_0); + if (_1) { + ZEPHIR_OBS_VAR(_2); + zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = Z_TYPE_P(_2) != IS_OBJECT; + } + if (_1) { + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); + } + RETURN_MM_MEMBER(this_ptr, "_cache"); + } -// 2173 "parser.php7.c" - break; - case 82: -// 595 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { + + zval *options = NULL; + + zephir_fetch_params(0, 0, 1, &options); + + if (!options) { + options = ZEPHIR_GLOBAL(global_true); + } + + + if (Z_TYPE_P(options) == IS_ARRAY) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + } else { + if (zephir_is_true(options)) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } else { + if (0) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + } + RETURN_THISW(); + } -// 2181 "parser.php7.c" - break; - case 83: -// 599 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2189 "parser.php7.c" - break; - case 84: -// 603 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { + + zend_bool merge, _0; + zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; + zval *params = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); + + params = params_param; + if (!merge_param) { + merge = 1; + } else { + merge = zephir_get_boolval(merge_param); + } + + + _0 = merge; + if (_0) { + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); + _0 = Z_TYPE_P(_1) == IS_ARRAY; + } + if (_0) { + ZEPHIR_INIT_VAR(_2$$3); + _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); + } + RETURN_THIS(); + } -// 2198 "parser.php7.c" - break; - case 85: -// 607 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2206 "parser.php7.c" - break; - case 86: -// 611 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2215 "parser.php7.c" - break; - case 87: -// 615 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { + + + + RETURN_MEMBER(this_ptr, "_viewParams"); + } -// 2223 "parser.php7.c" - break; - case 88: -// 619 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { + + zval *content_param = NULL; + zval *content = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &content_param); + + if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(content_param) == IS_STRING)) { + zephir_get_strval(content, content_param); + } else { + ZEPHIR_INIT_VAR(content); + ZVAL_EMPTY_STRING(content); + } + + + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_THIS(); + } -// 2231 "parser.php7.c" - break; - case 89: -// 623 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { + + + + RETURN_MEMBER(this_ptr, "_content"); + } -// 2239 "parser.php7.c" - break; - case 90: -// 627 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { + + + + RETURN_MEMBER(this_ptr, "_activeRenderPath"); + } -// 2247 "parser.php7.c" - break; - case 91: -// 631 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2255 "parser.php7.c" - break; - case 92: -// 635 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2263 "parser.php7.c" - break; - case 93: -// 639 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); + + return SUCCESS; + } -// 2271 "parser.php7.c" - break; - case 94: -// 643 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean == 1) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean == 1) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2280 "parser.php7.c" - break; - case 95: -// 647 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2289 "parser.php7.c" - break; - case 96: -// 651 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2298 "parser.php7.c" - break; - case 97: -// 655 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2307 "parser.php7.c" - break; - case 98: -// 659 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { + + zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(compiler); + zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); + if (Z_TYPE_P(compiler) != IS_OBJECT) { + ZEPHIR_INIT_NVAR(compiler); + object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 354, _0$$3); + zephir_check_call_status(); + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); + if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 355, dependencyInjector); + zephir_check_call_status(); + } + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 356, options); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); + } + RETURN_CCTOR(compiler); + } -// 2316 "parser.php7.c" - break; - case 99: -// 663 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *templatePath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2325 "parser.php7.c" - break; - case 100: -// 667 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *item; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &item); + + + + _0 = Z_TYPE_P(item) == IS_OBJECT; + if (!(_0)) { + _0 = Z_TYPE_P(item) == IS_ARRAY; + } + if (_0) { + RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 347, item); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_MM_LONG(zephir_fast_strlen_ev(item)); + } -// 2334 "parser.php7.c" - break; - case 101: -// 671 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &needle, &haystack); + + + + if (Z_TYPE_P(haystack) == IS_ARRAY) { + RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); + } + if (Z_TYPE_P(haystack) == IS_STRING) { + if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 357, haystack, needle); + zephir_check_call_status(); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); + } + ZEPHIR_INIT_VAR(_1$$4); + zephir_fast_strpos(_1$$4, haystack, needle, 0 ); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); + return; + } -// 2343 "parser.php7.c" - break; - case 102: -// 675 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { + + zend_bool _0, _1; + int ZEPHIR_LAST_CALL_STATUS; + zval *text_param = NULL, *from_param = NULL, *to_param = NULL; + zval *text = NULL, *from = NULL, *to = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); + + zephir_get_strval(text, text_param); + if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(from_param) == IS_STRING)) { + zephir_get_strval(from, from_param); + } else { + ZEPHIR_INIT_VAR(from); + ZVAL_EMPTY_STRING(from); + } + if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(to_param) == IS_STRING)) { + zephir_get_strval(to, to_param); + } else { + ZEPHIR_INIT_VAR(to); + ZVAL_EMPTY_STRING(to); + } + + + _0 = ZEPHIR_IS_STRING(from, "latin1"); + if (!(_0)) { + _0 = ZEPHIR_IS_STRING(to, "utf8"); + } + if (_0) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 358, text); + zephir_check_call_status(); + RETURN_MM(); + } + _1 = ZEPHIR_IS_STRING(to, "latin1"); + if (!(_1)) { + _1 = ZEPHIR_IS_STRING(from, "utf8"); + } + if (_1) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 359, text); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 360, from, to, text); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); + return; + } -// 2352 "parser.php7.c" - break; - case 103: -// 679 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { + + zend_bool _1$$5; + zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; + int start, ZEPHIR_LAST_CALL_STATUS, position = 0; + zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &value, &start_param, &end); + + if (!start_param) { + start = 0; + } else { + start = zephir_get_intval(start_param); + } + if (!end) { + ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(end); + } + + + if (Z_TYPE_P(value) == IS_OBJECT) { + if (Z_TYPE_P(end) == IS_NULL) { + ZEPHIR_INIT_NVAR(end); + ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); + } + position = 0; + ZEPHIR_INIT_VAR(slice); + array_init(slice); + ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0$$3))) { + break; + } + _1$$5 = position >= start; + if (_1$$5) { + _1$$5 = ZEPHIR_GE_LONG(end, position); + } + if (_1$$5) { + ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); + zephir_check_call_status(); + zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); + } + ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); + zephir_check_call_status(); + position++; + } + RETURN_CCTOR(slice); + } + ZEPHIR_INIT_VAR(length); + if (Z_TYPE_P(end) != IS_NULL) { + ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); + } else { + ZVAL_NULL(length); + } + if (Z_TYPE_P(value) == IS_ARRAY) { + ZEPHIR_SINIT_VAR(_5$$9); + ZVAL_LONG(&_5$$9, start); + ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 361, value, &_5$$9, length); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_6$$11); + ZVAL_LONG(&_6$$11, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_6$$11, length); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_8$$10); + ZVAL_LONG(&_8$$10, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_8$$10); + zephir_check_call_status(); + RETURN_MM(); + } + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_9$$12); + ZVAL_LONG(&_9$$12, start); + zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_10); + ZVAL_LONG(&_10, start); + zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); + RETURN_MM(); + } -// 2361 "parser.php7.c" - break; - case 104: -// 683 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *value_param = NULL; + zval *value = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &value_param); + + zephir_get_arrval(value, value_param); + + + ZEPHIR_MAKE_REF(value); + ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 363, value); + ZEPHIR_UNREF(value); + zephir_check_call_status(); + RETURN_CTOR(value); + } -// 2370 "parser.php7.c" - break; - case 105: -// 687 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *arguments = NULL; + zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; + zval *name = NULL, *_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments_param) { + ZEPHIR_INIT_VAR(arguments); + array_init(arguments); + } else { + zephir_get_arrval(arguments, arguments_param); + } + + + ZEPHIR_OBS_VAR(macro); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_1$$3); + object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_2$$3); + ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 364, macro, arguments); + zephir_check_call_status(); + RETURN_MM(); + +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2379 "parser.php7.c" - break; - case 106: -// 691 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { + + zval *view = NULL; + + zephir_fetch_params(0, 0, 1, &view); + + if (!view) { + view = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(view) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + } + } -// 2388 "parser.php7.c" - break; - case 107: -// 695 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2397 "parser.php7.c" - break; - case 108: -// 699 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2405 "parser.php7.c" - break; - case 109: -// 703 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2413 "parser.php7.c" - break; - case 110: -// 707 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { + + zval *option_param = NULL, *value; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &option_param, &value); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2421 "parser.php7.c" - break; - case 111: -// 711 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { + + zval *option_param = NULL, *value = NULL, *_0; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &option_param); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2429 "parser.php7.c" - break; - case 112: -// 715 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2437 "parser.php7.c" - break; - case 113: -// 719 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { + + zval *_3$$6 = NULL, *_4$$7 = NULL; + HashTable *_1$$3; + HashPosition _0$$3; + int ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments) { + arguments = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(extension, _2$$3); + if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(arguments) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_3$$6); + zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$6, extension); + zephir_array_fast_append(_3$$6, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_4$$7); + zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_4$$7, extension); + zephir_array_fast_append(_4$$7, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC(status, _4$$7); + zephir_check_call_status(); + } + if (Z_TYPE_P(status) == IS_STRING) { + RETURN_CCTOR(status); + } + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2445 "parser.php7.c" - break; - case 114: -// 723 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *extension; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &extension); + + + + if (Z_TYPE_P(extension) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); + return; + } + if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); + zephir_check_call_status(); + } + zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); + RETURN_THIS(); + } -// 2453 "parser.php7.c" - break; - case 115: -// 727 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { + + + + RETURN_MEMBER(this_ptr, "_extensions"); + } -// 2461 "parser.php7.c" - break; - case 117: -// 735 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2469 "parser.php7.c" - break; - case 118: -// 739 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { + + + + RETURN_MEMBER(this_ptr, "_functions"); + } -// 2478 "parser.php7.c" - break; - case 119: -// 743 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2486 "parser.php7.c" - break; - case 120: -// 747 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { + + + + RETURN_MEMBER(this_ptr, "_filters"); + } -// 2494 "parser.php7.c" - break; - case 121: -// 751 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2502 "parser.php7.c" - break; - case 122: -// 755 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { + + zval *_7$$5; + zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + ZEPHIR_INIT_VAR(_1$$3); + _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); + zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_OBS_VAR(_3); + zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_3) == IS_OBJECT) { + ZEPHIR_OBS_VAR(_4$$4); + zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_5$$5); + _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_7$$5); + zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_7$$5, this_ptr); + ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); + } + } + ZEPHIR_OBS_VAR(_8); + zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_8) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); + return; + } + RETURN_MM_MEMBER(this_ptr, "_prefix"); + } -// 2511 "parser.php7.c" - break; - case 123: -// 759 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { + + zend_bool _3$$5, _8$$8; + zephir_fcall_cache_entry *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; + zval *expr = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + ZEPHIR_OBS_VAR(left); + zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); + zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 265)) { + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); + if (ZEPHIR_IS_STRING(variable, "loop")) { + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); + zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); + } else { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; + if (_3$$5) { + ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); + zephir_check_call_status(); + _3$$5 = zephir_is_true(_4$$5); + } + if (_3$$5) { + ZEPHIR_INIT_VAR(_5$$6); + ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); + zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_CONCAT_SV(_6$$7, "$", variable); + zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); + } + } + } else { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(leftType); + zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); + _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); + if (_8$$8) { + _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); + } + if (_8$$8) { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } else { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } + } + zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); + ZEPHIR_OBS_VAR(right); + zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); + zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_9, 265)) { + zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); + zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); + } else { + ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); + } + RETURN_CCTOR(exprCode); + } -// 2520 "parser.php7.c" - break; - case 124: -// 763 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { + + zend_bool _8$$5; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; + zval *expr = NULL, *_1$$6, *_3$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(arguments); + ZVAL_STRING(arguments, "", 1); + } + ZEPHIR_OBS_VAR(nameExpr); + zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_VAR(nameType); + zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + if (ZEPHIR_IS_LONG(nameType, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_1$$6); + zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_1$$6, name); + zephir_array_fast_append(_1$$6, arguments); + zephir_array_fast_append(_1$$6, funcArguments); + ZEPHIR_INIT_VAR(_2$$6); + ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _2$$6, _1$$6); + zephir_check_temp_parameter(_2$$6); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(functions); + zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); + if (Z_TYPE_P(functions) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_3$$12); + zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$12, arguments); + zephir_array_fast_append(_3$$12, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_4$$9); + object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); + zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$9); + ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); + ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); + if (!(_8$$5)) { + _8$$5 = ZEPHIR_IS_STRING(name, "content"); + } + if (_8$$5) { + RETURN_MM_STRING("$this->getContent()", 1); + } + if (ZEPHIR_IS_STRING(name, "partial")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "super")) { + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { + ZEPHIR_OBS_VAR(currentBlock); + zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(block); + if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { + ZEPHIR_OBS_VAR(exprLevel); + zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 367, block); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, code); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, code TSRMLS_CC); + } + } else { + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, block); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, block TSRMLS_CC); + } + } + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + RETURN_CCTOR(escapedCode); + } + ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); + RETURN_MM(); + } + } + RETURN_MM_STRING("''", 1); + } + ZEPHIR_INIT_VAR(_9$$5); + zephir_camelize(_9$$5, name, NULL ); + ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(className); + ZVAL_STRING(className, "Phalcon\\Tag", 1); + if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { + ZEPHIR_OBS_VAR(arrayHelpers); + zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); + if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(arrayHelpers); + zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); + zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); + } + if (zephir_array_isset(arrayHelpers, name)) { + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "static_url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "date")) { + ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "time")) { + RETURN_MM_STRING("time()", 1); + } + if (ZEPHIR_IS_STRING(name, "dump")) { + ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "version")) { + RETURN_MM_STRING("Phalcon\\Version::get()", 1); + } + if (ZEPHIR_IS_STRING(name, "version_id")) { + RETURN_MM_STRING("Phalcon\\Version::getId()", 1); + } + if (ZEPHIR_IS_STRING(name, "constant")) { + ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 365, nameExpr); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); + RETURN_MM(); + } -// 2529 "parser.php7.c" - break; - case 125: -// 767 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { + + zephir_fcall_cache_entry *_2 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; + zval *test = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &test_param, &left_param); + + test = test_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); + if (ZEPHIR_IS_STRING(name, "empty")) { + ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "even")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "odd")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "numeric")) { + ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "scalar")) { + ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "iterable")) { + ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); + RETURN_MM(); + } + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_OBS_VAR(testName); + zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { + if (ZEPHIR_IS_STRING(name, "divisibleby")) { + zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 365, _1$$12); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sameas")) { + zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 365, _4$$13); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "type")) { + zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 365, _6$$14); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); + RETURN_MM(); + } + } + } + ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 365, test); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); + RETURN_MM(); + } -// 2538 "parser.php7.c" - break; - case 126: -// 771 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { + + zend_bool _13, _14, _15; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; + zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &filter_param, &left_param); + + filter = filter_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); + } else { + if (!ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_INIT_VAR(_0$$5); + object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); + ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_VAR(functionName); + zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_INIT_VAR(arguments); + ZVAL_NULL(arguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { + if (!ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_OBS_VAR(file); + zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_OBS_VAR(line); + zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_INIT_VAR(_4$$7); + zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); + add_assoc_long_ex(_5$$7, SS("type"), 364); + zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + ZEPHIR_MAKE_REF(funcArguments); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, funcArguments, _4$$7); + ZEPHIR_UNREF(funcArguments); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(arguments, left); + } + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_6$$9, name); + zephir_array_fast_append(_6$$9, arguments); + zephir_array_fast_append(_6$$9, funcArguments); + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _7$$9, _6$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(filters); + zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); + if (Z_TYPE_P(filters) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_8$$15); + zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_8$$15, arguments); + zephir_array_fast_append(_8$$15, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_9$$12); + object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); + zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$12); + ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + if (ZEPHIR_IS_STRING(name, "length")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); + RETURN_MM(); + } + _13 = ZEPHIR_IS_STRING(name, "e"); + if (!(_13)) { + _13 = ZEPHIR_IS_STRING(name, "escape"); + } + if (_13) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_css")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_js")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_attr")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "trim")) { + ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "left_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "right_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "striptags")) { + ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slashes")) { + ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "stripslashes")) { + ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "nl2br")) { + ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "keys")) { + ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "join")) { + ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); + RETURN_MM(); + } + _14 = ZEPHIR_IS_STRING(name, "lower"); + if (!(_14)) { + _14 = ZEPHIR_IS_STRING(name, "lowercase"); + } + if (_14) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); + RETURN_MM(); + } + _15 = ZEPHIR_IS_STRING(name, "upper"); + if (!(_15)) { + _15 = ZEPHIR_IS_STRING(name, "uppercase"); + } + if (_15) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "capitalize")) { + ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sort")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_decode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "format")) { + ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "abs")) { + ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slice")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "convert_encoding")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_16); + object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_INIT_VAR(_19); + ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); + ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); + zephir_check_call_status(); + zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } -// 2547 "parser.php7.c" - break; - case 128: -// 779 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { + + HashTable *_4$$6; + HashPosition _3$$6; + zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; + zval *expr = NULL, *_0$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + while (1) { + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_0$$4); + zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_0$$4, expr); + ZEPHIR_INIT_NVAR(_1$$4); + ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 366, _1$$4, _0$$4); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (Z_TYPE_P(exprCode) == IS_STRING) { + break; + } + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(items); + array_init(items); + zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); + for ( + ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) + ) { + ZEPHIR_GET_HVALUE(singleExpr, _5$$6); + zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 365, _6$$7); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_LNVAR(_8$$8); + ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); + zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); + } else { + zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); + } + } + ZEPHIR_INIT_NVAR(exprCode); + zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, '.')) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(left); + if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + } + if (ZEPHIR_IS_LONG(type, 311)) { + zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 124)) { + zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 369, _12$$13, leftCode); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(right); + if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_NULL(exprCode); + do { + if (ZEPHIR_IS_LONG(type, '!')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '*')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '+')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '-')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '/')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 37)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '<')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 61)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 62)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 126)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 278)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 360)) { + ZEPHIR_INIT_NVAR(exprCode); + if (zephir_array_isset_string(expr, SS("left"))) { + ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); + } else { + ZVAL_STRING(exprCode, "[]", 1); + } + break; + } + if (ZEPHIR_IS_LONG(type, 258)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 259)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 260)) { + ZEPHIR_INIT_NVAR(_14$$31); + zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); + ZEPHIR_SINIT_NVAR(_16$$31); + ZVAL_STRING(&_16$$31, "'", 0); + ZEPHIR_SINIT_NVAR(_17$$31); + ZVAL_STRING(&_17$$31, "\\'", 0); + zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); + break; + } + if (ZEPHIR_IS_LONG(type, 261)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "null", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 262)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "false", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 263)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "true", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 265)) { + zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); + break; + } + if (ZEPHIR_IS_LONG(type, 266)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 267)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 270)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 271)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 272)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 273)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 274)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 275)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 276)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 356)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 361)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); + break; + } + if (ZEPHIR_IS_LONG(type, 365)) { + ZEPHIR_OBS_NVAR(start); + if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 365, start); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(startCode); + ZVAL_STRING(startCode, "null", 1); + } + ZEPHIR_OBS_NVAR(end); + if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 365, end); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(endCode); + ZVAL_STRING(endCode, "null", 1); + } + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 362)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 363)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 392)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 386)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 393)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 387)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 394)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 388)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 395)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 389)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 396)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 390)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 397)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 391)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 309)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 367)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 366)) { + zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 365, _21$$69); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 368)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 369)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 364)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); + break; + } + ZEPHIR_INIT_NVAR(_22$$73); + object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_25$$73); + ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); + ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); + zephir_check_call_status(); + zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); + + break; + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + RETURN_CCTOR(exprCode); + } -// 2556 "parser.php7.c" - break; - case 129: -// 783 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { + + HashTable *_1$$4; + HashPosition _0$$4; + zend_bool isStatementList = 0; + int ZEPHIR_LAST_CALL_STATUS; + zval *statements, *statement = NULL, **_2$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statements); + + + + if (Z_TYPE_P(statements) != IS_ARRAY) { + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } + isStatementList = 1; + if (!(zephir_array_isset_string(statements, SS("type")))) { + zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(statement, _2$$4); + if (Z_TYPE_P(statement) != IS_ARRAY) { + isStatementList = 0; + break; + } + } + } + if (isStatementList == 1) { + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 370, statements); + zephir_check_call_status(); + RETURN_MM(); + } + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } -// 2566 "parser.php7.c" - break; - case 130: -// 787 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { + + HashTable *_2$$4; + HashPosition _1$$4; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + if (!(zephir_array_isset_string(statement, SS("expr")))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "", 1); + ZEPHIR_INIT_VAR(forElse); + ZVAL_NULL(forElse); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(prefixLevel); + ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); + ZEPHIR_OBS_VAR(expr); + zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(blockStatements); + zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); + ZEPHIR_INIT_NVAR(forElse); + ZVAL_BOOL(forElse, 0); + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); + for ( + ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) + ) { + ZEPHIR_GET_HVALUE(bstatement, _3$$4); + if (Z_TYPE_P(bstatement) != IS_ARRAY) { + break; + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_INIT_LNVAR(_4$$8); + ZEPHIR_CONCAT_SVS(_4$$8, ""); + zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); + ZEPHIR_CPY_WRT(forElse, prefixLevel); + zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); + break; + } + } + } + ZEPHIR_INIT_VAR(_5); + if (extendsMode) { + ZVAL_BOOL(_5, 1); + } else { + ZVAL_BOOL(_5, 0); + } + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 370, blockStatements, _5); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(loopContext); + zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_6$$9); + ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); + zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_10$$9); + ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); + zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); + zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$9); + ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); + zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_13$$9); + ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); + zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_14$$9); + ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); + zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(iterator); + ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); + } else { + ZEPHIR_CPY_WRT(iterator, exprCode); + } + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); + ZEPHIR_OBS_VAR(key); + if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_15$$11); + ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); + zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_16$$12); + ZEPHIR_CONCAT_SVSVS(_16$$12, ""); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); + } + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_19$$15); + ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); + zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_20$$15); + ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); + zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_21$$15); + ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_22$$15); + ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_23$$15); + ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_24$$15); + ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); + zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + ZEPHIR_INIT_VAR(_25$$16); + ZEPHIR_CONCAT_SVS(_25$$16, ""); + zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); + } + zephir_concat_self(&compilation, code TSRMLS_CC); + if (zephir_array_isset_string(statement, SS("if_expr"))) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } else { + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_26$$20); + ZEPHIR_CONCAT_SVS(_26$$20, ""); + zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + RETURN_CCTOR(compilation); + } -// 2576 "parser.php7.c" - break; - case 131: -// 791 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { + + zval *level = NULL, *prefix = NULL, *_0, *_1$$3; + + + level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(_1$$3, level)) { + ZEPHIR_CONCAT_SVSVS(return_value, ""); + return; + } + ZEPHIR_CONCAT_SVS(return_value, ""); + return; + } + RETURN_STRING("", 1); + } -// 2586 "parser.php7.c" - break; - case 136: - case 144: -// 823 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { + + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3); + if (extendsMode) { + ZVAL_BOOL(_3, 1); + } else { + ZVAL_BOOL(_3, 0); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 370, _2, _3); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVSV(compilation, "", _1); + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_6$$4); + if (extendsMode) { + ZVAL_BOOL(_6$$4, 1); + } else { + ZVAL_BOOL(_6$$4, 0); + } + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 370, blockStatements, _6$$4); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_7$$4); + ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); + zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); + } + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2595 "parser.php7.c" - break; - case 137: - case 143: -// 827 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -// 2603 "parser.php7.c" - break; - case 139: -// 839 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { + + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); + ZEPHIR_OBS_VAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); + zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); + zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_3$$4, 265)) { + zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$5); + ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); + zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$6); + ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); + zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); + } + } else { + ZEPHIR_INIT_VAR(_8$$7); + ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); + zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_9); + ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); + zephir_concat_self(&compilation, _9 TSRMLS_CC); + zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12); + if (extendsMode) { + ZVAL_BOOL(_12, 1); + } else { + ZVAL_BOOL(_12, 0); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 370, _11, _12); + zephir_check_call_status(); + zephir_concat_self(&compilation, _10 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_13$$8, 265)) { + zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); + ZEPHIR_INIT_VAR(_15$$9); + ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); + zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); + ZEPHIR_INIT_VAR(_17$$10); + ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); + zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_18$$8); + ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_19$$11); + ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); + } + RETURN_CCTOR(compilation); + } -// 2612 "parser.php7.c" - break; - case 140: -// 843 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { + + HashTable *_1; + HashPosition _0; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(assignments); + if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2621 "parser.php7.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php7.lemon" +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - { + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; + zval *statement = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_OBS_VAR(autoescape); + if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); + return; + } + ZEPHIR_OBS_VAR(oldAutoescape); + zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 370, _0, _1); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); + RETURN_CCTOR(compilation); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; + zval *statement = NULL; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + statement = statement_param; - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 350)) { + zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); + zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_1$$4, 265)) { + zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); + if (ZEPHIR_IS_STRING(_2$$5, "super")) { + RETURN_CCTOR(exprCode); } + } + } + _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); + if (zephir_is_true(_3)) { + ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); - } else { +} - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + zephir_fcall_cache_entry *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; + zval *statement = NULL; - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(pathExpr); + if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); + return; + } + zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 260)) { + if (!(zephir_array_isset_string(statement, SS("params")))) { + ZEPHIR_OBS_VAR(path); + zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_1$$5); + ZVAL_BOOL(_1$$5, 0); + ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(compilation); + zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); } + RETURN_CCTOR(compilation); } + } + ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 365, pathExpr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(params); + if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { + ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 365, params); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); + RETURN_MM(); - smart_str_0(&error_str); +} - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { + + HashTable *_6$$6; + HashPosition _5$$6; + zephir_fcall_cache_entry *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); + + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); + + + ZEPHIR_OBS_VAR(name); + if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (zephir_array_isset(_0, name)) { + ZEPHIR_INIT_VAR(_1$$4); + object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); + ZEPHIR_INIT_VAR(macroName); + ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); + ZEPHIR_INIT_VAR(code); + ZVAL_STRING(code, ""); + zephir_concat_self(&code, _3$$5 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); + zephir_concat_self(&code, _4$$6 TSRMLS_CC); + zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); + for ( + ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) + ) { + ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); + ZEPHIR_GET_HVALUE(parameter, _7$$6); + ZEPHIR_OBS_NVAR(variableName); + zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_8$$7); + ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); + zephir_concat_self(&code, _8$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_9$$7); + ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); + zephir_concat_self(&code, _9$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_10$$7); + ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); + zephir_concat_self(&code, _10$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_11$$7); + ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); + zephir_concat_self(&code, _11$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_OBS_NVAR(defaultValue); + if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 365, defaultValue); + zephir_check_call_status(); + ZEPHIR_INIT_LNVAR(_14$$8); + ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); + zephir_concat_self(&code, _14$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_LNVAR(_15$$9); + ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); + zephir_concat_self(&code, _15$$9 TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); + } + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_17$$10); + if (extendsMode) { + ZVAL_BOOL(_17$$10, 1); } else { - status->syntax_error = NULL; + ZVAL_BOOL(_17$$10, 0); } + ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 370, blockStatements, _17$$10); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_18$$10); + ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); + zephir_concat_self(&code, _19 TSRMLS_CC); + RETURN_CCTOR(code); - status->status = PHVOLT_PARSING_FAILED; - -// 2763 "parser.php7.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL; + zval *statement = NULL; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } -#endif + zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; -} -#endif + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); } -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + HashTable *_2; + HashPosition _1; + zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode, _0; + zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; + zval *statements = NULL, *_9$$8 = NULL; - phvolt_parser_token *pToken; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; + statements = statements_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - token->value = NULL; - token->len = 0; -} + if (!(zephir_fast_count_int(statements TSRMLS_CC))) { + RETURN_MM_STRING("", 1); + } + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + _0 = zephir_is_true(extended); + if (!(_0)) { + _0 = extendsMode; + } + ZEPHIR_INIT_VAR(blockMode); + ZVAL_BOOL(blockMode, _0); + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HVALUE(statement, _3); + if (Z_TYPE_P(statement) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); + return; + } + if (!(zephir_array_isset_string(statement, SS("type")))) { + ZEPHIR_INIT_NVAR(_4$$7); + object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_7$$7); + ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); + ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_9$$8); + zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_9$$8, statement); + ZEPHIR_INIT_NVAR(_10$$8); + ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 366, _10$$8, _9$$8); + zephir_check_temp_parameter(_10$$8); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_STRING) { + zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); + continue; + } + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); + do { + if (ZEPHIR_IS_LONG(type, 357)) { + zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); + zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 300)) { + ZEPHIR_INIT_NVAR(_14$$11); + if (extendsMode) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); + zephir_check_call_status(); + zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 302)) { + ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 304)) { + ZEPHIR_INIT_NVAR(_19$$13); + if (extendsMode) { + ZVAL_BOOL(_19$$13, 1); + } else { + ZVAL_BOOL(_19$$13, 0); + } + ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); + zephir_check_call_status(); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 306)) { + ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 359)) { + ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 307)) { + ZEPHIR_OBS_NVAR(blockName); + zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blockStatements); + zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + if (zephir_is_true(blockMode)) { + if (Z_TYPE_P(blocks) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(blocks); + array_init(blocks); + } + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); + ZEPHIR_INIT_NVAR(compilation); + ZVAL_NULL(compilation); + } + zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); + } else { + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_26$$21); + if (extendsMode) { + ZVAL_BOOL(_26$$21, 1); + } else { + ZVAL_BOOL(_26$$21, 0); + } + ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 370, blockStatements, _26$$21); + zephir_check_call_status(); + zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); + } + } + break; + } + if (ZEPHIR_IS_LONG(type, 310)) { + ZEPHIR_OBS_NVAR(path); + zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); + zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(extended); + ZVAL_BOOL(extended, 1); + ZEPHIR_INIT_NVAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(tempCompilation); + zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); + ZEPHIR_CPY_WRT(blockMode, extended); + break; + } + if (ZEPHIR_IS_LONG(type, 313)) { + ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 314)) { + ZEPHIR_INIT_NVAR(_34$$25); + if (extendsMode) { + ZVAL_BOOL(_34$$25, 1); + } else { + ZVAL_BOOL(_34$$25, 0); + } + ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); + zephir_check_call_status(); + zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 316)) { + ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 327)) { + ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 317)) { + ZEPHIR_INIT_NVAR(_41$$28); + if (extendsMode) { + ZVAL_BOOL(_41$$28, 1); + } else { + ZVAL_BOOL(_41$$28, 0); + } + ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); + zephir_check_call_status(); + zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 319)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 320)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); + zephir_check_call_status(); + zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 322)) { + ZEPHIR_INIT_NVAR(_46$$32); + if (extendsMode) { + ZVAL_BOOL(_46$$32, 1); + } else { + ZVAL_BOOL(_46$$32, 0); + } + ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); + zephir_check_call_status(); + zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 325)) { + ZEPHIR_INIT_NVAR(_49$$33); + if (extendsMode) { + ZVAL_BOOL(_49$$33, 1); + } else { + ZVAL_BOOL(_49$$33, 0); + } + ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); + zephir_check_call_status(); + zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 358)) { + break; + } + ZEPHIR_INIT_NVAR(_51$$35); + object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_54$$35); + ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); + ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + } + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); + if (ZEPHIR_IS_LONG(level, 1)) { + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); + RETURN_CCTOR(compilation); - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); +} - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} + HashTable *_3$$7; + HashPosition _2$$7; + zephir_fcall_cache_entry *_1 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; + zval *viewCode = NULL; -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); + ZEPHIR_OBS_VAR(currentPath); + zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_OBS_VAR(autoescape); + if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { + if (Z_TYPE_P(autoescape) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); + return; + } + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(intermediate); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(intermediate) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); + return; + } + ZEPHIR_INIT_VAR(_0); + if (extendsMode) { + ZVAL_BOOL(_0, 1); + } else { + ZVAL_BOOL(_0, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 370, intermediate, _0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { + ZEPHIR_INIT_VAR(finalCompilation); + if (extendsMode == 1) { + array_init(finalCompilation); } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + ZVAL_NULL(finalCompilation); + } + ZEPHIR_OBS_VAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); + for ( + ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) + ) { + ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); + ZEPHIR_GET_HVALUE(block, _4$$7); + if (Z_TYPE_P(name) == IS_STRING) { + if (zephir_array_isset(blocks, name)) { + ZEPHIR_OBS_NVAR(localBlock); + zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, localBlock); + zephir_check_call_status(); + } else { + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, block); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(blockCompilation, block); + } + } + if (extendsMode == 1) { + zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); + } + } else { + if (extendsMode == 1) { + zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); + } else { + zephir_concat_self(&finalCompilation, block TSRMLS_CC); + } + } } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + RETURN_CCTOR(finalCompilation); } + if (extendsMode == 1) { + RETURN_MM_MEMBER(this_ptr, "_blocks"); + } + RETURN_CCTOR(compilation); - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); } -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - ZVAL_NULL(result); + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; + zval *viewCode = NULL; -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_STRING(_0, "eval code", 1); + zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); + zephir_check_call_status(); + RETURN_MM(); - return 1; } -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; + zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { + zephir_get_strval(compiledPath, compiledPath_param); + } else { + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_EMPTY_STRING(compiledPath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; + if (ZEPHIR_IS_EQUAL(path, compiledPath)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); + return; + } + if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_1$$4); + ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(viewCode); + zephir_file_get_contents(viewCode, path TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { + ZEPHIR_INIT_VAR(_2$$5); + object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); + ZEPHIR_INIT_VAR(_4); + if (extendsMode) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_ARRAY) { + ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(finalCompilation, compilation); + } + ZEPHIR_INIT_VAR(_5); + zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); + return; + } + RETURN_CCTOR(compilation); - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; +} - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; + zval *_2$$23; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; + zval *templatePath = NULL; - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + if (0) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + if (0) { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(stat); + ZVAL_BOOL(stat, 1); + ZEPHIR_INIT_VAR(compileAlways); + ZVAL_BOOL(compileAlways, 0); + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_STRING(compiledPath, "", 1); + ZEPHIR_INIT_VAR(prefix); + ZVAL_NULL(prefix); + ZEPHIR_INIT_VAR(compiledSeparator); + ZVAL_STRING(compiledSeparator, "%%", 1); + ZEPHIR_INIT_VAR(compiledExtension); + ZVAL_STRING(compiledExtension, ".php", 1); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + if (zephir_array_isset_string(options, SS("compileAlways"))) { + ZEPHIR_OBS_NVAR(compileAlways); + zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); + if (Z_TYPE_P(compileAlways) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); + return; + } + } + if (zephir_array_isset_string(options, SS("prefix"))) { + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); + if (Z_TYPE_P(prefix) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledPath"))) { + ZEPHIR_OBS_NVAR(compiledPath); + zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); + if (Z_TYPE_P(compiledPath) != IS_STRING) { + if (Z_TYPE_P(compiledPath) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); + return; } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } + } + if (zephir_array_isset_string(options, SS("compiledSeparator"))) { + ZEPHIR_OBS_NVAR(compiledSeparator); + zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); + if (Z_TYPE_P(compiledSeparator) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledExtension"))) { + ZEPHIR_OBS_NVAR(compiledExtension); + zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); + if (Z_TYPE_P(compiledExtension) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); + return; + } + } + if (zephir_array_isset_string(options, SS("stat"))) { + ZEPHIR_OBS_NVAR(stat); + zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); + } + } + if (Z_TYPE_P(compiledPath) == IS_STRING) { + if (!(ZEPHIR_IS_EMPTY(compiledPath))) { + ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(templateSepPath); + zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(templateSepPath, templatePath); + } + ZEPHIR_INIT_VAR(compiledTemplatePath); + if (extendsMode == 1) { + ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); + } else { + ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); + } + } else { + if (Z_TYPE_P(compiledPath) == IS_OBJECT) { + if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$23); + zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$23, templatePath); + zephir_array_fast_append(_2$$23, options); + ZEPHIR_INIT_VAR(_3$$23); + ZVAL_BOOL(_3$$23, extendsMode); + zephir_array_fast_append(_2$$23, _3$$23); + ZEPHIR_INIT_NVAR(compiledTemplatePath); + ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); + zephir_check_call_status(); + if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); + return; } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } else { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); + return; + } + } + } + ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); + if (zephir_is_true(compileAlways)) { + ZEPHIR_INIT_VAR(_4$$26); + if (extendsMode) { + ZVAL_BOOL(_4$$26, 1); + } else { + ZVAL_BOOL(_4$$26, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); + zephir_check_call_status(); + } else { + if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { + if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_VAR(_6$$29); + if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_7$$30); + if (extendsMode) { + ZVAL_BOOL(_7$$30, 1); + } else { + ZVAL_BOOL(_7$$30, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); + zephir_check_call_status(); } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; + if (extendsMode == 1) { + ZEPHIR_INIT_VAR(blocksCode); + zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { + ZEPHIR_INIT_VAR(_8$$33); + object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_9$$33); + ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); + zephir_check_call_status(); + zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; + if (zephir_is_true(blocksCode)) { + ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(compilation); + array_init(compilation); } } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } + } else { + ZEPHIR_INIT_VAR(_10$$36); + if (extendsMode) { + ZVAL_BOOL(_10$$36, 1); } else { - efree(token.value); + ZVAL_BOOL(_10$$36, 0); } - break; + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); + zephir_check_call_status(); + } + } else { + if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_11$$38); + object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_12$$38); + ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); + zephir_check_call_status(); + zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); + RETURN_CCTOR(compilation); - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; +} - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; + - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_currentPath"); - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; +} - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; + - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; +} - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; + int ZEPHIR_LAST_CALL_STATUS; + zval *viewCode_param = NULL, *currentPath = NULL; + zval *viewCode = NULL; - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewCode_param); - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; + ZEPHIR_INIT_VAR(currentPath); + ZVAL_STRING(currentPath, "eval code", 1); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; +} - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; + zval *path = NULL; - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &path_param); - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; + zephir_get_strval(path, path_param); - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; + ZEPHIR_OBS_VAR(view); + zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); + if (Z_TYPE_P(view) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { + zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(viewsDir, _2$$4); + ZEPHIR_INIT_LNVAR(_3$$5); + ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); + if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; + } + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); + } else { + ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); + RETURN_MM(); } + } + RETURN_CTOR(path); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } +} - state->end = state->start; - } - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); +#ifdef HAVE_CONFIG_H #endif - efree(parser_status->syntax_error); - } - } - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - efree(parser_status); - efree(state); - return status; + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); + + return SUCCESS; + } + +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php5.lemon" +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -157009,58 +126883,58 @@ static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *temp #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval* yy40; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval* vv40; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -157070,46 +126944,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -157342,7 +127216,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -157575,8 +127449,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -157613,8 +127487,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -157651,7 +127525,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -157688,7 +127562,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -157700,10 +127574,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -157717,43 +127591,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -157791,7 +127665,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -157949,8 +127823,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -157960,21 +127834,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -158069,14 +127943,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 155 "parser.php5.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php5.c" break; case 88: case 89: @@ -158112,136 +127988,138 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 172 "parser.php5.lemon" { #if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(yypminor->yy40)); + zval_ptr_dtor(&(vvpminor->vv40)); #endif } +// 1175 "parser.php5.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -158250,9 +128128,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -158407,40 +128285,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 164 "parser.php5.lemon" { - status->ret = yymsp[0].minor.yy40; + status->ret = vvmsp[0].minor.vv40; } +// 1544 "parser.php5.c" break; case 1: case 4: @@ -158464,881 +128344,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 168 "parser.php5.lemon" { - yygotominor.yy40 = yymsp[0].minor.yy40; + vvgotominor.vv40 = vvmsp[0].minor.vv40; } +// 1572 "parser.php5.c" break; case 2: +// 178 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-1].minor.yy40, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); } +// 1579 "parser.php5.c" break; case 3: case 37: case 49: case 135: case 142: +// 182 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(NULL, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); } +// 1590 "parser.php5.c" break; case 24: +// 278 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1603 "parser.php5.c" break; case 25: +// 282 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-4].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1616 "parser.php5.c" break; case 26: +// 286 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-9].minor.yy40, yymsp[-7].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1632 "parser.php5.c" break; case 27: +// 290 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1648 "parser.php5.c" break; case 28: +// 294 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-7].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1664 "parser.php5.c" break; case 29: +// 304 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elseif_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1674 "parser.php5.c" break; case 30: +// 314 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elsefor_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1684 "parser.php5.c" break; case 31: +// 324 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, NULL, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1698 "parser.php5.c" break; case 32: +// 328 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, NULL, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1713 "parser.php5.c" break; case 33: +// 332 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1728 "parser.php5.c" break; case 34: +// 336 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1744 "parser.php5.c" break; case 35: +// 346 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_statement(yymsp[-1].minor.yy40); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1754 "parser.php5.c" break; case 36: case 48: case 134: case 141: +// 356 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-2].minor.yy40, yymsp[0].minor.yy40); - yy_destructor(2,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); + vv_destructor(2,&vvmsp[-1].minor); } +// 1765 "parser.php5.c" break; case 38: +// 370 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1773 "parser.php5.c" break; case 39: +// 374 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ADD_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1781 "parser.php5.c" break; case 40: +// 378 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_SUB_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1789 "parser.php5.c" break; case 41: +// 382 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_MUL_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1797 "parser.php5.c" break; case 42: +// 386 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_DIV_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1805 "parser.php5.c" break; case 43: case 67: case 133: case 145: +// 390 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1815 "parser.php5.c" break; case 44: case 127: +// 394 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1825 "parser.php5.c" break; case 45: case 116: +// 398 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DOT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1834 "parser.php5.c" break; case 46: +// 408 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-7].minor.yy0, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1849 "parser.php5.c" break; case 47: +// 412 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-8].minor.yy0, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1864 "parser.php5.c" break; case 50: +// 436 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[0].minor.yy0, NULL, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1871 "parser.php5.c" break; case 51: +// 440 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1879 "parser.php5.c" break; case 52: case 66: case 132: case 146: +// 444 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1889 "parser.php5.c" break; case 53: case 147: +// 448 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1897 "parser.php5.c" break; case 54: case 148: +// 452 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1905 "parser.php5.c" break; case 55: case 149: +// 456 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1914 "parser.php5.c" break; case 56: case 150: +// 460 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1923 "parser.php5.c" break; case 57: case 151: +// 464 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1932 "parser.php5.c" break; case 58: +// 474 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1947 "parser.php5.c" break; case 59: +// 478 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-6].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1962 "parser.php5.c" break; case 60: +// 488 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_empty_statement(status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1971 "parser.php5.c" break; case 61: +// 498 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_echo_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1980 "parser.php5.c" break; case 62: +// 508 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-5].minor.yy0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1993 "parser.php5.c" break; case 63: +// 512 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2006 "parser.php5.c" break; case 64: +// 522 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2019 "parser.php5.c" break; case 65: +// 526 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-6].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2032 "parser.php5.c" break; case 68: +// 550 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_raw_statement(yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2045 "parser.php5.c" break; case 69: +// 560 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_extends_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2055 "parser.php5.c" break; case 70: +// 570 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2065 "parser.php5.c" break; case 71: +// 574 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2076 "parser.php5.c" break; case 72: +// 584 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_do_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2086 "parser.php5.c" break; case 73: +// 594 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_return_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2096 "parser.php5.c" break; case 74: +// 604 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2110 "parser.php5.c" break; case 75: +// 608 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(1, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2124 "parser.php5.c" break; case 76: +// 618 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_break_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2134 "parser.php5.c" break; case 77: +// 628 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_continue_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2144 "parser.php5.c" break; case 78: +// 638 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2151 "parser.php5.c" break; case 79: +// 648 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2159 "parser.php5.c" break; case 80: +// 652 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2167 "parser.php5.c" break; case 81: +// 656 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_SUB, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2175 "parser.php5.c" break; case 82: +// 660 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ADD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2183 "parser.php5.c" break; case 83: +// 664 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MUL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2191 "parser.php5.c" break; case 84: +// 668 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_POW, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2200 "parser.php5.c" break; case 85: +// 672 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DIV, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2208 "parser.php5.c" break; case 86: +// 676 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2217 "parser.php5.c" break; case 87: +// 680 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2225 "parser.php5.c" break; case 88: +// 684 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_AND, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2233 "parser.php5.c" break; case 89: +// 688 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_OR, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2241 "parser.php5.c" break; case 90: +// 692 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_CONCAT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2249 "parser.php5.c" break; case 91: +// 696 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PIPE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2257 "parser.php5.c" break; case 92: +// 700 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_RANGE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2265 "parser.php5.c" break; case 93: +// 704 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_EQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2273 "parser.php5.c" break; case 94: +// 708 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2282 "parser.php5.c" break; case 95: +// 712 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2291 "parser.php5.c" break; case 96: +// 716 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2300 "parser.php5.c" break; case 97: +// 720 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2309 "parser.php5.c" break; case 98: +// 724 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2318 "parser.php5.c" break; case 99: +// 728 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2327 "parser.php5.c" break; case 100: +// 732 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2336 "parser.php5.c" break; case 101: +// 736 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2345 "parser.php5.c" break; case 102: +// 740 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2354 "parser.php5.c" break; case 103: +// 744 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2363 "parser.php5.c" break; case 104: +// 748 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2372 "parser.php5.c" break; case 105: +// 752 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2381 "parser.php5.c" break; case 106: +// 756 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2390 "parser.php5.c" break; case 107: +// 760 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2399 "parser.php5.c" break; case 108: +// 764 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2407 "parser.php5.c" break; case 109: +// 768 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2415 "parser.php5.c" break; case 110: +// 772 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2423 "parser.php5.c" break; case 111: +// 776 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2431 "parser.php5.c" break; case 112: +// 780 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2439 "parser.php5.c" break; case 113: +// 784 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATER, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2447 "parser.php5.c" break; case 114: +// 788 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2455 "parser.php5.c" break; case 115: +// 792 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2463 "parser.php5.c" break; case 117: +// 800 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IN, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2471 "parser.php5.c" break; case 118: +// 804 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2480 "parser.php5.c" break; case 119: +// 808 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2488 "parser.php5.c" break; case 120: +// 812 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_INCR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2496 "parser.php5.c" break; case 121: +// 816 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DECR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2504 "parser.php5.c" break; case 122: +// 820 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2513 "parser.php5.c" break; case 123: +// 824 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2522 "parser.php5.c" break; case 124: +// 828 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2531 "parser.php5.c" break; case 125: +// 832 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2540 "parser.php5.c" break; case 126: +// 836 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2549 "parser.php5.c" break; case 128: +// 844 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_TERNARY, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, yymsp[-4].minor.yy40, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2558 "parser.php5.c" break; case 129: +// 848 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, NULL, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2568 "parser.php5.c" break; case 130: +// 852 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2578 "parser.php5.c" break; case 131: +// 856 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2588 "parser.php5.c" break; case 136: case 144: +// 894 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2597 "parser.php5.c" break; case 137: case 143: +// 898 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(NULL, yymsp[0].minor.yy40, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); } +// 2605 "parser.php5.c" break; case 139: +// 912 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2614 "parser.php5.c" break; case 140: +// 916 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2623 "parser.php5.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php5.lemon" { @@ -159447,19 +129544,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2774 "parser.php5.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -159485,56 +129583,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -159554,40 +129652,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -159597,32 +129695,33 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php7.lemon" +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -159633,58 +129732,58 @@ static void phvolt_( #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval yy146; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval vv146; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -159694,46 +129793,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -159966,7 +130065,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -160199,8 +130298,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -160237,8 +130336,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -160275,7 +130374,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -160312,7 +130411,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -160324,10 +130423,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -160341,43 +130440,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -160415,7 +130514,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -160573,8 +130672,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -160584,21 +130683,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -160693,14 +130792,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 146 "parser.php7.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php7.c" break; case 88: case 89: @@ -160736,134 +130837,136 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 163 "parser.php7.lemon" { - zval_ptr_dtor(&(yypminor->yy146)); + zval_ptr_dtor(&(vvpminor->vv146)); } +// 1173 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -160872,9 +130975,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -161029,40 +131132,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 155 "parser.php7.lemon" { - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy146, 1, 1); + ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); } +// 1542 "parser.php7.c" break; case 1: case 4: @@ -161086,881 +131191,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 159 "parser.php7.lemon" { - yygotominor.yy146 = yymsp[0].minor.yy146; + vvgotominor.vv146 = vvmsp[0].minor.vv146; } +// 1570 "parser.php7.c" break; case 2: +// 167 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-1].minor.yy146, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); } +// 1577 "parser.php7.c" break; case 3: case 37: case 49: case 135: case 142: +// 171 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); } +// 1588 "parser.php7.c" break; case 24: +// 263 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1601 "parser.php7.c" break; case 25: +// 267 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1614 "parser.php7.c" break; case 26: +// 271 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-9].minor.yy146, &yymsp[-7].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1630 "parser.php7.c" break; case 27: +// 275 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1646 "parser.php7.c" break; case 28: +// 279 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-7].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1662 "parser.php7.c" break; case 29: +// 287 "parser.php7.lemon" { - phvolt_ret_elseif_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1672 "parser.php7.c" break; case 30: +// 295 "parser.php7.lemon" { - phvolt_ret_elsefor_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1682 "parser.php7.c" break; case 31: +// 303 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1696 "parser.php7.c" break; case 32: +// 307 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, NULL, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1711 "parser.php7.c" break; case 33: +// 311 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1726 "parser.php7.c" break; case 34: +// 315 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1742 "parser.php7.c" break; case 35: +// 323 "parser.php7.lemon" { - phvolt_ret_set_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1752 "parser.php7.c" break; case 36: case 48: case 134: case 141: +// 331 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146); - yy_destructor(2,&yymsp[-1].minor); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); + vv_destructor(2,&vvmsp[-1].minor); } +// 1763 "parser.php7.c" break; case 38: +// 343 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1771 "parser.php7.c" break; case 39: +// 347 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ADD_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1779 "parser.php7.c" break; case 40: +// 351 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_SUB_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1787 "parser.php7.c" break; case 41: +// 355 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_MUL_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1795 "parser.php7.c" break; case 42: +// 359 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_DIV_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1803 "parser.php7.c" break; case 43: case 67: case 133: case 145: +// 363 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1813 "parser.php7.c" break; case 44: case 127: +// 367 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAYACCESS, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1823 "parser.php7.c" break; case 45: case 116: +// 371 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DOT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1832 "parser.php7.c" break; case 46: +// 379 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1847 "parser.php7.c" break; case 47: +// 383 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-8].minor.yy0, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1862 "parser.php7.c" break; case 50: +// 403 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[0].minor.yy0, NULL, status->scanner_state); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1869 "parser.php7.c" break; case 51: +// 407 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1877 "parser.php7.c" break; case 52: case 66: case 132: case 146: +// 411 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1887 "parser.php7.c" break; case 53: case 147: +// 415 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1895 "parser.php7.c" break; case 54: case 148: +// 419 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1903 "parser.php7.c" break; case 55: case 149: +// 423 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1912 "parser.php7.c" break; case 56: case 150: +// 427 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1921 "parser.php7.c" break; case 57: case 151: +// 431 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1930 "parser.php7.c" break; case 58: +// 439 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1945 "parser.php7.c" break; case 59: +// 443 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1960 "parser.php7.c" break; case 60: +// 451 "parser.php7.lemon" { - phvolt_ret_empty_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1969 "parser.php7.c" break; case 61: +// 459 "parser.php7.lemon" { - phvolt_ret_echo_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1978 "parser.php7.c" break; case 62: +// 467 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-5].minor.yy0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1991 "parser.php7.c" break; case 63: +// 471 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2004 "parser.php7.c" break; case 64: +// 479 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2017 "parser.php7.c" break; case 65: +// 483 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2030 "parser.php7.c" break; case 68: +// 503 "parser.php7.lemon" { - phvolt_ret_raw_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2043 "parser.php7.c" break; case 69: +// 511 "parser.php7.lemon" { - phvolt_ret_extends_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2053 "parser.php7.c" break; case 70: +// 519 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2063 "parser.php7.c" break; case 71: +// 523 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2074 "parser.php7.c" break; case 72: +// 531 "parser.php7.lemon" { - phvolt_ret_do_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2084 "parser.php7.c" break; case 73: +// 539 "parser.php7.lemon" { - phvolt_ret_return_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2094 "parser.php7.c" break; case 74: +// 547 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2108 "parser.php7.c" break; case 75: +// 551 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 1, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2122 "parser.php7.c" break; case 76: +// 559 "parser.php7.lemon" { - phvolt_ret_break_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2132 "parser.php7.c" break; case 77: +// 567 "parser.php7.lemon" { - phvolt_ret_continue_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2142 "parser.php7.c" break; case 78: +// 575 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2149 "parser.php7.c" break; case 79: +// 583 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MINUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2157 "parser.php7.c" break; case 80: +// 587 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PLUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2165 "parser.php7.c" break; case 81: +// 591 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_SUB, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2173 "parser.php7.c" break; case 82: +// 595 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ADD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2181 "parser.php7.c" break; case 83: +// 599 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MUL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2189 "parser.php7.c" break; case 84: +// 603 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_POW, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2198 "parser.php7.c" break; case 85: +// 607 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DIV, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2206 "parser.php7.c" break; case 86: +// 611 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2215 "parser.php7.c" break; case 87: +// 615 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2223 "parser.php7.c" break; case 88: +// 619 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_AND, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2231 "parser.php7.c" break; case 89: +// 623 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_OR, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2239 "parser.php7.c" break; case 90: +// 627 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_CONCAT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2247 "parser.php7.c" break; case 91: +// 631 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PIPE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2255 "parser.php7.c" break; case 92: +// 635 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_RANGE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2263 "parser.php7.c" break; case 93: +// 639 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_EQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2271 "parser.php7.c" break; case 94: +// 643 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2280 "parser.php7.c" break; case 95: +// 647 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2289 "parser.php7.c" break; case 96: +// 651 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2298 "parser.php7.c" break; case 97: +// 655 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2307 "parser.php7.c" break; case 98: +// 659 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2316 "parser.php7.c" break; case 99: +// 663 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2325 "parser.php7.c" break; case 100: +// 667 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2334 "parser.php7.c" break; case 101: +// 671 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2343 "parser.php7.c" break; case 102: +// 675 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2352 "parser.php7.c" break; case 103: +// 679 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2361 "parser.php7.c" break; case 104: +// 683 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2370 "parser.php7.c" break; case 105: +// 687 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2379 "parser.php7.c" break; case 106: +// 691 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2388 "parser.php7.c" break; case 107: +// 695 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2397 "parser.php7.c" break; case 108: +// 699 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2405 "parser.php7.c" break; case 109: +// 703 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTEQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2413 "parser.php7.c" break; case 110: +// 707 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2421 "parser.php7.c" break; case 111: +// 711 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTIDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2429 "parser.php7.c" break; case 112: +// 715 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2437 "parser.php7.c" break; case 113: +// 719 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATER, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2445 "parser.php7.c" break; case 114: +// 723 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATEREQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2453 "parser.php7.c" break; case 115: +// 727 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESSEQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2461 "parser.php7.c" break; case 117: +// 735 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IN, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2469 "parser.php7.c" break; case 118: +// 739 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_IN, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2478 "parser.php7.c" break; case 119: +// 743 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2486 "parser.php7.c" break; case 120: +// 747 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_INCR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2494 "parser.php7.c" break; case 121: +// 751 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DECR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2502 "parser.php7.c" break; case 122: +// 755 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ENCLOSED, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2511 "parser.php7.c" break; case 123: +// 759 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2520 "parser.php7.c" break; case 124: +// 763 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2529 "parser.php7.c" break; case 125: +// 767 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2538 "parser.php7.c" break; case 126: +// 771 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2547 "parser.php7.c" break; case 128: +// 779 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_TERNARY, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, &yymsp[-4].minor.yy146, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2556 "parser.php7.c" break; case 129: +// 783 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2566 "parser.php7.c" break; case 130: +// 787 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2576 "parser.php7.c" break; case 131: +// 791 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2586 "parser.php7.c" break; case 136: case 144: +// 823 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2595 "parser.php7.c" break; case 137: case 143: +// 827 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146, status->scanner_state); + phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); } +// 2603 "parser.php7.c" break; case 139: +// 839 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2612 "parser.php7.c" break; case 140: +// 843 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2621 "parser.php7.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php7.lemon" { @@ -162060,19 +132382,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2763 "parser.php7.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -162098,56 +132421,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -162167,40 +132490,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -162210,23 +132533,783 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } +#endif + + +const phvolt_token_names phvolt_tokens[] = +{ + { SL("INTEGER"), PHVOLT_T_INTEGER }, + { SL("DOUBLE"), PHVOLT_T_DOUBLE }, + { SL("STRING"), PHVOLT_T_STRING }, + { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, + { SL("MINUS"), PHVOLT_T_MINUS }, + { SL("+"), PHVOLT_T_ADD }, + { SL("-"), PHVOLT_T_SUB }, + { SL("*"), PHVOLT_T_MUL }, + { SL("/"), PHVOLT_T_DIV }, + { SL("%%"), PHVOLT_T_MOD }, + { SL("!"), PHVOLT_T_NOT }, + { SL("~"), PHVOLT_T_CONCAT }, + { SL("AND"), PHVOLT_T_AND }, + { SL("OR"), PHVOLT_T_OR }, + { SL("DOT"), PHVOLT_T_DOT }, + { SL("COMMA"), PHVOLT_T_COMMA }, + { SL("EQUALS"), PHVOLT_T_EQUALS }, + { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, + { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, + { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, + { SL("NOT"), PHVOLT_T_NOT }, + { SL("RANGE"), PHVOLT_T_RANGE }, + { SL("COLON"), PHVOLT_T_COLON }, + { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, + { SL("<"), PHVOLT_T_LESS }, + { SL("<="), PHVOLT_T_LESSEQUAL }, + { SL(">"), PHVOLT_T_GREATER }, + { SL(">="), PHVOLT_T_GREATEREQUAL }, + { SL("("), PHVOLT_T_PARENTHESES_OPEN }, + { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, + { SL("["), PHVOLT_T_SBRACKET_OPEN }, + { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, + { SL("{"), PHVOLT_T_CBRACKET_OPEN }, + { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, + { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, + { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, + { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, + { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, + { SL("IF"), PHVOLT_T_IF }, + { SL("ELSE"), PHVOLT_T_ELSE }, + { SL("ELSEIF"), PHVOLT_T_ELSEIF }, + { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, + { SL("ENDIF"), PHVOLT_T_ENDIF }, + { SL("FOR"), PHVOLT_T_FOR }, + { SL("IN"), PHVOLT_T_IN }, + { SL("ENDFOR"), PHVOLT_T_ENDFOR }, + { SL("SET"), PHVOLT_T_SET }, + { SL("ASSIGN"), PHVOLT_T_ASSIGN }, + { SL("+="), PHVOLT_T_ADD_ASSIGN }, + { SL("-="), PHVOLT_T_SUB_ASSIGN }, + { SL("*="), PHVOLT_T_MUL_ASSIGN }, + { SL("/="), PHVOLT_T_DIV_ASSIGN }, + { SL("++"), PHVOLT_T_INCR }, + { SL("--"), PHVOLT_T_DECR }, + { SL("BLOCK"), PHVOLT_T_BLOCK }, + { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, + { SL("CACHE"), PHVOLT_T_CACHE }, + { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, + { SL("EXTENDS"), PHVOLT_T_EXTENDS }, + { SL("IS"), PHVOLT_T_IS }, + { SL("DEFINED"), PHVOLT_T_DEFINED }, + { SL("EMPTY"), PHVOLT_T_EMPTY }, + { SL("EVEN"), PHVOLT_T_EVEN }, + { SL("ODD"), PHVOLT_T_ODD }, + { SL("NUMERIC"), PHVOLT_T_NUMERIC }, + { SL("SCALAR"), PHVOLT_T_SCALAR }, + { SL("ITERABLE"), PHVOLT_T_ITERABLE }, + { SL("INCLUDE"), PHVOLT_T_INCLUDE }, + { SL("DO"), PHVOLT_T_DO }, + { SL("WHITESPACE"), PHVOLT_T_IGNORE }, + { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, + { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, + { SL("CONTINUE"), PHVOLT_T_CONTINUE }, + { SL("BREAK"), PHVOLT_T_BREAK }, + { SL("WITH"), PHVOLT_T_WITH }, + { SL("RETURN"), PHVOLT_T_RETURN }, + { SL("MACRO"), PHVOLT_T_MACRO }, + { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, + { SL("CALL"), PHVOLT_T_CALL }, + { SL("WITH"), PHVOLT_T_WITH }, + { NULL, 0, 0 } +}; + +static void *phvolt_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} + +static void phvolt_wrapper_free(void *pointer){ + efree(pointer); +} + +static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + + phvolt_parser_token *pToken; + + pToken = emalloc(sizeof(phvolt_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; + + phvolt_(phvolt_parser, parsercode, pToken, parser_status); + + token->value = NULL; + token->len = 0; +} + +static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + + unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); + char *str = emalloc(sizeof(char) * length); + + snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); + str[length - 1] = '\0'; + + parser_status->syntax_error = estrndup(str, strlen(str)); + efree(str); +} + +static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + + char *error, *error_part; + int length; + phvolt_scanner_state *state = parser_status->scanner_state; + +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); +#else + ZVAL_NULL(*error_msg); +#endif + + if (state->start) { + error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); + if (state->start_length > 16) { + length = 72 + Z_STRLEN_P(state->active_file); + error_part = estrndup(state->start, 16); + snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); + error[length - 1] = '\0'; + efree(error_part); + } else { + length = 48 + state->start_length + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + } + } else { + error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); + length = 32 + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + } + + error[length - 1] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRING(*error_msg, error, 1); +#else + ZVAL_STRING(*error_msg, error); +#endif + + efree(error); +} + +static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ + +#if PHP_VERSION_ID < 70000 + zval *error_msg = NULL; +#else + zval em, *error_msg = &em; +#endif + + ZVAL_NULL(result); + +#if PHP_VERSION_ID >= 70000 + ZVAL_NULL(error_msg); +#endif + + if (Z_TYPE_P(view_code) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); + return FAILURE; + } + + if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); +#if PHP_VERSION_ID < 70000 + zval_ptr_dtor(&error_msg); +#else + zval_dtor(error_msg); +#endif + return FAILURE; + } + + return SUCCESS; +} + +static int phvolt_is_blank_string(phvolt_scanner_token *token){ + + char *marker = token->value; + unsigned int ch, i; + + for (i = 0; i < token->len; i++) { + ch = *marker; + if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { + return 0; + } + marker++; + } + + return 1; +} + +static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { + + char *error; + phvolt_scanner_state *state; + phvolt_scanner_token token; + int scanner_status, status = SUCCESS; + phvolt_parser_status *parser_status = NULL; + void* phvolt_parser; + + /** Check if the view has code */ + if (!Z_STRVAL_P(view_code)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "View code cannot be null", 1); +#else + ZVAL_STRING(*error_msg, "View code cannot be null"); +#endif + return FAILURE; + } + + if (!Z_STRLEN_P(view_code)) { + array_init(*result); + return SUCCESS; + } + + /** Start the reentrant parser */ + phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); + if (unlikely(!phvolt_parser)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "Memory allocation error", 1); +#else + ZVAL_STRING(*error_msg, "Memory allocation error"); +#endif + return FAILURE; + } + + parser_status = emalloc(sizeof(phvolt_parser_status)); + state = emalloc(sizeof(phvolt_scanner_state)); + + parser_status->status = PHVOLT_PARSING_OK; + parser_status->scanner_state = state; +#if PHP_VERSION_ID < 70000 + parser_status->ret = NULL; +#else + ZVAL_UNDEF(&parser_status->ret); +#endif + parser_status->token = &token; + parser_status->syntax_error = NULL; + + /** Initialize the scanner state */ + state->active_token = 0; + state->start = Z_STRVAL_P(view_code); + state->mode = PHVOLT_MODE_RAW; + state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); + state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; + state->raw_buffer_cursor = 0; + state->active_file = template_path; + state->active_line = 1; + state->statement_position = 0; + state->extends_mode = 0; + state->block_level = 0; + state->macro_level = 0; + state->start_length = 0; + state->old_if_level = 0; + state->if_level = 0; + state->for_level = 0; + state->whitespace_control = 0; + state->forced_raw_state = 0; + + state->end = state->start; + + token.value = NULL; + token.len = 0; + + while (0 <= (scanner_status = phvolt_get_token(state, &token))) { + + state->active_token = token.opcode; + + state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); + + switch (token.opcode) { + + case PHVOLT_T_IGNORE: + break; + + case PHVOLT_T_ADD: + phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); + break; + case PHVOLT_T_SUB: + phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); + break; + case PHVOLT_T_MUL: + phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); + break; + case PHVOLT_T_DIV: + phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); + break; + case PHVOLT_T_MOD: + phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); + break; + case PHVOLT_T_AND: + phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); + break; + case PHVOLT_T_OR: + phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); + break; + case PHVOLT_T_IS: + phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); + break; + case PHVOLT_T_EQUALS: + phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); + break; + case PHVOLT_T_NOTEQUALS: + phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); + break; + case PHVOLT_T_LESS: + phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); + break; + case PHVOLT_T_GREATER: + phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); + break; + case PHVOLT_T_GREATEREQUAL: + phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); + break; + case PHVOLT_T_LESSEQUAL: + phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); + break; + case PHVOLT_T_IDENTICAL: + phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOTIDENTICAL: + phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOT: + phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); + break; + case PHVOLT_T_DOT: + phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); + break; + case PHVOLT_T_CONCAT: + phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); + break; + case PHVOLT_T_RANGE: + phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); + break; + case PHVOLT_T_PIPE: + phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); + break; + case PHVOLT_T_COMMA: + phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); + break; + case PHVOLT_T_COLON: + phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); + break; + case PHVOLT_T_QUESTION: + phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); + break; + + case PHVOLT_T_PARENTHESES_OPEN: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); + break; + case PHVOLT_T_PARENTHESES_CLOSE: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_EDELIMITER: + if (state->extends_mode == 1 && state->block_level == 0) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_EDELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_NULL: + phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); + break; + case PHVOLT_T_TRUE: + phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); + break; + case PHVOLT_T_FALSE: + phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); + break; + + case PHVOLT_T_INTEGER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); + break; + case PHVOLT_T_DOUBLE: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); + break; + case PHVOLT_T_STRING: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); + break; + case PHVOLT_T_IDENTIFIER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); + break; + + case PHVOLT_T_IF: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->if_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); + break; + + case PHVOLT_T_ELSE: + if (state->if_level == 0 && state->for_level > 0) { + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + } else { + phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + } + break; + + case PHVOLT_T_ELSEFOR: + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + break; + + case PHVOLT_T_ELSEIF: + if (state->if_level == 0) { + phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); + break; + + case PHVOLT_T_ENDIF: + state->block_level--; + state->if_level--; + phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); + break; + + case PHVOLT_T_FOR: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->old_if_level = state->if_level; + state->if_level = 0; + state->for_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); + break; + + case PHVOLT_T_IN: + phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); + break; + + case PHVOLT_T_ENDFOR: + state->block_level--; + state->for_level--; + state->if_level = state->old_if_level; + phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); + break; + + case PHVOLT_T_RAW_FRAGMENT: + if (token.len > 0) { + if (state->extends_mode == 1 && state->block_level == 0){ + if (!phvolt_is_blank_string(&token)) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + } + efree(token.value); + break; + } else { + if (!phvolt_is_blank_string(&token)) { + state->statement_position++; + } + } + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } else { + efree(token.value); + } + break; + + case PHVOLT_T_SET: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); + break; + case PHVOLT_T_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_ADD_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_SUB_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_MUL_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_DIV_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); + break; + + case PHVOLT_T_INCR: + phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); + break; + case PHVOLT_T_DECR: + phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); + break; + + case PHVOLT_T_BLOCK: + if (state->block_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); + break; + case PHVOLT_T_ENDBLOCK: + state->block_level--; + phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); + break; + + case PHVOLT_T_MACRO: + if (state->macro_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->macro_level++; + } + phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); + break; + case PHVOLT_T_ENDMACRO: + state->macro_level--; + phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); + break; + + case PHVOLT_T_CALL: + phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); + break; + case PHVOLT_T_ENDCALL: + phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); + break; + + case PHVOLT_T_CACHE: + phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); + break; + case PHVOLT_T_ENDCACHE: + phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); + break; + + case PHVOLT_T_RAW: + phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); + state->forced_raw_state++; + break; + case PHVOLT_T_ENDRAW: + phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); + state->forced_raw_state--; + break; + + case PHVOLT_T_INCLUDE: + phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); + break; + + case PHVOLT_T_WITH: + phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); + break; + + case PHVOLT_T_DEFINED: + phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); + break; + + case PHVOLT_T_EMPTY: + phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); + break; + + case PHVOLT_T_EVEN: + phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); + break; + + case PHVOLT_T_ODD: + phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); + break; + + case PHVOLT_T_NUMERIC: + phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); + break; + + case PHVOLT_T_SCALAR: + phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); + break; + + case PHVOLT_T_ITERABLE: + phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); + break; + + case PHVOLT_T_DO: + phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); + break; + case PHVOLT_T_RETURN: + phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); + break; + + case PHVOLT_T_AUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_ENDAUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_BREAK: + phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); + break; + + case PHVOLT_T_CONTINUE: + phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); + break; + + case PHVOLT_T_EXTENDS: + if (state->statement_position != 1) { + phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->extends_mode = 1; + } + phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); + break; + + default: + parser_status->status = PHVOLT_PARSING_FAILED; + error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); + snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, error, 1); + } +#else + if (Z_TYPE_P(*error_msg) == IS_NULL) { + ZVAL_STRING((*error_msg), error); + } +#endif + efree(error); + break; + } + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + break; + } + + state->end = state->start; + } + + if (status != FAILURE) { + switch (scanner_status) { + case PHVOLT_SCANNER_RETCODE_ERR: + case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: + if (!*error_msg) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } else { + if (Z_TYPE_P(*error_msg) == IS_NULL) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } + } + status = FAILURE; + break; + default: + phvolt_(phvolt_parser, 0, NULL, parser_status); + } + } + + state->active_token = 0; + state->start = NULL; + efree(state->raw_buffer); + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + if (parser_status->syntax_error) { +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); + } +#else + ZVAL_STRING(*error_msg, parser_status->syntax_error); +#endif + efree(parser_status->syntax_error); + } + } + + phvolt_Free(phvolt_parser, phvolt_wrapper_free); + + if (status != FAILURE) { + if (parser_status->status == PHVOLT_PARSING_OK) { +#if PHP_VERSION_ID < 70000 + if (parser_status->ret) { + ZVAL_ZVAL(*result, parser_status->ret, 0, 0); + ZVAL_NULL(parser_status->ret); + zval_ptr_dtor(&parser_status->ret); + } else { + array_init(*result); + } +#else + if (Z_TYPE(parser_status->ret) != IS_UNDEF) { + ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); + } else { + array_init(*result); + } +#endif + } + } + + efree(parser_status); + efree(state); + + return status; +} /* Generated by re2c 0.13.6 on Sun May 1 19:16:49 2016 */ @@ -167934,7 +139017,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { number = zephir_fast_count_int(items TSRMLS_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, show); - ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 322, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 287, &_2); zephir_check_call_status(); roundedTotal = zephir_safe_div_long_zval(number, _3 TSRMLS_CC); totalPages = (int) (roundedTotal); @@ -167945,7 +139028,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { ZVAL_LONG(&_2, (show * ((pageNumber - 1)))); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, show); - ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 396, items, &_2, &_4); + ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 361, items, &_2, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(items, _5); if (pageNumber < totalPages) { @@ -168291,7 +139374,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_4$$4); ZEPHIR_MAKE_REF(_3$$4); ZEPHIR_MAKE_REF(_4$$4); - ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 407, _1$$4, _2$$4, _3$$4, _4$$4); + ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 372, _1$$4, _2$$4, _3$$4, _4$$4); ZEPHIR_UNREF(_3$$4); ZEPHIR_UNREF(_4$$4); zephir_check_call_status(); @@ -168304,7 +139387,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_8$$5); ZEPHIR_MAKE_REF(_7$$5); ZEPHIR_MAKE_REF(_8$$5); - ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 408, _5$$5, _6$$5, _7$$5, _8$$5); + ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 373, _5$$5, _6$$5, _7$$5, _8$$5); ZEPHIR_UNREF(_7$$5); ZEPHIR_UNREF(_8$$5); zephir_check_call_status(); @@ -168315,7 +139398,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { } ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, -1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 409, connection, &_9, ZEPHIR_GLOBAL(global_null)); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 374, connection, &_9, ZEPHIR_GLOBAL(global_null)); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC); RETURN_CCTOR(connection); @@ -168363,7 +139446,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, put) { ZEPHIR_CONCAT_SVSVSVSVSV(_0, "put ", priority, " ", delay, " ", ttr, " ", length, "\r\n", serialized); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 190 TSRMLS_CC); _1 = !ZEPHIR_IS_STRING(status, "INSERTED"); @@ -168400,7 +139483,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { } ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, command); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_0, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 215 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_0, "RESERVED")) { @@ -168413,7 +139496,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_4, "unserialize", NULL, 66, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _1, _4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _1, _4); zephir_check_call_status(); RETURN_MM(); @@ -168444,7 +139527,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, choose) { ZEPHIR_CONCAT_SV(_0, "use ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 238 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168480,7 +139563,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, watch) { ZEPHIR_CONCAT_SV(_0, "watch ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 255 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168517,7 +139600,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, ignore) { ZEPHIR_CONCAT_SV(_0, "ignore ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 272 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168557,7 +139640,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, pauseTube) { ZEPHIR_CONCAT_SVSV(_1, "pause-tube ", tube, " ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 289 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "PAUSED")) { @@ -168585,7 +139668,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, kick) { ZEPHIR_CONCAT_SV(_1, "kick ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 306 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "KICKED")) { @@ -168609,7 +139692,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, stats) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 323 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168645,7 +139728,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, statsTube) { ZEPHIR_CONCAT_SV(_0, "stats-tube ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 340 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168668,7 +139751,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubes) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 357 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168691,7 +139774,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubeUsed) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 374 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168714,7 +139797,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubesWatched) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 391 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168737,7 +139820,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 408 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168750,7 +139833,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168768,7 +139851,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 425 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168781,7 +139864,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168802,7 +139885,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 444 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168815,7 +139898,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168839,7 +139922,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { ZEPHIR_CONCAT_SV(_1, "peek ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 462 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168852,7 +139935,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168883,7 +139966,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); ZEPHIR_OBS_VAR(status); zephir_array_fetch_long(&status, response, 0, PH_NOISY, "phalcon/queue/beanstalk.zep", 491 TSRMLS_CC); @@ -168892,7 +139975,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { zephir_array_fetch_long(&numberOfBytes, response, 1, PH_NOISY, "phalcon/queue/beanstalk.zep", 494 TSRMLS_CC); ZEPHIR_CALL_METHOD(&response, this_ptr, "read", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 413, response); + ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 378, response); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(numberOfBytes); @@ -168939,13 +140022,13 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { } ZEPHIR_SINIT_VAR(_0$$5); ZVAL_LONG(&_0$$5, (length + 2)); - ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 414, connection, &_0$$5); + ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 379, connection, &_0$$5); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$5); ZVAL_STRING(&_0$$5, "\r\n", 0); ZEPHIR_INIT_VAR(data); zephir_fast_trim(data, _1$$5, &_0$$5, ZEPHIR_TRIM_RIGHT TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 415, connection); + ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 380, connection); zephir_check_call_status(); zephir_array_fetch_string(&_4$$5, _3$$5, SL("timed_out"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 535 TSRMLS_CC); if (zephir_is_true(_4$$5)) { @@ -168957,7 +140040,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { ZVAL_LONG(&_5$$8, 16384); ZEPHIR_SINIT_VAR(_6$$8); ZVAL_STRING(&_6$$8, "\r\n", 0); - ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 414, connection, &_5$$8, &_6$$8); + ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 379, connection, &_5$$8, &_6$$8); zephir_check_call_status(); } if (ZEPHIR_IS_STRING_IDENTICAL(data, "UNKNOWN_COMMAND")) { @@ -169006,7 +140089,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, write) { ZEPHIR_CPY_WRT(packet, _0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, zephir_fast_strlen_ev(packet)); - ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 416, connection, packet, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 381, connection, packet, &_1); zephir_check_call_status(); RETURN_MM(); @@ -169355,7 +140438,7 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { if ((zephir_function_exists_ex(SS("random_bytes") TSRMLS_CC) == SUCCESS)) { ZEPHIR_SINIT_VAR(_0$$4); ZVAL_LONG(&_0$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 427, &_0$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 392, &_0$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169380,16 +140463,16 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { ZVAL_STRING(&_4$$7, "/dev/urandom", 0); ZEPHIR_SINIT_VAR(_5$$7); ZVAL_STRING(&_5$$7, "rb", 0); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 298, &_4$$7, &_5$$7); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 263, &_4$$7, &_5$$7); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(handle)) { ZEPHIR_SINIT_VAR(_6$$8); ZVAL_LONG(&_6$$8, 0); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 428, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 393, handle, &_6$$8); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_6$$8); ZVAL_LONG(&_6$$8, len); - ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 429, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 394, handle, &_6$$8); zephir_check_call_status(); zephir_fclose(handle TSRMLS_CC); if (zephir_fast_strlen_ev(ret) != len) { @@ -169425,7 +140508,7 @@ static PHP_METHOD(Phalcon_Security_Random, hex) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_MAKE_REF(_3); ZEPHIR_RETURN_CALL_FUNCTION("array_shift", NULL, 132, _3); @@ -169462,7 +140545,7 @@ static PHP_METHOD(Phalcon_Security_Random, base58) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "C*", 0); - ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 430, &_1, _0); + ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 395, &_1, _0); zephir_check_call_status(); zephir_is_iterable(bytes, &_3, &_2, 0, 0, "phalcon/security/random.zep", 205); for ( @@ -169576,7 +140659,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "N1a/n1b/n1c/n1d/n1e/N1f", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&ary, "array_values", NULL, 224, _3); zephir_check_call_status(); @@ -169591,7 +140674,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "%08x-%04x-%04x-%04x-%04x%08x", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_MAKE_REF(ary); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, ary, _7); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, ary, _7); zephir_check_temp_parameter(_7); ZEPHIR_UNREF(ary); zephir_check_call_status(); @@ -169628,7 +140711,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_0$$4, 0); ZEPHIR_SINIT_VAR(_1$$4); ZVAL_LONG(&_1$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 431, &_0$$4, &_1$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 396, &_0$$4, &_1$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169641,7 +140724,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, len); - ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 432, &_4); + ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 397, &_4); zephir_check_call_status(); if (((zephir_fast_strlen_ev(hex) & 1)) == 1) { ZEPHIR_INIT_VAR(_5$$6); @@ -169650,7 +140733,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 433, &_4, hex); + ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 398, &_4, hex); zephir_check_call_status(); zephir_concat_self(&bin, _6 TSRMLS_CC); _7 = ZEPHIR_STRING_OFFSET(bin, 0); @@ -169688,19 +140771,19 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_19$$7, 0); ZEPHIR_SINIT_NVAR(_20$$7); ZVAL_LONG(&_20$$7, 1); - ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 434, rnd, _16$$7, &_19$$7, &_20$$7); + ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 399, rnd, _16$$7, &_19$$7, &_20$$7); zephir_check_call_status(); ZEPHIR_CPY_WRT(rnd, _21$$7); } while (ZEPHIR_LT(bin, rnd)); ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 430, &_4, rnd); + ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 395, &_4, rnd); zephir_check_call_status(); ZEPHIR_MAKE_REF(ret); ZEPHIR_CALL_FUNCTION(&_23, "array_shift", NULL, 132, ret); ZEPHIR_UNREF(ret); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 435, _23); + ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 400, _23); zephir_check_call_status(); RETURN_MM(); @@ -170667,7 +141750,7 @@ static PHP_METHOD(Phalcon_Session_Bag, getIterator) { } object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 439, _1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 404, _1); zephir_check_call_status(); RETURN_MM(); @@ -170919,7 +142002,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { } ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2592000); - ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 436, lifetime, _0); + ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 401, lifetime, _0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_lifetime"), _1 TSRMLS_CC); ZEPHIR_OBS_VAR(prefix); @@ -170946,7 +142029,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); ZEPHIR_INIT_VAR(_5); zephir_create_array(_5, 5, 0 TSRMLS_CC); @@ -170955,7 +142038,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { zephir_array_update_string(&_5, SL("prefix"), &prefix, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("statsKey"), &statsKey, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("persistent_id"), &persistentId, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 335, _2, _5); + ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 300, _2, _5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_libmemcached"), _0 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -170994,9 +142077,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171205,9 +142288,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_OBS_VAR(_6); zephir_read_property_this(&_6, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_5, SL("lifetime"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 334, _5); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 299, _5); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 337, _4, options); + ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 302, _4, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _3 TSRMLS_CC); ZEPHIR_INIT_VAR(_7); @@ -171246,9 +142329,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "gc", 1); zephir_array_fast_append(_13, _8); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _7, _9, _10, _11, _12, _13); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _7, _9, _10, _11, _12, _13); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171444,7 +142527,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 0, _4); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 338, _3, options); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 303, _3, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _2 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -171483,9 +142566,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171738,7 +142821,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_10$$24, "PHP_EOL"); ZEPHIR_INIT_VAR(_11$$24); ZEPHIR_CONCAT_SV(_11$$24, "", _10$$24); - ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 443, options, using, value, _11$$24); + ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 408, options, using, value, _11$$24); zephir_check_call_status(); zephir_concat_self(&code, _8$$24 TSRMLS_CC); } else { @@ -171747,7 +142830,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_14$$26, "PHP_EOL"); ZEPHIR_INIT_VAR(_15$$26); ZEPHIR_CONCAT_SV(_15$$26, "", _14$$26); - ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 444, options, value, _15$$26); + ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 409, options, value, _15$$26); zephir_check_call_status(); zephir_concat_self(&code, _12$$26 TSRMLS_CC); } else { @@ -171787,7 +142870,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromResultset) { ZEPHIR_OBS_VAR(usingOne); zephir_array_fetch_long(&usingOne, using, 1, PH_NOISY, "phalcon/tag/select.zep", 168 TSRMLS_CC); } - ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 445); + ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 410); zephir_check_call_status(); ZEPHIR_CPY_WRT(escaper, _0); _2 = zephir_get_iterator(resultset TSRMLS_CC); @@ -171900,7 +142983,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromArray) { if (Z_TYPE_P(optionText) == IS_ARRAY) { ZEPHIR_INIT_NVAR(_4$$4); ZEPHIR_GET_CONSTANT(_4$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 444, optionText, value, closeOption); + ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 409, optionText, value, closeOption); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_7$$4); ZEPHIR_GET_CONSTANT(_7$$4, "PHP_EOL"); @@ -172271,7 +143354,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); if (!(zephir_array_isset_string(options, SS("content")))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_translate_exception_ce, "Parameter 'content' is required", "phalcon/translate/adapter/csv.zep", 42); @@ -172284,7 +143367,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { ZVAL_STRING(_3, ";", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "\"", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 455, _1, _2, _3, _4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 420, _1, _2, _3, _4); zephir_check_temp_parameter(_3); zephir_check_temp_parameter(_4); zephir_check_call_status(); @@ -172306,7 +143389,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rb", 0); - ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 298, file, &_0); + ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 263, file, &_0); zephir_check_call_status(); if (Z_TYPE_P(fileHandler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_1$$3); @@ -172320,7 +143403,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { return; } while (1) { - ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 456, fileHandler, length, delimiter, enclosure); + ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 421, fileHandler, length, delimiter, enclosure); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(data)) { break; @@ -172538,7 +143621,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, query) { } - ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 457, index); + ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 0, index); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); zephir_check_call_status(); @@ -172576,7 +143659,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, exists) { static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { int count, ZEPHIR_LAST_CALL_STATUS; - zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, _0$$3, _1$$4; + zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, *_0$$3, *_1$$4; zval *msgid1 = NULL, *msgid2 = NULL, *domain = NULL; ZEPHIR_MM_GROW(); @@ -172628,14 +143711,14 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { if (!(!(!domain) && Z_STRLEN_P(domain))) { - ZEPHIR_SINIT_VAR(_0$$3); - ZVAL_LONG(&_0$$3, count); - ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 458, msgid1, msgid2, &_0$$3); + ZEPHIR_INIT_VAR(_0$$3); + ZVAL_LONG(_0$$3, count); + ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 0, msgid1, msgid2, _0$$3); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_LONG(&_1$$4, count); - ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 459, domain, msgid1, msgid2, &_1$$4); + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_LONG(_1$$4, count); + ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 0, domain, msgid1, msgid2, _1$$4); zephir_check_call_status(); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); @@ -172654,7 +143737,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDomain) { - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, domain); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, domain); zephir_check_call_status(); RETURN_MM(); @@ -172669,7 +143752,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, resetDomain) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, _0); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, _0); zephir_check_call_status(); RETURN_MM(); @@ -172705,8 +143788,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { HashTable *_1$$4; HashPosition _0$$4; int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_3 = NULL; - zval *directory, *key = NULL, *value = NULL, **_2$$4, *_4$$6 = NULL; + zval *directory, *key = NULL, *value = NULL, **_2$$4, *_3$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &directory); @@ -172725,13 +143807,13 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { ) { ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, key, value); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, key, value); zephir_check_call_status(); } } else { - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getdefaultdomain", NULL, 0); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, _4$$6, directory); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, _3$$6, directory); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -172779,21 +143861,21 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setLocale) { _3 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_4); ZEPHIR_CONCAT_SV(_4, "LC_ALL=", _3); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _4); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _4); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SV(_7, "LANG=", _6); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _7); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _7); zephir_check_call_status(); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SV(_9, "LANGUAGE=", _8); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _9); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _9); zephir_check_call_status(); _10 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 6); + ZVAL_LONG(&_11, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", NULL, 442, &_11, _10); zephir_check_call_status(); RETURN_MM_MEMBER(this_ptr, "_locale"); @@ -172847,7 +143929,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, getOptionsDefault) { zephir_create_array(return_value, 2, 0 TSRMLS_CC); - add_assoc_long_ex(return_value, SS("category"), 6); + add_assoc_long_ex(return_value, SS("category"), 0); add_assoc_stringl_ex(return_value, SS("defaultDomain"), SL("messages"), 1); return; @@ -172887,7 +143969,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(data); if (!(zephir_array_isset_string_fetch(&data, options, SS("content"), 0 TSRMLS_CC))) { @@ -173081,7 +144163,7 @@ static PHP_METHOD(Phalcon_Translate_Interpolator_IndexedArray, replacePlaceholde } if (_0) { ZEPHIR_MAKE_REF(placeholders); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, placeholders, translation); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, placeholders, translation); ZEPHIR_UNREF(placeholders); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1$$3); @@ -173338,7 +144420,7 @@ static PHP_METHOD(Phalcon_Validation_Message, __set_state) { zephir_array_fetch_string(&_0, message, SL("_message"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_1, message, SL("_field"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_2, message, SL("_type"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 465, _0, _1, _2); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 460, _0, _1, _2); zephir_check_call_status(); RETURN_MM(); @@ -173691,7 +144773,7 @@ static PHP_METHOD(Phalcon_Validation_Message_Group, offsetUnset) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_LONG(_2$$3, 1); ZEPHIR_MAKE_REF(_1$$3); - ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 466, _1$$3, index, _2$$3); + ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 461, _1$$3, index, _2$$3); ZEPHIR_UNREF(_1$$3); zephir_check_call_status(); } @@ -173951,7 +145033,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 467, value); + ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 462, value); zephir_check_call_status(); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_VAR(_1$$3); @@ -174001,7 +145083,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "Alnum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -174106,7 +145188,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alpha, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Alpha", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -174231,7 +145313,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Between, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$5); ZVAL_STRING(_10$$5, "Between", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 465, _9$$5, field, _10$$5, code); + ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 460, _9$$5, field, _10$$5, code); zephir_check_temp_parameter(_10$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _4$$5); @@ -174294,7 +145376,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(&valueWith, validation, "getvalue", NULL, 0, fieldWith); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 468, value, valueWith); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 463, value, valueWith); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$4); @@ -174358,7 +145440,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$4); ZVAL_STRING(_10$$4, "Confirmation", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 465, _9$$4, field, _10$$4, code); + ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 460, _9$$4, field, _10$$4, code); zephir_check_temp_parameter(_10$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$4); @@ -174451,7 +145533,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 469, value); + ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 464, value); zephir_check_call_status(); if (!(zephir_is_true(valid))) { ZEPHIR_INIT_VAR(_0$$3); @@ -174501,7 +145583,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_6$$3); ZVAL_STRING(_6$$3, "CreditCard", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 465, _5$$3, field, _6$$3, code); + ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 460, _5$$3, field, _6$$3, code); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0$$3); @@ -174532,7 +145614,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm ZEPHIR_CPY_WRT(digits, _2); ZEPHIR_INIT_VAR(hash); ZVAL_STRING(hash, "", 1); - ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 470, digits); + ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 465, digits); zephir_check_call_status(); zephir_is_iterable(_4, &_6, &_5, 0, 0, "phalcon/validation/validator/creditcard.zep", 118); for ( @@ -174552,7 +145634,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm } ZEPHIR_CALL_FUNCTION(&_9, "str_split", &_1, 74, hash); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 471, _9); + ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 466, _9); zephir_check_call_status(); RETURN_MM_BOOL((zephir_safe_mod_zval_long(result, 10 TSRMLS_CC) == 0)); @@ -174612,7 +145694,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { ZEPHIR_INIT_NVAR(format); ZVAL_STRING(format, "Y-m-d", 1); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 472, value, format); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 467, value, format); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$5); @@ -174653,7 +145735,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$5); ZVAL_STRING(_8$$5, "Date", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 465, _7$$5, field, _8$$5); + ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 460, _7$$5, field, _8$$5); zephir_check_temp_parameter(_8$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$5); @@ -174742,7 +145824,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); _0 = Z_TYPE_P(value) == IS_LONG; if (!(_0)) { - ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 473, value); + ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 468, value); zephir_check_call_status(); _0 = zephir_is_true(_1); } @@ -174796,7 +145878,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "Digit", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 465, _7, field, _8, code); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 460, _7, field, _8, code); zephir_check_temp_parameter(_8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2); @@ -174898,7 +145980,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Email, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); @@ -175040,7 +146122,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_ExclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "ExclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175168,7 +146250,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_16$$6); ZVAL_STRING(_16$$6, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 465, _14$$6, field, _16$$6, code); + ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 460, _14$$6, field, _16$$6, code); zephir_check_temp_parameter(_16$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11$$6); @@ -175217,7 +146299,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_28$$9); ZVAL_STRING(_28$$9, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 465, _27$$9, field, _28$$9, code); + ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 460, _27$$9, field, _28$$9, code); zephir_check_temp_parameter(_28$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _24$$9); @@ -175258,7 +146340,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_35$$12); ZVAL_STRING(_35$$12, "FileValid", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 465, _34$$12, field, _35$$12, code); + ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 460, _34$$12, field, _35$$12, code); zephir_check_temp_parameter(_35$$12); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _31$$12); @@ -175349,7 +146431,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_54$$18); ZVAL_STRING(_54$$18, "FileSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 465, _53$$18, field, _54$$18, code); + ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 460, _53$$18, field, _54$$18, code); zephir_check_temp_parameter(_54$$18); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _50$$18); @@ -175419,7 +146501,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_63$$26); ZVAL_STRING(_63$$26, "FileType", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 465, _62$$26, field, _63$$26, code); + ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 460, _62$$26, field, _63$$26, code); zephir_check_temp_parameter(_63$$26); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _59$$26); @@ -175507,7 +146589,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_77$$33); ZVAL_STRING(_77$$33, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 465, _76$$33, field, _77$$33, code); + ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 460, _76$$33, field, _77$$33, code); zephir_check_temp_parameter(_77$$33); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _73$$33); @@ -175566,7 +146648,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_86$$38); ZVAL_STRING(_86$$38, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 465, _85$$38, field, _86$$38, code); + ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 460, _85$$38, field, _86$$38, code); zephir_check_temp_parameter(_86$$38); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _82$$38); @@ -175741,7 +146823,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Identical, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_14$$8); ZVAL_STRING(_14$$8, "Identical", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 465, _13$$8, field, _14$$8, code); + ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 460, _13$$8, field, _14$$8, code); zephir_check_temp_parameter(_14$$8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$8); @@ -175883,7 +146965,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_InclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "InclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175988,7 +147070,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Numericality, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -176093,7 +147175,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_PresenceOf, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176213,7 +147295,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Regex, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$6); ZVAL_STRING(_9$$6, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 465, _8$$6, field, _9$$6, code); + ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 460, _8$$6, field, _9$$6, code); zephir_check_temp_parameter(_9$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$6); @@ -176351,7 +147433,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$11); ZVAL_STRING(_11$$11, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 465, _9$$11, field, _11$$11, code); + ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 460, _9$$11, field, _11$$11, code); zephir_check_temp_parameter(_11$$11); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _6$$11); @@ -176396,7 +147478,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_19$$16); ZVAL_STRING(_19$$16, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 465, _18$$16, field, _19$$16, code); + ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 460, _18$$16, field, _19$$16, code); zephir_check_temp_parameter(_19$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _15$$16); @@ -176477,7 +147559,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, validate) { zephir_check_call_status(); ZEPHIR_INIT_NVAR(_6$$3); ZVAL_STRING(_6$$3, "Uniqueness", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _4$$3, field, _6$$3, _5$$3); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _4$$3, field, _6$$3, _5$$3); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176944,7 +148026,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Url, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); diff --git a/build/php5/64bits/php_phalcon.h b/build/php5/64bits/php_phalcon.h index f8a6d35836e..aa0591bfc62 100644 --- a/build/php5/64bits/php_phalcon.h +++ b/build/php5/64bits/php_phalcon.h @@ -185,7 +185,7 @@ typedef zend_function zephir_fcall_cache_entry; #define PHP_PHALCON_VERSION "3.0.4" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" -#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev" +#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev-aef205594b" #define PHP_PHALCON_DESCRIPTION "Web framework delivered as a C-extension for PHP" typedef struct _zephir_struct_db { diff --git a/build/php5/safe/phalcon.zep.c b/build/php5/safe/phalcon.zep.c index 14cec92404d..44c18c7b78e 100644 --- a/build/php5/safe/phalcon.zep.c +++ b/build/php5/safe/phalcon.zep.c @@ -17463,947 +17463,74 @@ static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); #endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ +/* jsmin.c + 2013-03-29 -/* This file was generated automatically by Zephir do not modify it! */ - -#ifdef HAVE_CONFIG_H -#endif - - -#if PHP_VERSION_ID < 50500 -#endif - - - - - - -zend_class_entry *phalcon_di_injectionawareinterface_ce; -zend_class_entry *phalcon_events_eventsawareinterface_ce; -zend_class_entry *phalcon_validation_validatorinterface_ce; -zend_class_entry *phalcon_forms_elementinterface_ce; -zend_class_entry *phalcon_mvc_model_validatorinterface_ce; -zend_class_entry *phalcon_cache_backendinterface_ce; -zend_class_entry *phalcon_cache_frontendinterface_ce; -zend_class_entry *phalcon_mvc_model_metadatainterface_ce; -zend_class_entry *phalcon_dispatcherinterface_ce; -zend_class_entry *phalcon_annotations_adapterinterface_ce; -zend_class_entry *phalcon_db_adapterinterface_ce; -zend_class_entry *phalcon_logger_adapterinterface_ce; -zend_class_entry *phalcon_logger_formatterinterface_ce; -zend_class_entry *phalcon_session_adapterinterface_ce; -zend_class_entry *phalcon_db_dialectinterface_ce; -zend_class_entry *phalcon_mvc_entityinterface_ce; -zend_class_entry *phalcon_mvc_model_resultsetinterface_ce; -zend_class_entry *phalcon_paginator_adapterinterface_ce; -zend_class_entry *phalcon_translate_adapterinterface_ce; -zend_class_entry *phalcon_assets_filterinterface_ce; -zend_class_entry *phalcon_diinterface_ce; -zend_class_entry *phalcon_flashinterface_ce; -zend_class_entry *phalcon_image_adapterinterface_ce; -zend_class_entry *phalcon_mvc_collection_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_model_behaviorinterface_ce; -zend_class_entry *phalcon_mvc_view_engineinterface_ce; -zend_class_entry *phalcon_mvc_viewbaseinterface_ce; -zend_class_entry *phalcon_acl_adapterinterface_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategyinterface_ce; -zend_class_entry *phalcon_mvc_model_resultinterface_ce; -zend_class_entry *phalcon_mvc_routerinterface_ce; -zend_class_entry *phalcon_translate_interpolatorinterface_ce; -zend_class_entry *phalcon_acl_resourceinterface_ce; -zend_class_entry *phalcon_acl_roleinterface_ce; -zend_class_entry *phalcon_annotations_readerinterface_ce; -zend_class_entry *phalcon_cli_dispatcherinterface_ce; -zend_class_entry *phalcon_cli_taskinterface_ce; -zend_class_entry *phalcon_cryptinterface_ce; -zend_class_entry *phalcon_db_columninterface_ce; -zend_class_entry *phalcon_db_indexinterface_ce; -zend_class_entry *phalcon_db_referenceinterface_ce; -zend_class_entry *phalcon_db_resultinterface_ce; -zend_class_entry *phalcon_di_serviceinterface_ce; -zend_class_entry *phalcon_escaperinterface_ce; -zend_class_entry *phalcon_events_eventinterface_ce; -zend_class_entry *phalcon_events_managerinterface_ce; -zend_class_entry *phalcon_filterinterface_ce; -zend_class_entry *phalcon_http_cookieinterface_ce; -zend_class_entry *phalcon_http_request_fileinterface_ce; -zend_class_entry *phalcon_http_requestinterface_ce; -zend_class_entry *phalcon_http_response_cookiesinterface_ce; -zend_class_entry *phalcon_http_response_headersinterface_ce; -zend_class_entry *phalcon_http_responseinterface_ce; -zend_class_entry *phalcon_mvc_collectioninterface_ce; -zend_class_entry *phalcon_mvc_controllerinterface_ce; -zend_class_entry *phalcon_mvc_dispatcherinterface_ce; -zend_class_entry *phalcon_mvc_micro_collectioninterface_ce; -zend_class_entry *phalcon_mvc_model_criteriainterface_ce; -zend_class_entry *phalcon_mvc_model_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_messageinterface_ce; -zend_class_entry *phalcon_mvc_model_query_builderinterface_ce; -zend_class_entry *phalcon_mvc_model_query_statusinterface_ce; -zend_class_entry *phalcon_mvc_model_queryinterface_ce; -zend_class_entry *phalcon_mvc_model_relationinterface_ce; -zend_class_entry *phalcon_mvc_model_transaction_managerinterface_ce; -zend_class_entry *phalcon_mvc_model_transactioninterface_ce; -zend_class_entry *phalcon_mvc_modelinterface_ce; -zend_class_entry *phalcon_mvc_router_groupinterface_ce; -zend_class_entry *phalcon_mvc_router_routeinterface_ce; -zend_class_entry *phalcon_mvc_urlinterface_ce; -zend_class_entry *phalcon_mvc_viewinterface_ce; -zend_class_entry *phalcon_session_baginterface_ce; -zend_class_entry *phalcon_validation_messageinterface_ce; -zend_class_entry *phalcon_validationinterface_ce; -zend_class_entry *phalcon_acl_resourceaware_ce; -zend_class_entry *phalcon_acl_roleaware_ce; -zend_class_entry *phalcon_cli_router_routeinterface_ce; -zend_class_entry *phalcon_cli_routerinterface_ce; -zend_class_entry *phalcon_filter_userfilterinterface_ce; -zend_class_entry *phalcon_mvc_collection_managerinterface_ce; -zend_class_entry *phalcon_mvc_controller_bindmodelinterface_ce; -zend_class_entry *phalcon_mvc_micro_middlewareinterface_ce; -zend_class_entry *phalcon_mvc_moduledefinitioninterface_ce; -zend_class_entry *phalcon_exception_ce; -zend_class_entry *phalcon_validation_validator_ce; -zend_class_entry *phalcon_di_injectable_ce; -zend_class_entry *phalcon_forms_element_ce; -zend_class_entry *phalcon_mvc_model_validator_ce; -zend_class_entry *phalcon_cache_backend_ce; -zend_class_entry *phalcon_mvc_model_metadata_ce; -zend_class_entry *phalcon_annotations_adapter_ce; -zend_class_entry *phalcon_config_ce; -zend_class_entry *phalcon_db_adapter_ce; -zend_class_entry *phalcon_logger_adapter_ce; -zend_class_entry *phalcon_logger_formatter_ce; -zend_class_entry *phalcon_session_adapter_ce; -zend_class_entry *phalcon_db_adapter_pdo_ce; -zend_class_entry *phalcon_db_dialect_ce; -zend_class_entry *phalcon_mvc_model_exception_ce; -zend_class_entry *phalcon_paginator_adapter_ce; -zend_class_entry *phalcon_translate_adapter_ce; -zend_class_entry *phalcon_application_ce; -zend_class_entry *phalcon_application_exception_ce; -zend_class_entry *phalcon_assets_inline_ce; -zend_class_entry *phalcon_assets_resource_ce; -zend_class_entry *phalcon_cache_frontend_data_ce; -zend_class_entry *phalcon_di_ce; -zend_class_entry *phalcon_dispatcher_ce; -zend_class_entry *phalcon_flash_ce; -zend_class_entry *phalcon_image_adapter_ce; -zend_class_entry *phalcon_mvc_collection_behavior_ce; -zend_class_entry *phalcon_mvc_model_behavior_ce; -zend_class_entry *phalcon_mvc_model_resultset_ce; -zend_class_entry *phalcon_mvc_view_engine_ce; -zend_class_entry *phalcon_acl_adapter_ce; -zend_class_entry *phalcon_di_factorydefault_ce; -zend_class_entry *phalcon_mvc_model_transaction_exception_ce; -zend_class_entry *phalcon_mvc_router_ce; -zend_class_entry *phalcon_mvc_view_exception_ce; -zend_class_entry *phalcon_validation_combinedfieldsvalidator_ce; -zend_class_entry *phalcon_0__closure_ce; -zend_class_entry *phalcon_1__closure_ce; -zend_class_entry *phalcon_acl_adapter_memory_ce; -zend_class_entry *phalcon_acl_ce; -zend_class_entry *phalcon_acl_exception_ce; -zend_class_entry *phalcon_acl_resource_ce; -zend_class_entry *phalcon_acl_role_ce; -zend_class_entry *phalcon_annotations_adapter_apc_ce; -zend_class_entry *phalcon_annotations_adapter_files_ce; -zend_class_entry *phalcon_annotations_adapter_memory_ce; -zend_class_entry *phalcon_annotations_adapter_xcache_ce; -zend_class_entry *phalcon_annotations_annotation_ce; -zend_class_entry *phalcon_annotations_collection_ce; -zend_class_entry *phalcon_annotations_exception_ce; -zend_class_entry *phalcon_annotations_reader_ce; -zend_class_entry *phalcon_annotations_reflection_ce; -zend_class_entry *phalcon_assets_collection_ce; -zend_class_entry *phalcon_assets_exception_ce; -zend_class_entry *phalcon_assets_filters_cssmin_ce; -zend_class_entry *phalcon_assets_filters_jsmin_ce; -zend_class_entry *phalcon_assets_filters_none_ce; -zend_class_entry *phalcon_assets_inline_css_ce; -zend_class_entry *phalcon_assets_inline_js_ce; -zend_class_entry *phalcon_assets_manager_ce; -zend_class_entry *phalcon_assets_resource_css_ce; -zend_class_entry *phalcon_assets_resource_js_ce; -zend_class_entry *phalcon_cache_backend_apc_ce; -zend_class_entry *phalcon_cache_backend_file_ce; -zend_class_entry *phalcon_cache_backend_libmemcached_ce; -zend_class_entry *phalcon_cache_backend_memcache_ce; -zend_class_entry *phalcon_cache_backend_memory_ce; -zend_class_entry *phalcon_cache_backend_mongo_ce; -zend_class_entry *phalcon_cache_backend_redis_ce; -zend_class_entry *phalcon_cache_backend_xcache_ce; -zend_class_entry *phalcon_cache_exception_ce; -zend_class_entry *phalcon_cache_frontend_base64_ce; -zend_class_entry *phalcon_cache_frontend_igbinary_ce; -zend_class_entry *phalcon_cache_frontend_json_ce; -zend_class_entry *phalcon_cache_frontend_msgpack_ce; -zend_class_entry *phalcon_cache_frontend_none_ce; -zend_class_entry *phalcon_cache_frontend_output_ce; -zend_class_entry *phalcon_cache_multiple_ce; -zend_class_entry *phalcon_cli_console_ce; -zend_class_entry *phalcon_cli_console_exception_ce; -zend_class_entry *phalcon_cli_dispatcher_ce; -zend_class_entry *phalcon_cli_dispatcher_exception_ce; -zend_class_entry *phalcon_cli_router_ce; -zend_class_entry *phalcon_cli_router_exception_ce; -zend_class_entry *phalcon_cli_router_route_ce; -zend_class_entry *phalcon_cli_task_ce; -zend_class_entry *phalcon_config_adapter_ini_ce; -zend_class_entry *phalcon_config_adapter_json_ce; -zend_class_entry *phalcon_config_adapter_php_ce; -zend_class_entry *phalcon_config_adapter_yaml_ce; -zend_class_entry *phalcon_config_exception_ce; -zend_class_entry *phalcon_crypt_ce; -zend_class_entry *phalcon_crypt_exception_ce; -zend_class_entry *phalcon_db_adapter_pdo_mysql_ce; -zend_class_entry *phalcon_db_adapter_pdo_postgresql_ce; -zend_class_entry *phalcon_db_adapter_pdo_sqlite_ce; -zend_class_entry *phalcon_db_ce; -zend_class_entry *phalcon_db_column_ce; -zend_class_entry *phalcon_db_dialect_mysql_ce; -zend_class_entry *phalcon_db_dialect_postgresql_ce; -zend_class_entry *phalcon_db_dialect_sqlite_ce; -zend_class_entry *phalcon_db_exception_ce; -zend_class_entry *phalcon_db_index_ce; -zend_class_entry *phalcon_db_profiler_ce; -zend_class_entry *phalcon_db_profiler_item_ce; -zend_class_entry *phalcon_db_rawvalue_ce; -zend_class_entry *phalcon_db_reference_ce; -zend_class_entry *phalcon_db_result_pdo_ce; -zend_class_entry *phalcon_debug_ce; -zend_class_entry *phalcon_debug_dump_ce; -zend_class_entry *phalcon_debug_exception_ce; -zend_class_entry *phalcon_di_exception_ce; -zend_class_entry *phalcon_di_factorydefault_cli_ce; -zend_class_entry *phalcon_di_service_builder_ce; -zend_class_entry *phalcon_di_service_ce; -zend_class_entry *phalcon_escaper_ce; -zend_class_entry *phalcon_escaper_exception_ce; -zend_class_entry *phalcon_events_event_ce; -zend_class_entry *phalcon_events_exception_ce; -zend_class_entry *phalcon_events_manager_ce; -zend_class_entry *phalcon_filter_ce; -zend_class_entry *phalcon_filter_exception_ce; -zend_class_entry *phalcon_flash_direct_ce; -zend_class_entry *phalcon_flash_exception_ce; -zend_class_entry *phalcon_flash_session_ce; -zend_class_entry *phalcon_forms_element_check_ce; -zend_class_entry *phalcon_forms_element_date_ce; -zend_class_entry *phalcon_forms_element_email_ce; -zend_class_entry *phalcon_forms_element_file_ce; -zend_class_entry *phalcon_forms_element_hidden_ce; -zend_class_entry *phalcon_forms_element_numeric_ce; -zend_class_entry *phalcon_forms_element_password_ce; -zend_class_entry *phalcon_forms_element_radio_ce; -zend_class_entry *phalcon_forms_element_select_ce; -zend_class_entry *phalcon_forms_element_submit_ce; -zend_class_entry *phalcon_forms_element_text_ce; -zend_class_entry *phalcon_forms_element_textarea_ce; -zend_class_entry *phalcon_forms_exception_ce; -zend_class_entry *phalcon_forms_form_ce; -zend_class_entry *phalcon_forms_manager_ce; -zend_class_entry *phalcon_http_cookie_ce; -zend_class_entry *phalcon_http_cookie_exception_ce; -zend_class_entry *phalcon_http_request_ce; -zend_class_entry *phalcon_http_request_exception_ce; -zend_class_entry *phalcon_http_request_file_ce; -zend_class_entry *phalcon_http_response_ce; -zend_class_entry *phalcon_http_response_cookies_ce; -zend_class_entry *phalcon_http_response_exception_ce; -zend_class_entry *phalcon_http_response_headers_ce; -zend_class_entry *phalcon_image_adapter_gd_ce; -zend_class_entry *phalcon_image_adapter_imagick_ce; -zend_class_entry *phalcon_image_ce; -zend_class_entry *phalcon_image_exception_ce; -zend_class_entry *phalcon_kernel_ce; -zend_class_entry *phalcon_loader_ce; -zend_class_entry *phalcon_loader_exception_ce; -zend_class_entry *phalcon_logger_adapter_file_ce; -zend_class_entry *phalcon_logger_adapter_firephp_ce; -zend_class_entry *phalcon_logger_adapter_stream_ce; -zend_class_entry *phalcon_logger_adapter_syslog_ce; -zend_class_entry *phalcon_logger_ce; -zend_class_entry *phalcon_logger_exception_ce; -zend_class_entry *phalcon_logger_formatter_firephp_ce; -zend_class_entry *phalcon_logger_formatter_json_ce; -zend_class_entry *phalcon_logger_formatter_line_ce; -zend_class_entry *phalcon_logger_formatter_syslog_ce; -zend_class_entry *phalcon_logger_item_ce; -zend_class_entry *phalcon_logger_multiple_ce; -zend_class_entry *phalcon_mvc_application_ce; -zend_class_entry *phalcon_mvc_application_exception_ce; -zend_class_entry *phalcon_mvc_collection_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_collection_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_collection_ce; -zend_class_entry *phalcon_mvc_collection_document_ce; -zend_class_entry *phalcon_mvc_collection_exception_ce; -zend_class_entry *phalcon_mvc_collection_manager_ce; -zend_class_entry *phalcon_mvc_controller_ce; -zend_class_entry *phalcon_mvc_dispatcher_ce; -zend_class_entry *phalcon_mvc_dispatcher_exception_ce; -zend_class_entry *phalcon_mvc_micro_ce; -zend_class_entry *phalcon_mvc_micro_collection_ce; -zend_class_entry *phalcon_mvc_micro_exception_ce; -zend_class_entry *phalcon_mvc_micro_lazyloader_ce; -zend_class_entry *phalcon_mvc_model_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_model_behavior_timestampable_ce; -zend_class_entry *phalcon_mvc_model_ce; -zend_class_entry *phalcon_mvc_model_criteria_ce; -zend_class_entry *phalcon_mvc_model_manager_ce; -zend_class_entry *phalcon_mvc_model_message_ce; -zend_class_entry *phalcon_mvc_model_metadata_apc_ce; -zend_class_entry *phalcon_mvc_model_metadata_files_ce; -zend_class_entry *phalcon_mvc_model_metadata_libmemcached_ce; -zend_class_entry *phalcon_mvc_model_metadata_memcache_ce; -zend_class_entry *phalcon_mvc_model_metadata_memory_ce; -zend_class_entry *phalcon_mvc_model_metadata_redis_ce; -zend_class_entry *phalcon_mvc_model_metadata_session_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_annotations_ce; -zend_class_entry *phalcon_mvc_model_metadata_strategy_introspection_ce; -zend_class_entry *phalcon_mvc_model_metadata_xcache_ce; -zend_class_entry *phalcon_mvc_model_query_builder_ce; -zend_class_entry *phalcon_mvc_model_query_ce; -zend_class_entry *phalcon_mvc_model_query_lang_ce; -zend_class_entry *phalcon_mvc_model_query_status_ce; -zend_class_entry *phalcon_mvc_model_relation_ce; -zend_class_entry *phalcon_mvc_model_resultset_complex_ce; -zend_class_entry *phalcon_mvc_model_resultset_simple_ce; -zend_class_entry *phalcon_mvc_model_row_ce; -zend_class_entry *phalcon_mvc_model_transaction_ce; -zend_class_entry *phalcon_mvc_model_transaction_failed_ce; -zend_class_entry *phalcon_mvc_model_transaction_manager_ce; -zend_class_entry *phalcon_mvc_model_validationfailed_ce; -zend_class_entry *phalcon_mvc_model_validator_email_ce; -zend_class_entry *phalcon_mvc_model_validator_exclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_inclusionin_ce; -zend_class_entry *phalcon_mvc_model_validator_ip_ce; -zend_class_entry *phalcon_mvc_model_validator_numericality_ce; -zend_class_entry *phalcon_mvc_model_validator_presenceof_ce; -zend_class_entry *phalcon_mvc_model_validator_regex_ce; -zend_class_entry *phalcon_mvc_model_validator_stringlength_ce; -zend_class_entry *phalcon_mvc_model_validator_uniqueness_ce; -zend_class_entry *phalcon_mvc_model_validator_url_ce; -zend_class_entry *phalcon_mvc_router_annotations_ce; -zend_class_entry *phalcon_mvc_router_exception_ce; -zend_class_entry *phalcon_mvc_router_group_ce; -zend_class_entry *phalcon_mvc_router_route_ce; -zend_class_entry *phalcon_mvc_url_ce; -zend_class_entry *phalcon_mvc_url_exception_ce; -zend_class_entry *phalcon_mvc_user_component_ce; -zend_class_entry *phalcon_mvc_user_module_ce; -zend_class_entry *phalcon_mvc_user_plugin_ce; -zend_class_entry *phalcon_mvc_view_ce; -zend_class_entry *phalcon_mvc_view_engine_php_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_compiler_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_exception_ce; -zend_class_entry *phalcon_mvc_view_simple_ce; -zend_class_entry *phalcon_paginator_adapter_model_ce; -zend_class_entry *phalcon_paginator_adapter_nativearray_ce; -zend_class_entry *phalcon_paginator_adapter_querybuilder_ce; -zend_class_entry *phalcon_paginator_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_ce; -zend_class_entry *phalcon_queue_beanstalk_exception_ce; -zend_class_entry *phalcon_queue_beanstalk_job_ce; -zend_class_entry *phalcon_registry_ce; -zend_class_entry *phalcon_security_ce; -zend_class_entry *phalcon_security_exception_ce; -zend_class_entry *phalcon_security_random_ce; -zend_class_entry *phalcon_session_adapter_files_ce; -zend_class_entry *phalcon_session_adapter_libmemcached_ce; -zend_class_entry *phalcon_session_adapter_memcache_ce; -zend_class_entry *phalcon_session_adapter_redis_ce; -zend_class_entry *phalcon_session_bag_ce; -zend_class_entry *phalcon_session_exception_ce; -zend_class_entry *phalcon_tag_ce; -zend_class_entry *phalcon_tag_exception_ce; -zend_class_entry *phalcon_tag_select_ce; -zend_class_entry *phalcon_text_ce; -zend_class_entry *phalcon_translate_adapter_csv_ce; -zend_class_entry *phalcon_translate_adapter_gettext_ce; -zend_class_entry *phalcon_translate_adapter_nativearray_ce; -zend_class_entry *phalcon_translate_ce; -zend_class_entry *phalcon_translate_exception_ce; -zend_class_entry *phalcon_translate_interpolator_associativearray_ce; -zend_class_entry *phalcon_translate_interpolator_indexedarray_ce; -zend_class_entry *phalcon_validation_ce; -zend_class_entry *phalcon_validation_exception_ce; -zend_class_entry *phalcon_validation_message_ce; -zend_class_entry *phalcon_validation_message_group_ce; -zend_class_entry *phalcon_validation_validator_alnum_ce; -zend_class_entry *phalcon_validation_validator_alpha_ce; -zend_class_entry *phalcon_validation_validator_between_ce; -zend_class_entry *phalcon_validation_validator_confirmation_ce; -zend_class_entry *phalcon_validation_validator_creditcard_ce; -zend_class_entry *phalcon_validation_validator_date_ce; -zend_class_entry *phalcon_validation_validator_digit_ce; -zend_class_entry *phalcon_validation_validator_email_ce; -zend_class_entry *phalcon_validation_validator_exclusionin_ce; -zend_class_entry *phalcon_validation_validator_file_ce; -zend_class_entry *phalcon_validation_validator_identical_ce; -zend_class_entry *phalcon_validation_validator_inclusionin_ce; -zend_class_entry *phalcon_validation_validator_numericality_ce; -zend_class_entry *phalcon_validation_validator_presenceof_ce; -zend_class_entry *phalcon_validation_validator_regex_ce; -zend_class_entry *phalcon_validation_validator_stringlength_ce; -zend_class_entry *phalcon_validation_validator_uniqueness_ce; -zend_class_entry *phalcon_validation_validator_url_ce; -zend_class_entry *phalcon_version_ce; - -ZEND_DECLARE_MODULE_GLOBALS(phalcon) - -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("phalcon.db.escape_identifiers", "1", PHP_INI_ALL, OnUpdateBool, db.escape_identifiers, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.db.force_casting", "0", PHP_INI_ALL, OnUpdateBool, db.force_casting, zend_phalcon_globals, phalcon_globals) - - - - - STD_PHP_INI_BOOLEAN("phalcon.orm.events", "1", PHP_INI_ALL, OnUpdateBool, orm.events, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.virtual_foreign_keys", "1", PHP_INI_ALL, OnUpdateBool, orm.virtual_foreign_keys, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.column_renaming", "1", PHP_INI_ALL, OnUpdateBool, orm.column_renaming, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.not_null_validations", "1", PHP_INI_ALL, OnUpdateBool, orm.not_null_validations, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.exception_on_failed_save", "0", PHP_INI_ALL, OnUpdateBool, orm.exception_on_failed_save, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_literals", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_literals, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.late_state_binding", "0", PHP_INI_ALL, OnUpdateBool, orm.late_state_binding, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.enable_implicit_joins", "1", PHP_INI_ALL, OnUpdateBool, orm.enable_implicit_joins, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.cast_on_hydrate", "0", PHP_INI_ALL, OnUpdateBool, orm.cast_on_hydrate, zend_phalcon_globals, phalcon_globals) - STD_PHP_INI_BOOLEAN("phalcon.orm.ignore_unknown_columns", "0", PHP_INI_ALL, OnUpdateBool, orm.ignore_unknown_columns, zend_phalcon_globals, phalcon_globals) -PHP_INI_END() - -static PHP_MINIT_FUNCTION(phalcon) -{ -#if PHP_VERSION_ID < 50500 - char* old_lc_all = setlocale(LC_ALL, NULL); - if (old_lc_all) { - size_t len = strlen(old_lc_all); - char *tmp = calloc(len+1, 1); - if (UNEXPECTED(!tmp)) { - return FAILURE; - } - - memcpy(tmp, old_lc_all, len); - old_lc_all = tmp; - } - - setlocale(LC_ALL, "C"); -#endif - REGISTER_INI_ENTRIES(); - ZEPHIR_INIT(Phalcon_Di_InjectionAwareInterface); - ZEPHIR_INIT(Phalcon_Events_EventsAwareInterface); - ZEPHIR_INIT(Phalcon_Validation_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Forms_ElementInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidatorInterface); - ZEPHIR_INIT(Phalcon_Cache_BackendInterface); - ZEPHIR_INIT(Phalcon_Cache_FrontendInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaDataInterface); - ZEPHIR_INIT(Phalcon_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Annotations_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_AdapterInterface); - ZEPHIR_INIT(Phalcon_Logger_FormatterInterface); - ZEPHIR_INIT(Phalcon_Session_AdapterInterface); - ZEPHIR_INIT(Phalcon_Db_DialectInterface); - ZEPHIR_INIT(Phalcon_Mvc_EntityInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultsetInterface); - ZEPHIR_INIT(Phalcon_Paginator_AdapterInterface); - ZEPHIR_INIT(Phalcon_Translate_AdapterInterface); - ZEPHIR_INIT(Phalcon_Assets_FilterInterface); - ZEPHIR_INIT(Phalcon_DiInterface); - ZEPHIR_INIT(Phalcon_FlashInterface); - ZEPHIR_INIT(Phalcon_Image_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_BehaviorInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewBaseInterface); - ZEPHIR_INIT(Phalcon_Mvc_View_EngineInterface); - ZEPHIR_INIT(Phalcon_Acl_AdapterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_StrategyInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ResultInterface); - ZEPHIR_INIT(Phalcon_Mvc_RouterInterface); - ZEPHIR_INIT(Phalcon_Translate_InterpolatorInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceInterface); - ZEPHIR_INIT(Phalcon_Acl_RoleInterface); - ZEPHIR_INIT(Phalcon_Annotations_ReaderInterface); - ZEPHIR_INIT(Phalcon_Cli_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Cli_TaskInterface); - ZEPHIR_INIT(Phalcon_CryptInterface); - ZEPHIR_INIT(Phalcon_Db_ColumnInterface); - ZEPHIR_INIT(Phalcon_Db_IndexInterface); - ZEPHIR_INIT(Phalcon_Db_ReferenceInterface); - ZEPHIR_INIT(Phalcon_Db_ResultInterface); - ZEPHIR_INIT(Phalcon_Di_ServiceInterface); - ZEPHIR_INIT(Phalcon_EscaperInterface); - ZEPHIR_INIT(Phalcon_Events_EventInterface); - ZEPHIR_INIT(Phalcon_Events_ManagerInterface); - ZEPHIR_INIT(Phalcon_FilterInterface); - ZEPHIR_INIT(Phalcon_Http_CookieInterface); - ZEPHIR_INIT(Phalcon_Http_RequestInterface); - ZEPHIR_INIT(Phalcon_Http_Request_FileInterface); - ZEPHIR_INIT(Phalcon_Http_ResponseInterface); - ZEPHIR_INIT(Phalcon_Http_Response_CookiesInterface); - ZEPHIR_INIT(Phalcon_Http_Response_HeadersInterface); - ZEPHIR_INIT(Phalcon_Mvc_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ControllerInterface); - ZEPHIR_INIT(Phalcon_Mvc_DispatcherInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_CollectionInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_CriteriaInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_MessageInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_QueryInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_BuilderInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_StatusInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_RelationInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_TransactionInterface); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_GroupInterface); - ZEPHIR_INIT(Phalcon_Mvc_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Mvc_UrlInterface); - ZEPHIR_INIT(Phalcon_Mvc_ViewInterface); - ZEPHIR_INIT(Phalcon_Session_BagInterface); - ZEPHIR_INIT(Phalcon_ValidationInterface); - ZEPHIR_INIT(Phalcon_Validation_MessageInterface); - ZEPHIR_INIT(Phalcon_Acl_ResourceAware); - ZEPHIR_INIT(Phalcon_Acl_RoleAware); - ZEPHIR_INIT(Phalcon_Cli_RouterInterface); - ZEPHIR_INIT(Phalcon_Cli_Router_RouteInterface); - ZEPHIR_INIT(Phalcon_Filter_UserFilterInterface); - ZEPHIR_INIT(Phalcon_Mvc_Collection_ManagerInterface); - ZEPHIR_INIT(Phalcon_Mvc_Controller_BindModelInterface); - ZEPHIR_INIT(Phalcon_Mvc_Micro_MiddlewareInterface); - ZEPHIR_INIT(Phalcon_Mvc_ModuleDefinitionInterface); - ZEPHIR_INIT(Phalcon_Exception); - ZEPHIR_INIT(Phalcon_Validation_Validator); - ZEPHIR_INIT(Phalcon_Di_Injectable); - ZEPHIR_INIT(Phalcon_Forms_Element); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator); - ZEPHIR_INIT(Phalcon_Cache_Backend); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData); - ZEPHIR_INIT(Phalcon_Annotations_Adapter); - ZEPHIR_INIT(Phalcon_Config); - ZEPHIR_INIT(Phalcon_Db_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Adapter); - ZEPHIR_INIT(Phalcon_Logger_Formatter); - ZEPHIR_INIT(Phalcon_Session_Adapter); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo); - ZEPHIR_INIT(Phalcon_Db_Dialect); - ZEPHIR_INIT(Phalcon_Mvc_Model_Exception); - ZEPHIR_INIT(Phalcon_Paginator_Adapter); - ZEPHIR_INIT(Phalcon_Translate_Adapter); - ZEPHIR_INIT(Phalcon_Application); - ZEPHIR_INIT(Phalcon_Application_Exception); - ZEPHIR_INIT(Phalcon_Assets_Inline); - ZEPHIR_INIT(Phalcon_Assets_Resource); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Data); - ZEPHIR_INIT(Phalcon_Di); - ZEPHIR_INIT(Phalcon_Dispatcher); - ZEPHIR_INIT(Phalcon_Flash); - ZEPHIR_INIT(Phalcon_Image_Adapter); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine); - ZEPHIR_INIT(Phalcon_Acl_Adapter); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router); - ZEPHIR_INIT(Phalcon_Mvc_View_Exception); - ZEPHIR_INIT(Phalcon_Validation_CombinedFieldsValidator); - ZEPHIR_INIT(Phalcon_Acl); - ZEPHIR_INIT(Phalcon_Acl_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Acl_Exception); - ZEPHIR_INIT(Phalcon_Acl_Resource); - ZEPHIR_INIT(Phalcon_Acl_Role); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Apc); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Files); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Memory); - ZEPHIR_INIT(Phalcon_Annotations_Adapter_Xcache); - ZEPHIR_INIT(Phalcon_Annotations_Annotation); - ZEPHIR_INIT(Phalcon_Annotations_Collection); - ZEPHIR_INIT(Phalcon_Annotations_Exception); - ZEPHIR_INIT(Phalcon_Annotations_Reader); - ZEPHIR_INIT(Phalcon_Annotations_Reflection); - ZEPHIR_INIT(Phalcon_Assets_Collection); - ZEPHIR_INIT(Phalcon_Assets_Exception); - ZEPHIR_INIT(Phalcon_Assets_Filters_Cssmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_Jsmin); - ZEPHIR_INIT(Phalcon_Assets_Filters_None); - ZEPHIR_INIT(Phalcon_Assets_Inline_Css); - ZEPHIR_INIT(Phalcon_Assets_Inline_Js); - ZEPHIR_INIT(Phalcon_Assets_Manager); - ZEPHIR_INIT(Phalcon_Assets_Resource_Css); - ZEPHIR_INIT(Phalcon_Assets_Resource_Js); - ZEPHIR_INIT(Phalcon_Cache_Backend_Apc); - ZEPHIR_INIT(Phalcon_Cache_Backend_File); - ZEPHIR_INIT(Phalcon_Cache_Backend_Libmemcached); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memcache); - ZEPHIR_INIT(Phalcon_Cache_Backend_Memory); - ZEPHIR_INIT(Phalcon_Cache_Backend_Mongo); - ZEPHIR_INIT(Phalcon_Cache_Backend_Redis); - ZEPHIR_INIT(Phalcon_Cache_Backend_Xcache); - ZEPHIR_INIT(Phalcon_Cache_Exception); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Base64); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Igbinary); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Json); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Msgpack); - ZEPHIR_INIT(Phalcon_Cache_Frontend_None); - ZEPHIR_INIT(Phalcon_Cache_Frontend_Output); - ZEPHIR_INIT(Phalcon_Cache_Multiple); - ZEPHIR_INIT(Phalcon_Cli_Console); - ZEPHIR_INIT(Phalcon_Cli_Console_Exception); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher); - ZEPHIR_INIT(Phalcon_Cli_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router); - ZEPHIR_INIT(Phalcon_Cli_Router_Exception); - ZEPHIR_INIT(Phalcon_Cli_Router_Route); - ZEPHIR_INIT(Phalcon_Cli_Task); - ZEPHIR_INIT(Phalcon_Config_Adapter_Ini); - ZEPHIR_INIT(Phalcon_Config_Adapter_Json); - ZEPHIR_INIT(Phalcon_Config_Adapter_Php); - ZEPHIR_INIT(Phalcon_Config_Adapter_Yaml); - ZEPHIR_INIT(Phalcon_Config_Exception); - ZEPHIR_INIT(Phalcon_Crypt); - ZEPHIR_INIT(Phalcon_Crypt_Exception); - ZEPHIR_INIT(Phalcon_Db); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Mysql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Adapter_Pdo_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Column); - ZEPHIR_INIT(Phalcon_Db_Dialect_Mysql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Postgresql); - ZEPHIR_INIT(Phalcon_Db_Dialect_Sqlite); - ZEPHIR_INIT(Phalcon_Db_Exception); - ZEPHIR_INIT(Phalcon_Db_Index); - ZEPHIR_INIT(Phalcon_Db_Profiler); - ZEPHIR_INIT(Phalcon_Db_Profiler_Item); - ZEPHIR_INIT(Phalcon_Db_RawValue); - ZEPHIR_INIT(Phalcon_Db_Reference); - ZEPHIR_INIT(Phalcon_Db_Result_Pdo); - ZEPHIR_INIT(Phalcon_Debug); - ZEPHIR_INIT(Phalcon_Debug_Dump); - ZEPHIR_INIT(Phalcon_Debug_Exception); - ZEPHIR_INIT(Phalcon_Di_Exception); - ZEPHIR_INIT(Phalcon_Di_FactoryDefault_Cli); - ZEPHIR_INIT(Phalcon_Di_Service); - ZEPHIR_INIT(Phalcon_Di_Service_Builder); - ZEPHIR_INIT(Phalcon_Escaper); - ZEPHIR_INIT(Phalcon_Escaper_Exception); - ZEPHIR_INIT(Phalcon_Events_Event); - ZEPHIR_INIT(Phalcon_Events_Exception); - ZEPHIR_INIT(Phalcon_Events_Manager); - ZEPHIR_INIT(Phalcon_Filter); - ZEPHIR_INIT(Phalcon_Filter_Exception); - ZEPHIR_INIT(Phalcon_Flash_Direct); - ZEPHIR_INIT(Phalcon_Flash_Exception); - ZEPHIR_INIT(Phalcon_Flash_Session); - ZEPHIR_INIT(Phalcon_Forms_Element_Check); - ZEPHIR_INIT(Phalcon_Forms_Element_Date); - ZEPHIR_INIT(Phalcon_Forms_Element_Email); - ZEPHIR_INIT(Phalcon_Forms_Element_File); - ZEPHIR_INIT(Phalcon_Forms_Element_Hidden); - ZEPHIR_INIT(Phalcon_Forms_Element_Numeric); - ZEPHIR_INIT(Phalcon_Forms_Element_Password); - ZEPHIR_INIT(Phalcon_Forms_Element_Radio); - ZEPHIR_INIT(Phalcon_Forms_Element_Select); - ZEPHIR_INIT(Phalcon_Forms_Element_Submit); - ZEPHIR_INIT(Phalcon_Forms_Element_Text); - ZEPHIR_INIT(Phalcon_Forms_Element_TextArea); - ZEPHIR_INIT(Phalcon_Forms_Exception); - ZEPHIR_INIT(Phalcon_Forms_Form); - ZEPHIR_INIT(Phalcon_Forms_Manager); - ZEPHIR_INIT(Phalcon_Http_Cookie); - ZEPHIR_INIT(Phalcon_Http_Cookie_Exception); - ZEPHIR_INIT(Phalcon_Http_Request); - ZEPHIR_INIT(Phalcon_Http_Request_Exception); - ZEPHIR_INIT(Phalcon_Http_Request_File); - ZEPHIR_INIT(Phalcon_Http_Response); - ZEPHIR_INIT(Phalcon_Http_Response_Cookies); - ZEPHIR_INIT(Phalcon_Http_Response_Exception); - ZEPHIR_INIT(Phalcon_Http_Response_Headers); - ZEPHIR_INIT(Phalcon_Image); - ZEPHIR_INIT(Phalcon_Image_Adapter_Gd); - ZEPHIR_INIT(Phalcon_Image_Adapter_Imagick); - ZEPHIR_INIT(Phalcon_Image_Exception); - ZEPHIR_INIT(Phalcon_Kernel); - ZEPHIR_INIT(Phalcon_Loader); - ZEPHIR_INIT(Phalcon_Loader_Exception); - ZEPHIR_INIT(Phalcon_Logger); - ZEPHIR_INIT(Phalcon_Logger_Adapter_File); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Stream); - ZEPHIR_INIT(Phalcon_Logger_Adapter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Exception); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Firephp); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Json); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Line); - ZEPHIR_INIT(Phalcon_Logger_Formatter_Syslog); - ZEPHIR_INIT(Phalcon_Logger_Item); - ZEPHIR_INIT(Phalcon_Logger_Multiple); - ZEPHIR_INIT(Phalcon_Mvc_Application); - ZEPHIR_INIT(Phalcon_Mvc_Application_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Document); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Collection_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Controller); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher); - ZEPHIR_INIT(Phalcon_Mvc_Dispatcher_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Collection); - ZEPHIR_INIT(Phalcon_Mvc_Micro_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Micro_LazyLoader); - ZEPHIR_INIT(Phalcon_Mvc_Model); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_SoftDelete); - ZEPHIR_INIT(Phalcon_Mvc_Model_Behavior_Timestampable); - ZEPHIR_INIT(Phalcon_Mvc_Model_Criteria); - ZEPHIR_INIT(Phalcon_Mvc_Model_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_Message); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Apc); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Files); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Libmemcached); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Memory); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Redis); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Session); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Strategy_Introspection); - ZEPHIR_INIT(Phalcon_Mvc_Model_MetaData_Xcache); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Builder); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Lang); - ZEPHIR_INIT(Phalcon_Mvc_Model_Query_Status); - ZEPHIR_INIT(Phalcon_Mvc_Model_Relation); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Complex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Resultset_Simple); - ZEPHIR_INIT(Phalcon_Mvc_Model_Row); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Failed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Transaction_Manager); - ZEPHIR_INIT(Phalcon_Mvc_Model_ValidationFailed); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Email); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Exclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Inclusionin); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Ip); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Regex); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Mvc_Model_Validator_Url); - ZEPHIR_INIT(Phalcon_Mvc_Router_Annotations); - ZEPHIR_INIT(Phalcon_Mvc_Router_Exception); - ZEPHIR_INIT(Phalcon_Mvc_Router_Group); - ZEPHIR_INIT(Phalcon_Mvc_Router_Route); - ZEPHIR_INIT(Phalcon_Mvc_Url); - ZEPHIR_INIT(Phalcon_Mvc_Url_Exception); - ZEPHIR_INIT(Phalcon_Mvc_User_Component); - ZEPHIR_INIT(Phalcon_Mvc_User_Module); - ZEPHIR_INIT(Phalcon_Mvc_User_Plugin); - ZEPHIR_INIT(Phalcon_Mvc_View); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Php); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Compiler); - ZEPHIR_INIT(Phalcon_Mvc_View_Engine_Volt_Exception); - ZEPHIR_INIT(Phalcon_Mvc_View_Simple); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_Model); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Paginator_Adapter_QueryBuilder); - ZEPHIR_INIT(Phalcon_Paginator_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Exception); - ZEPHIR_INIT(Phalcon_Queue_Beanstalk_Job); - ZEPHIR_INIT(Phalcon_Registry); - ZEPHIR_INIT(Phalcon_Security); - ZEPHIR_INIT(Phalcon_Security_Exception); - ZEPHIR_INIT(Phalcon_Security_Random); - ZEPHIR_INIT(Phalcon_Session_Adapter_Files); - ZEPHIR_INIT(Phalcon_Session_Adapter_Libmemcached); - ZEPHIR_INIT(Phalcon_Session_Adapter_Memcache); - ZEPHIR_INIT(Phalcon_Session_Adapter_Redis); - ZEPHIR_INIT(Phalcon_Session_Bag); - ZEPHIR_INIT(Phalcon_Session_Exception); - ZEPHIR_INIT(Phalcon_Tag); - ZEPHIR_INIT(Phalcon_Tag_Exception); - ZEPHIR_INIT(Phalcon_Tag_Select); - ZEPHIR_INIT(Phalcon_Text); - ZEPHIR_INIT(Phalcon_Translate); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Csv); - ZEPHIR_INIT(Phalcon_Translate_Adapter_Gettext); - ZEPHIR_INIT(Phalcon_Translate_Adapter_NativeArray); - ZEPHIR_INIT(Phalcon_Translate_Exception); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_AssociativeArray); - ZEPHIR_INIT(Phalcon_Translate_Interpolator_IndexedArray); - ZEPHIR_INIT(Phalcon_Validation); - ZEPHIR_INIT(Phalcon_Validation_Exception); - ZEPHIR_INIT(Phalcon_Validation_Message); - ZEPHIR_INIT(Phalcon_Validation_Message_Group); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alnum); - ZEPHIR_INIT(Phalcon_Validation_Validator_Alpha); - ZEPHIR_INIT(Phalcon_Validation_Validator_Between); - ZEPHIR_INIT(Phalcon_Validation_Validator_Confirmation); - ZEPHIR_INIT(Phalcon_Validation_Validator_CreditCard); - ZEPHIR_INIT(Phalcon_Validation_Validator_Date); - ZEPHIR_INIT(Phalcon_Validation_Validator_Digit); - ZEPHIR_INIT(Phalcon_Validation_Validator_Email); - ZEPHIR_INIT(Phalcon_Validation_Validator_ExclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_File); - ZEPHIR_INIT(Phalcon_Validation_Validator_Identical); - ZEPHIR_INIT(Phalcon_Validation_Validator_InclusionIn); - ZEPHIR_INIT(Phalcon_Validation_Validator_Numericality); - ZEPHIR_INIT(Phalcon_Validation_Validator_PresenceOf); - ZEPHIR_INIT(Phalcon_Validation_Validator_Regex); - ZEPHIR_INIT(Phalcon_Validation_Validator_StringLength); - ZEPHIR_INIT(Phalcon_Validation_Validator_Uniqueness); - ZEPHIR_INIT(Phalcon_Validation_Validator_Url); - ZEPHIR_INIT(Phalcon_Version); - ZEPHIR_INIT(phalcon_0__closure); - ZEPHIR_INIT(phalcon_1__closure); - -#if PHP_VERSION_ID < 50500 - setlocale(LC_ALL, old_lc_all); - free(old_lc_all); -#endif - return SUCCESS; -} - -#ifndef ZEPHIR_RELEASE -static PHP_MSHUTDOWN_FUNCTION(phalcon) -{ - - zephir_deinitialize_memory(TSRMLS_C); - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -#endif - -static void php_zephir_init_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - phalcon_globals->initialized = 0; - - /* Memory options */ - phalcon_globals->active_memory = NULL; - - /* Virtual Symbol Tables */ - phalcon_globals->active_symbol_table = NULL; - - /* Cache Enabled */ - phalcon_globals->cache_enabled = 1; - - /* Recursive Lock */ - phalcon_globals->recursive_lock = 0; - - /* Static cache */ - memset(phalcon_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - - - - phalcon_globals->orm.parser_cache = NULL; - phalcon_globals->orm.ast_cache = NULL; - phalcon_globals->orm.cache_level = 3; - phalcon_globals->orm.unique_cache_id = 3; - - - - - - - - - - - -} - -static void php_zephir_init_module_globals(zend_phalcon_globals *phalcon_globals TSRMLS_DC) -{ - -} - -static PHP_RINIT_FUNCTION(phalcon) -{ +Copyright (c) 2002 Douglas Crockford (www.crockford.com) - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: - php_zephir_init_globals(phalcon_globals_ptr TSRMLS_CC); - //zephir_init_interned_strings(TSRMLS_C); +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - zephir_initialize_memory(phalcon_globals_ptr TSRMLS_CC); +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ - return SUCCESS; -} +#ifndef PHALCON_ASSETS_FILTERS_CSSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_CSSMINIFIER_H -static PHP_RSHUTDOWN_FUNCTION(phalcon) -{ - phalcon_orm_destroy_cache(TSRMLS_C); +static int phalcon_cssmin(zval *return_value, zval *style TSRMLS_DC); - zephir_deinitialize_memory(TSRMLS_C); - return SUCCESS; -} +#endif /* PHALCON_ASSETS_FILTERS_CSSMINIFIER_H */ -static PHP_MINFO_FUNCTION(phalcon) -{ - php_info_print_box_start(0); - php_printf("%s", PHP_PHALCON_DESCRIPTION); - php_info_print_box_end(); - php_info_print_table_start(); - php_info_print_table_header(2, PHP_PHALCON_NAME, "enabled"); - php_info_print_table_row(2, "Author", PHP_PHALCON_AUTHOR); - php_info_print_table_row(2, "Version", PHP_PHALCON_VERSION); - php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); - php_info_print_table_row(2, "Powered by Zephir", "Version " PHP_PHALCON_ZEPVERSION); - php_info_print_table_end(); +/* jsmin.c + 2013-03-29 - DISPLAY_INI_ENTRIES(); -} +Copyright (c) 2002 Douglas Crockford (www.crockford.com) -static PHP_GINIT_FUNCTION(phalcon) -{ - php_zephir_init_globals(phalcon_globals TSRMLS_CC); - php_zephir_init_module_globals(phalcon_globals TSRMLS_CC); -} +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: -static PHP_GSHUTDOWN_FUNCTION(phalcon) -{ +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -} +The Software shall be used for Good, not Evil. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ -zend_function_entry php_phalcon_functions[] = { -ZEND_FE_END +#ifndef PHALCON_ASSETS_FILTERS_JSMINIFIER_H +#define PHALCON_ASSETS_FILTERS_JSMINIFIER_H -}; -zend_module_entry phalcon_module_entry = { - STANDARD_MODULE_HEADER_EX, - NULL, - NULL, - PHP_PHALCON_EXTNAME, - php_phalcon_functions, - PHP_MINIT(phalcon), -#ifndef ZEPHIR_RELEASE - PHP_MSHUTDOWN(phalcon), -#else - NULL, -#endif - PHP_RINIT(phalcon), - PHP_RSHUTDOWN(phalcon), - PHP_MINFO(phalcon), - PHP_PHALCON_VERSION, - ZEND_MODULE_GLOBALS(phalcon), - PHP_GINIT(phalcon), - PHP_GSHUTDOWN(phalcon), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; +static int phalcon_jsmin(zval *return_value, zval *script TSRMLS_DC); -#ifdef COMPILE_DL_PHALCON -ZEND_GET_MODULE(phalcon) -#endif +#endif /* PHALCON_ASSETS_FILTERS_JSMINIFIER_H */ @@ -24217,7 +23344,7 @@ static PHP_METHOD(Phalcon_Loader, register) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 299, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 264, _1$$3); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24245,7 +23372,7 @@ static PHP_METHOD(Phalcon_Loader, unregister) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "autoLoad", 1); zephir_array_fast_append(_1$$3, _2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 300, _1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 265, _1$$3); zephir_check_call_status(); if (0) { zephir_update_property_this(this_ptr, SL("_registered"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -24285,7 +23412,7 @@ static PHP_METHOD(Phalcon_Loader, loadFiles) { zephir_check_temp_parameter(_6$$4); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_7$$3)) { ZEPHIR_OBS_NVAR(_9$$5); @@ -24414,7 +23541,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_15$$11); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_17$$10, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_17$$10)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24465,7 +23592,7 @@ static PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_check_temp_parameter(_29$$16); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 301, filePath); + ZEPHIR_CALL_FUNCTION(&_31$$15, "is_file", &_18, 266, filePath); zephir_check_call_status(); if (zephir_is_true(_31$$15)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { @@ -24756,7 +23883,7 @@ static PHP_METHOD(Phalcon_Registry, next) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 417, _0); + ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 382, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24772,7 +23899,7 @@ static PHP_METHOD(Phalcon_Registry, key) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 418, _0); + ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24788,7 +23915,7 @@ static PHP_METHOD(Phalcon_Registry, rewind) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 419, _0); + ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 384, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24804,7 +23931,7 @@ static PHP_METHOD(Phalcon_Registry, valid) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 418, _0); + ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 383, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM_BOOL(Z_TYPE_P(_1) != IS_NULL); @@ -24820,7 +23947,7 @@ static PHP_METHOD(Phalcon_Registry, current) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_MAKE_REF(_0); - ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 420, _0); + ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 385, _0); ZEPHIR_UNREF(_0); zephir_check_call_status(); RETURN_MM(); @@ -24848,7 +23975,7 @@ static PHP_METHOD(Phalcon_Registry, __set) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 421, key, value); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 386, key, value); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -24875,7 +24002,7 @@ static PHP_METHOD(Phalcon_Registry, __get) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 422, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 387, key); zephir_check_call_status(); RETURN_MM(); @@ -24902,7 +24029,7 @@ static PHP_METHOD(Phalcon_Registry, __isset) { } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 423, key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 388, key); zephir_check_call_status(); RETURN_MM(); @@ -24929,7 +24056,7 @@ static PHP_METHOD(Phalcon_Registry, __unset) { } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 424, key); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 389, key); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -25208,7 +24335,7 @@ static PHP_METHOD(Phalcon_Security, hash) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_security_exception_ce, "Unable to get random bytes for the salt", "phalcon/security.zep", 222); return; } - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, saltBytes); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, saltBytes); zephir_check_call_status(); RETURN_MM(); } @@ -25229,7 +24356,7 @@ static PHP_METHOD(Phalcon_Security, hash) { } ZEPHIR_INIT_VAR(_8$$15); ZEPHIR_CONCAT_SVSVS(_8$$15, "$", variant, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _8$$15); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _8$$15); zephir_check_call_status(); RETURN_MM(); } @@ -25256,7 +24383,7 @@ static PHP_METHOD(Phalcon_Security, hash) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_13$$17); ZEPHIR_CONCAT_SVSVSVS(_13$$17, "$2", variant, "$", _12$$17, "$", saltBytes, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 425, password, _13$$17); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", &_6, 390, password, _13$$17); zephir_check_call_status(); RETURN_MM(); } while(0); @@ -25296,7 +24423,7 @@ static PHP_METHOD(Phalcon_Security, checkHash) { RETURN_MM_BOOL(0); } } - ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 425, password, passwordHash); + ZEPHIR_CALL_FUNCTION(&_1, "crypt", NULL, 390, password, passwordHash); zephir_check_call_status(); zephir_get_strval(_2, _1); ZEPHIR_CPY_WRT(cryptedHash, _2); @@ -25551,7 +24678,7 @@ static PHP_METHOD(Phalcon_Security, computeHmac) { ZEPHIR_SINIT_VAR(_0); ZVAL_BOOL(&_0, (raw ? 1 : 0)); - ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 426, algo, data, key, &_0); + ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 391, algo, data, key, &_0); zephir_check_call_status(); if (!(zephir_is_true(hmac))) { ZEPHIR_INIT_VAR(_1$$3); @@ -27364,7 +26491,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_1)) { ZEPHIR_SINIT_VAR(_3$$3); - ZVAL_LONG(&_3$$3, 6); + ZVAL_LONG(&_3$$3, 0); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "en_US.UTF-8", 0); ZEPHIR_CALL_FUNCTION(&locale, "setlocale", &_5, 442, &_3$$3, &_4$$3); @@ -27435,7 +26562,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) { zephir_check_call_status(); if (zephir_is_true(_19)) { ZEPHIR_SINIT_VAR(_20$$10); - ZVAL_LONG(&_20$$10, 6); + ZVAL_LONG(&_20$$10, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", &_5, 442, &_20$$10, locale); zephir_check_call_status(); } @@ -27804,13 +26931,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_STRING(&_0$$3, "a", 0); ZEPHIR_SINIT_VAR(_1$$3); ZVAL_STRING(&_1$$3, "z", 0); - ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_2$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$3); ZVAL_STRING(&_0$$3, "A", 0); ZEPHIR_SINIT_NVAR(_1$$3); ZVAL_STRING(&_1$$3, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 446, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "range", &_3, 411, &_0$$3, &_1$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(pool); zephir_fast_array_merge(pool, &(_2$$3), &(_4$$3) TSRMLS_CC); @@ -27821,13 +26948,13 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_5$$4, 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_LONG(&_6$$4, 9); - ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_7$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_5$$4); ZVAL_STRING(&_5$$4, "a", 0); ZEPHIR_SINIT_NVAR(_6$$4); ZVAL_STRING(&_6$$4, "f", 0); - ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 446, &_5$$4, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_8$$4, "range", &_3, 411, &_5$$4, &_6$$4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(pool); zephir_fast_array_merge(pool, &(_7$$4), &(_8$$4) TSRMLS_CC); @@ -27838,7 +26965,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_9$$5, 0); ZEPHIR_SINIT_VAR(_10$$5); ZVAL_LONG(&_10$$5, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_9$$5, &_10$$5); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_9$$5, &_10$$5); zephir_check_call_status(); break; } @@ -27847,7 +26974,7 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_11$$6, 1); ZEPHIR_SINIT_VAR(_12$$6); ZVAL_LONG(&_12$$6, 9); - ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 446, &_11$$6, &_12$$6); + ZEPHIR_CALL_FUNCTION(&pool, "range", &_3, 411, &_11$$6, &_12$$6); zephir_check_call_status(); break; } @@ -27855,21 +26982,21 @@ static PHP_METHOD(Phalcon_Text, random) { ZVAL_LONG(&_13$$7, 0); ZEPHIR_SINIT_VAR(_14$$7); ZVAL_LONG(&_14$$7, 9); - ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_15$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "a", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "z", 0); - ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_16$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_STRING(&_13$$7, "A", 0); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "Z", 0); - ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 446, &_13$$7, &_14$$7); + ZEPHIR_CALL_FUNCTION(&_17$$7, "range", &_3, 411, &_13$$7, &_14$$7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 447, _15$$7, _16$$7, _17$$7); + ZEPHIR_CALL_FUNCTION(&pool, "array_merge", &_18, 412, _15$$7, _16$$7, _17$$7); zephir_check_call_status(); break; } while(0); @@ -28066,24 +27193,24 @@ static PHP_METHOD(Phalcon_Text, concat) { ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 448, &_0); + ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 413, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 449); + ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 414); zephir_check_call_status(); if (ZEPHIR_GT_LONG(_2, 3)) { ZEPHIR_CALL_FUNCTION(&_3$$3, "func_get_args", NULL, 176); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 396, _3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 361, _3$$3, &_4$$3); zephir_check_call_status(); zephir_is_iterable(_5$$3, &_7$$3, &_6$$3, 0, 0, "phalcon/text.zep", 256); for ( @@ -28179,24 +27306,24 @@ static PHP_METHOD(Phalcon_Text, dynamic) { } - ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 450, text, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 415, text, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 450, text, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 415, text, rightDelimiter); zephir_check_call_status(); if (!ZEPHIR_IS_IDENTICAL(_0, _2)) { ZEPHIR_INIT_VAR(_3$$3); object_init_ex(_3$$3, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(_4$$3); ZEPHIR_CONCAT_SVS(_4$$3, "Syntax error in string \"", text, "\""); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 451, _4$$3); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 416, _4$$3); zephir_check_call_status(); zephir_throw_exception_debug(_3$$3, "phalcon/text.zep", 283 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 452, leftDelimiter); + ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 417, leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 452, rightDelimiter); + ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 417, rightDelimiter); zephir_check_call_status(); ZEPHIR_INIT_VAR(pattern); ZEPHIR_CONCAT_SVSVVSVS(pattern, "/", ldS, "([^", ldS, rdS, "]+)", rdS, "/"); @@ -28229,11 +27356,11 @@ static PHP_METHOD(Phalcon_Text, dynamic) { ZEPHIR_INIT_NVAR(words); zephir_fast_explode(words, separator, _12$$6, LONG_MAX TSRMLS_CC); ZEPHIR_OBS_NVAR(word); - ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 453, words); + ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 418, words); zephir_check_call_status(); zephir_array_fetch(&word, words, _13$$6, PH_NOISY, "phalcon/text.zep", 302 TSRMLS_CC); zephir_array_fetch_long(&_15$$6, match, 0, PH_NOISY | PH_READONLY, "phalcon/text.zep", 303 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 452, _15$$6, separator); + ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 417, _15$$6, separator); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_16$$6); ZEPHIR_CONCAT_SVS(_16$$6, "/", sub, "/"); @@ -28409,13 +27536,13 @@ static PHP_METHOD(Phalcon_Validation, __construct) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_INIT_NVAR(_0$$3); zephir_create_closure_ex(_0$$3, NULL, phalcon_0__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 463, validators, _0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "array_filter", &_2, 458, validators, _0$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_validators"), _1$$3 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_INIT_NVAR(_3$$3); zephir_create_closure_ex(_3$$3, NULL, phalcon_1__closure_ce, SS("__invoke") TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 463, validators, _3$$3); + ZEPHIR_CALL_FUNCTION(&_4$$3, "array_filter", &_2, 458, validators, _3$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_combinedFieldsValidators"), _4$$3 TSRMLS_CC); } @@ -28895,7 +28022,7 @@ static PHP_METHOD(Phalcon_Validation, appendMessage) { ZEPHIR_CALL_METHOD(NULL, messages, "__construct", NULL, 3); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 464, message); + ZEPHIR_CALL_METHOD(NULL, messages, "appendmessage", NULL, 459, message); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); RETURN_THIS(); @@ -29319,7 +28446,7 @@ static PHP_METHOD(Phalcon_Version, get) { zephir_array_fetch_long(&specialNumber, version, 4, PH_NOISY, "phalcon/version.zep", 143 TSRMLS_CC); ZEPHIR_INIT_VAR(result); ZEPHIR_CONCAT_VSVSVS(result, major, ".", medium, ".", minor, " "); - ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 474, special); + ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 469, special); zephir_check_call_status(); if (!ZEPHIR_IS_STRING(suffix, "")) { ZEPHIR_INIT_VAR(_1$$3); @@ -29386,7 +28513,7 @@ static PHP_METHOD(Phalcon_Version, getPart) { } if (part == 3) { zephir_array_fetch_long(&_1$$4, version, 3, PH_NOISY | PH_READONLY, "phalcon/version.zep", 204 TSRMLS_CC); - ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 474, _1$$4); + ZEPHIR_CALL_STATIC(&result, "_getspecial", &_0, 469, _1$$4); zephir_check_call_status(); break; } @@ -31276,428 +30403,6 @@ static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedParameter) { - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { - - smart_str_appendc(&processed_str, ch); - i++; - - open_parentheses = 0; - for (j = i; j < length; j++) { - - ch = comment[j]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (open_parentheses == 0) { - - if (isalnum(ch) || '_' == ch || '\\' == ch) { - smart_str_appendc(&processed_str, ch); - continue; - } - - if (ch == '(') { - smart_str_appendc(&processed_str, ch); - open_parentheses++; - continue; - } - - } else { - - smart_str_appendc(&processed_str, ch); - - if (ch == '(') { - open_parentheses++; - } else { - if (ch == ')') { - open_parentheses--; - } else { - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - } - - if (open_parentheses > 0) { - continue; - } - } - - i = j; - smart_str_appendc(&processed_str, ' '); - break; - } - } - - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - - smart_str_0(&processed_str); - -#if PHP_VERSION_ID < 70000 - if (processed_str.len) { - *ret = processed_str.c; - *ret_len = processed_str.len; - } else { - *ret = NULL; - *ret_len = 0; - } -#else - if (processed_str.s) { - *ret = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s)); - *ret_len = ZSTR_LEN(processed_str.s); - smart_str_free(&processed_str); - } else { - *ret = NULL; - *ret_len = 0; - } -#endif -} - -static int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg TSRMLS_DC) -{ - phannot_scanner_state *state; - phannot_scanner_token token; - int start_lines; - int scanner_status, status = SUCCESS; - phannot_parser_status *parser_status = NULL; - void* phannot_parser; - char *processed_comment; - int processed_comment_len; - - *error_msg = NULL; - - if (UNEXPECTED(!comment)) { - ZVAL_BOOL(*result, 0); - spprintf(error_msg, 0, "Empty annotation"); - return FAILURE; - } - - if (comment_len < 2) { - ZVAL_BOOL(*result, 0); - return SUCCESS; - } - - phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines); - - if (processed_comment_len < 2) { - ZVAL_BOOL(*result, 0); - if (processed_comment) { - efree(processed_comment); - } - - return SUCCESS; - } - - phannot_parser = phannot_Alloc(phannot_wrapper_alloc); - if (unlikely(!phannot_parser)) { - ZVAL_BOOL(*result, 0); - return FAILURE; - } - - parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state)); - state = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status)); - - parser_status->status = PHANNOT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - state->active_token = 0; - state->start = processed_comment; - state->start_length = 0; - state->mode = PHANNOT_MODE_RAW; - state->active_file = file_path; - - token.value = NULL; - token.len = 0; - - if (line) { - state->active_line = line - start_lines; - } else { - state->active_line = 1; - } - - state->end = state->start; - - while(0 <= (scanner_status = phannot_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = processed_comment + processed_comment_len - state->start; - - switch (token.opcode) { - - case PHANNOT_T_IGNORE: - break; - - case PHANNOT_T_AT: - phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status); - break; - case PHANNOT_T_COMMA: - phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status); - break; - case PHANNOT_T_EQUALS: - phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status); - break; - case PHANNOT_T_COLON: - phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status); - break; - - case PHANNOT_T_PARENTHESES_OPEN: - phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHANNOT_T_PARENTHESES_CLOSE: - phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_BRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_BRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_SBRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_SBRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status); - break; - - case PHANNOT_T_NULL: - phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status); - break; - case PHANNOT_T_TRUE: - phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status); - break; - case PHANNOT_T_FALSE: - phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status); - break; - - case PHANNOT_T_INTEGER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status); - break; - case PHANNOT_T_DOUBLE: - phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status); - break; - case PHANNOT_T_STRING: - phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status); - break; - case PHANNOT_T_IDENTIFIER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status); - break; - /*case PHANNOT_T_ARBITRARY_TEXT: - phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status); - break;*/ - - default: - parser_status->status = PHANNOT_PARSING_FAILED; - if (!*error_msg) { - spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line); - } - break; - } - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHANNOT_SCANNER_RETCODE_ERR: - case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phannot_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - status = FAILURE; - break; - - default: - phannot_(phannot_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { - if (!*error_msg) { - *error_msg = parser_status->syntax_error; - } else { - efree(parser_status->syntax_error); - } - } - } - - phannot_Free(phannot_parser, phannot_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHANNOT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - } - } - - efree(processed_comment); - efree(parser_status); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -31967,4374 +30672,968 @@ ZEPHIR_INIT_CLASS(Phalcon_Annotations_Exception) { +#if PHP_VERSION_ID < 70000 +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +// 28 "parser.php5.lemon" -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 +// 12 "parser.php5.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 #endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** AACODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** AANOCODE is a number of type AACODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** AAFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** AAACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** phannot_TOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** AAMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval* aa36; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < AANSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. +** +** N == AANSTATE+AANRULE A syntax error has occurred. +** +** N == AANSTATE+AANRULE+1 The parser accepts its input. +** +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. +** +** The action table is constructed as a single large table named aa_action[]. +** Given state S and lookahead X, the action is computed as +** +** aa_action[ aa_shift_ofst[S] + X ] +** +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for +** shifting terminals. +** aa_reduce_ofst[] For each state, the offset into aa_action for +** shifting non-terminals after a reduce. +** aa_default[] Default action for each state. +*/ +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ +static AACODETYPE aa_lookahead[] = { + /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, + /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, + /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, + /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, + /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, + /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, + /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, + /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, + /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, }; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ +#define AA_SHIFT_USE_DFLT (-3) +static signed char aa_shift_ofst[] = { + /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, + /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, + /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, + /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, }; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ +#define AA_REDUCE_USE_DFLT (-21) +static signed char aa_reduce_ofst[] = { + /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, + /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, + /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, + /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, }; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ +static AAACTIONTYPE aa_default[] = { + /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, + /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, + /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, + /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, }; +#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef AAFALLBACK +static const AACODETYPE aaFallback[] = { }; +#endif /* AAFALLBACK */ -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct aaStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + AAMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ }; +typedef struct aaStackEntry aaStackEntry; -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct aaParser { + int aaidx; /* Index of top element in stack */ + int aaerrcnt; /* Shifts left before out of the error */ + phannot_ARG_SDECL /* A place to hold %extra_argument */ + aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ }; +typedef struct aaParser aaParser; -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) +#ifndef NDEBUG +static FILE *aaTraceFILE = 0; +static char *aaTracePrompt = 0; +#endif /* NDEBUG */ -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); +#ifndef NDEBUG +static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ + aaTraceFILE = TraceFILE; + aaTracePrompt = zTracePrompt; + if( aaTraceFILE==0 ) aaTracePrompt = 0; + else if( aaTracePrompt==0 ) aaTraceFILE = 0; } +#endif /* NDEBUG */ -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *aaTokenName[] = { + "$", "COMMA", "AT", "IDENTIFIER", + "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", + "COLON", "INTEGER", "DOUBLE", "NULL", + "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", + "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", + "annotation_language", "annotation_list", "annotation", "argument_list", + "argument_item", "expr", "array", +}; +#endif /* NDEBUG */ -/* Add a new action to the current transaction set +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. */ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; +static const char *aaRuleName[] = { + /* 0 */ "program ::= annotation_language", + /* 1 */ "annotation_language ::= annotation_list", + /* 2 */ "annotation_list ::= annotation_list annotation", + /* 3 */ "annotation_list ::= annotation", + /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", + /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", + /* 6 */ "annotation ::= AT IDENTIFIER", + /* 7 */ "argument_list ::= argument_list COMMA argument_item", + /* 8 */ "argument_list ::= argument_item", + /* 9 */ "argument_item ::= expr", + /* 10 */ "argument_item ::= STRING EQUALS expr", + /* 11 */ "argument_item ::= STRING COLON expr", + /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", + /* 13 */ "argument_item ::= IDENTIFIER COLON expr", + /* 14 */ "expr ::= annotation", + /* 15 */ "expr ::= array", + /* 16 */ "expr ::= IDENTIFIER", + /* 17 */ "expr ::= INTEGER", + /* 18 */ "expr ::= STRING", + /* 19 */ "expr ::= DOUBLE", + /* 20 */ "expr ::= NULL", + /* 21 */ "expr ::= FALSE", + /* 22 */ "expr ::= TRUE", + /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", + /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", +}; +#endif /* NDEBUG */ + +const char *phannot_TokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ + return aaTokenName[tokenType]; }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } + return "Unknown"; } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; +#else + return ""; +#endif } -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; +void *phannot_Alloc(void *(*mallocProc)(size_t)){ + aaParser *pParser; + pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); + if( pParser ){ + pParser->aaidx = -1; } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); + return pParser; } -/********************** From the file "build.c" *****************************/ -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "aamajor" is the symbol code, and "aapminor" is a pointer to +** the value. */ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; +static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ + switch( aamajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: +// 77 "parser.php5.lemon" +{ + if ((aapminor->aa0)) { + if ((aapminor->aa0)->free_flag) { + efree((aapminor->aa0)->token); + } + efree((aapminor->aa0)); } - } - } - } - return; } - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; +// 378 "parser.php5.c" + break; + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: +// 90 "parser.php5.lemon" { - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; + zval_ptr_dtor(&(aapminor->aa36)); } - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); +// 390 "parser.php5.c" + break; + default: break; /* If no destructor action specified: do nothing */ } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; } -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ +static int aa_pop_parser_stack(aaParser *pParser){ + AACODETYPE aamajor; + aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + + if( pParser->aaidx<0 ) return 0; +#ifndef NDEBUG + if( aaTraceFILE && pParser->aaidx>=0 ){ + fprintf(aaTraceFILE,"%sPopping %s\n", + aaTracePrompt, + aaTokenName[aatos->major]); } - return stp; +#endif + aamajor = aatos->major; + aa_destructor( aamajor, &aatos->minor); + pParser->aaidx--; + return aamajor; } -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } +static void phannot_Free( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + aaParser *pParser = (aaParser*)p; + if( pParser==0 ) return; + while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); } -void FindLinks(lemp) -struct lemon *lemp; -{ +static int aa_find_shift_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ + i = aa_shift_ofst[stateno]; + if( i==AA_SHIFT_USE_DFLT ){ + return aa_default[stateno]; } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ +#ifdef AAFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead %s\n", + aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); } +#endif + return aa_find_shift_action(pParser, iFallback); } +#endif + return aa_default[stateno]; + }else{ + return aa_action[i]; } } -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ +static int aa_find_reduce_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } + int stateno = pParser->aastack[pParser->aaidx].stateno; + + i = aa_reduce_ofst[stateno]; + if( i==AA_REDUCE_USE_DFLT ){ + return aa_default[stateno]; } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ + return aa_default[stateno]; }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; + return aa_action[i]; } } -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ +static void aa_shift( + aaParser *aapParser, /* The parser to be shifted */ + int aaNewState, /* The new state to shift in */ + int aaMajor, /* The major token to shift in */ + AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ +){ + aaStackEntry *aatos; + aapParser->aaidx++; + if( aapParser->aaidx>=AASTACKDEPTH ){ + phannot_ARG_FETCH; + aapParser->aaidx--; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); + } +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ + aatos = &aapParser->aastack[aapParser->aaidx]; + aatos->stateno = aaNewState; + aatos->major = aaMajor; + aatos->minor = *aapMinor; +#ifndef NDEBUG + if( aaTraceFILE && aapParser->aaidx>0 ){ int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; iaaidx; i++) + fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); + fprintf(aaTraceFILE,"\n"); } - new = freelist; - freelist = freelist->next; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; +#endif } -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static struct { + AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} aaRuleInfo[] = { + { 19, 1 }, + { 20, 1 }, + { 21, 2 }, + { 21, 1 }, + { 22, 5 }, + { 22, 4 }, + { 22, 2 }, + { 23, 3 }, + { 23, 1 }, + { 24, 1 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 26, 3 }, + { 26, 3 }, +}; -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} +static void aa_accept(aaParser*); /* Forward Declaration */ -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; iaastack[aapParser->aaidx]; +#ifndef NDEBUG + if( aaTraceFILE && aaruleno>=0 + && aaruleno + ** { ... } // User supplied code + ** // + ** break; + */ + case 0: +// 86 "parser.php5.lemon" { - int i; - int dashdash = 0; - if( argv!=0 && *argv!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ){ - if( n==0 ) return i; - n--; - } - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return -1; + status->ret = aamsp[0].minor.aa36; } - -static char emsg[] = "Command line syntax error: "; - -static int handleflags(i,err) -int i; -FILE *err; -{ - int v; - int errcnt = 0; - int j; - for(j=0; op[j].label; j++){ - if( strncmp(&argv[i][1],op[j].label,strlen(op[j].label))==0 ) break; - } - v = argv[i][0]=='-' ? 1 : 0; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,1,err); - } - errcnt++; - }else if( op[j].type==OPT_FLAG ){ - *((int*)op[j].arg) = v; - }else if( op[j].type==OPT_FFLAG ){ - (*(void(*)())(op[j].arg))(v); - }else if( op[j].type==OPT_FSTR ){ - (*(void(*)())(op[j].arg))(&argv[i][2]); - }else{ - if( err ){ - fprintf(err,"%smissing argument on switch.\n",emsg); - errline(i,1,err); - } - errcnt++; - } - return errcnt; -} - -static int handleswitch(i,err) -int i; -FILE *err; -{ - int lv = 0; - double dv = 0.0; - char *sv = 0, *end; - char *cp; - int j; - int errcnt = 0; - cp = strchr(argv[i],'='); - *cp = 0; - for(j=0; op[j].label; j++){ - if( strcmp(argv[i],op[j].label)==0 ) break; - } - *cp = '='; - if( op[j].label==0 ){ - if( err ){ - fprintf(err,"%sundefined option.\n",emsg); - errline(i,0,err); - } - errcnt++; - }else{ - cp++; - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - if( err ){ - fprintf(err,"%soption requires an argument.\n",emsg); - errline(i,0,err); - } - errcnt++; - break; - case OPT_DBL: - case OPT_FDBL: - dv = strtod(cp,&end); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in floating-point argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_INT: - case OPT_FINT: - lv = strtol(cp,&end,0); - if( *end ){ - if( err ){ - fprintf(err,"%sillegal character in integer argument.\n",emsg); - errline(i,((unsigned long)end)-(unsigned long)argv[i],err); - } - errcnt++; - } - break; - case OPT_STR: - case OPT_FSTR: - sv = cp; - break; - } - switch( op[j].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_DBL: - *(double*)(op[j].arg) = dv; - break; - case OPT_FDBL: - (*(void(*)())(op[j].arg))(dv); - break; - case OPT_INT: - *(int*)(op[j].arg) = lv; - break; - case OPT_FINT: - (*(void(*)())(op[j].arg))((int)lv); - break; - case OPT_STR: - *(char**)(op[j].arg) = sv; - break; - case OPT_FSTR: - (*(void(*)())(op[j].arg))(sv); +// 632 "parser.php5.c" break; - } - } - return errcnt; -} - -int OptInit(a,o,err) -char **a; -struct s_options *o; -FILE *err; -{ - int errcnt = 0; - argv = a; - op = o; - errstream = err; - if( argv && *argv && op ){ - int i; - for(i=1; argv[i]; i++){ - if( argv[i][0]=='+' || argv[i][0]=='-' ){ - errcnt += handleflags(i,err); - }else if( strchr(argv[i],'=') ){ - errcnt += handleswitch(i,err); - } - } - } - if( errcnt>0 ){ - fprintf(err,"Valid command line options for \"%s\" are:\n",*a); - OptPrint(); - exit(1); - } - return 0; -} - -int OptNArgs(){ - int cnt = 0; - int dashdash = 0; - int i; - if( argv!=0 && argv[0]!=0 ){ - for(i=1; argv[i]; i++){ - if( dashdash || !ISOPT(argv[i]) ) cnt++; - if( strcmp(argv[i],"--")==0 ) dashdash = 1; - } - } - return cnt; -} - -char *OptArg(n) -int n; + case 1: + case 14: + case 15: +// 94 "parser.php5.lemon" { - int i; - i = argindex(n); - return i>=0 ? argv[i] : 0; + aagotominor.aa36 = aamsp[0].minor.aa36; } - -void OptErr(n) -int n; +// 641 "parser.php5.c" + break; + case 2: +// 102 "parser.php5.lemon" { - int i; - i = argindex(n); - if( i>=0 ) errline(i,0,errstream); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); } - -void OptPrint(){ - int i; - int max, len; - max = 0; - for(i=0; op[i].label; i++){ - len = strlen(op[i].label) + 1; - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - break; - case OPT_INT: - case OPT_FINT: - len += 9; /* length of "" */ - break; - case OPT_DBL: - case OPT_FDBL: - len += 6; /* length of "" */ - break; - case OPT_STR: - case OPT_FSTR: - len += 8; /* length of "" */ - break; - } - if( len>max ) max = len; - } - for(i=0; op[i].label; i++){ - switch( op[i].type ){ - case OPT_FLAG: - case OPT_FFLAG: - fprintf(errstream," -%-*s %s\n",max,op[i].label,op[i].message); - break; - case OPT_INT: - case OPT_FINT: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-9),"",op[i].message); - break; - case OPT_DBL: - case OPT_FDBL: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-6),"",op[i].message); - break; - case OPT_STR: - case OPT_FSTR: - fprintf(errstream," %s=%*s %s\n",op[i].label, - (int)(max-strlen(op[i].label)-8),"",op[i].message); +// 648 "parser.php5.c" break; - } - } -} -/*********************** From the file "parse.c" ****************************/ - -/* The state of the parser */ -struct pstate { - char *filename; /* Name of the input file */ - int tokenlineno; /* Linenumber at which current token starts */ - int errorcnt; /* Number of errors so far */ - char *tokenstart; /* Text of current token */ - struct lemon *gp; /* Global state vector */ - enum e_state { - INITIALIZE, - WAITING_FOR_DECL_OR_RULE, - WAITING_FOR_DECL_KEYWORD, - WAITING_FOR_DECL_ARG, - WAITING_FOR_PRECEDENCE_SYMBOL, - WAITING_FOR_ARROW, - IN_RHS, - LHS_ALIAS_1, - LHS_ALIAS_2, - LHS_ALIAS_3, - RHS_ALIAS_1, - RHS_ALIAS_2, - PRECEDENCE_MARK_1, - PRECEDENCE_MARK_2, - RESYNC_AFTER_RULE_ERROR, - RESYNC_AFTER_DECL_ERROR, - WAITING_FOR_DESTRUCTOR_SYMBOL, - WAITING_FOR_DATATYPE_SYMBOL, - WAITING_FOR_FALLBACK_ID - } state; /* The state of the parser */ - struct symbol *fallback; /* The fallback token */ - struct symbol *lhs; /* Left-hand side of current rule */ - char *lhsalias; /* Alias for the LHS */ - int nrhs; /* Number of right-hand side symbols seen */ - struct symbol *rhs[MAXRHS]; /* RHS symbols */ - char *alias[MAXRHS]; /* Aliases for each RHS symbol (or NULL) */ - struct rule *prevrule; /* Previous rule parsed */ - char *declkeyword; /* Keyword of a declaration */ - char **declargslot; /* Where the declaration argument should be put */ - int *decllnslot; /* Where the declaration linenumber is put */ - enum e_assoc declassoc; /* Assign this association to decl arguments */ - int preccounter; /* Assign this precedence to decl arguments */ - struct rule *firstrule; /* Pointer to first rule in the grammar */ - struct rule *lastrule; /* Pointer to the most recently parsed rule */ -}; - -/* Parse a single token */ -static void parseonetoken(psp) -struct pstate *psp; + case 3: + case 8: +// 106 "parser.php5.lemon" { - char *x; - x = Strsafe(psp->tokenstart); /* Save the token permanently */ -#if 0 - printf("%s:%d: Token=[%s] state=%d\n",psp->filename,psp->tokenlineno, - x,psp->state); -#endif - switch( psp->state ){ - case INITIALIZE: - psp->prevrule = 0; - psp->preccounter = 0; - psp->firstrule = psp->lastrule = 0; - psp->gp->nrule = 0; - /* Fall thru to next case */ - case WAITING_FOR_DECL_OR_RULE: - if( x[0]=='%' ){ - psp->state = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } + aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); } - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; +// 656 "parser.php5.c" + break; + case 4: +// 114 "parser.php5.lemon" { - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + aa_destructor(2,&aamsp[-4].minor); + aa_destructor(4,&aamsp[-2].minor); + aa_destructor(5,&aamsp[0].minor); } -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; +// 666 "parser.php5.c" + break; + case 5: +// 118 "parser.php5.lemon" { - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-3].minor); + aa_destructor(4,&aamsp[-1].minor); + aa_destructor(5,&aamsp[0].minor); } - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; +// 676 "parser.php5.c" + break; + case 6: +// 122 "parser.php5.lemon" { - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } + aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-1].minor); } - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; +// 684 "parser.php5.c" + break; + case 7: +// 130 "parser.php5.lemon" { - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); + aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + aa_destructor(1,&aamsp[-1].minor); } - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; +// 692 "parser.php5.c" + break; + case 9: +// 142 "parser.php5.lemon" { - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; + aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); } - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; +// 699 "parser.php5.c" + break; + case 10: + case 12: +// 146 "parser.php5.lemon" { - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(7,&aamsp[-1].minor); } - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; +// 708 "parser.php5.c" + break; + case 11: + case 13: +// 150 "parser.php5.lemon" { - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } + aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + aa_destructor(8,&aamsp[-1].minor); } - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; +// 717 "parser.php5.c" + break; + case 16: +// 174 "parser.php5.lemon" { - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; +// 724 "parser.php5.c" break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; + case 17: +// 178 "parser.php5.lemon" { - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; +// 731 "parser.php5.c" + break; + case 18: +// 182 "parser.php5.lemon" { - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } + aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); } - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; +// 738 "parser.php5.c" + break; + case 19: +// 186 "parser.php5.lemon" { - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } + aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + aa_destructor(16,&aamsp[-2].minor); + aa_destructor(17,&aamsp[0].minor); } -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; +// 787 "parser.php5.c" + break; + }; + aagoto = aaRuleInfo[aaruleno].lhs; + aasize = aaRuleInfo[aaruleno].nrhs; + aapParser->aaidx -= aasize; + aaact = aa_find_reduce_action(aapParser,aagoto); + if( aaact < AANSTATE ){ + aa_shift(aapParser,aaact,aagoto,&aagotominor); + }else if( aaact == AANSTATE + AANRULE + 1 ){ + aa_accept(aapParser); } - return np ? np->data : 0; } -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); +static void aa_parse_failed( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; +static void aa_syntax_error( + aaParser *aapParser, /* The parser */ + int aamajor, /* The major type of the error token */ + AAMINORTYPE aaminor /* The minor type of the error token */ +){ + phannot_ARG_FETCH; +#define ATOKEN (aaminor.aa0) +// 32 "parser.php5.lemon" -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} + if (status->scanner_state->start_length) { + char *token_name = NULL; + const phannot_token_names *tokens = phannot_tokens; + uint active_token = status->scanner_state->active_token; + uint near_length = status->scanner_state->start_length; -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} + if (active_token) { + do { + if (tokens->code == active_token) { + token_name = tokens->name; + break; + } + ++tokens; + } while (tokens[0].code != 0); + } -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} + if (!token_name) { + token_name = "UNKNOWN"; + } -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} + if (near_length > 0) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + if (active_token != PHANNOT_T_IGNORE) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); + } + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + } -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} + status->status = PHANNOT_PARSING_FAILED; -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; +// 874 "parser.php5.c" + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; +static void aa_accept( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* There is one instance of the following structure for each -** associative array of type "x3". +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "phannot_Alloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. */ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; +static void phannot_( + void *aap, /* The parser */ + int aamajor, /* The major token code number */ + phannot_TOKENTYPE aaminor /* The value for the token */ + phannot_ARG_PDECL /* Optional %extra_argument parameter */ +){ + AAMINORTYPE aaminorunion; + int aaact; /* The parser action. */ + int aaendofinput; /* True if we are at the end of input */ + int aaerrorhit = 0; /* True if aamajor has invoked an error */ + aaParser *aapParser; /* The parser */ -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; + /* (re)initialize the parser, if necessary */ + aapParser = (aaParser*)aap; + if( aapParser->aaidx<0 ){ + if( aamajor==0 ) return; + aapParser->aaidx = 0; + aapParser->aaerrcnt = -1; + aapParser->aastack[0].stateno = 0; + aapParser->aastack[0].major = 0; } - return np ? np->data : 0; -} + aaminorunion.aa0 = aaminor; + aaendofinput = (aamajor==0); + phannot_ARG_STORE; -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; +#endif -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; + do{ + aaact = aa_find_shift_action(aapParser,aamajor); + if( aaactaaerrcnt--; + if( aaendofinput && aapParser->aaidx>=0 ){ + aamajor = 0; + }else{ + aamajor = AANOCODE; + } + }else if( aaact < AANSTATE + AANRULE ){ + aa_reduce(aapParser,aaact-AANSTATE); + }else if( aaact == AA_ERROR_ACTION ){ + int aamx; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); + } +#endif +#ifdef AAERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( aapParser->aaerrcnt<0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aamx = aapParser->aastack[aapParser->aaidx].major; + if( aamx==AAERRORSYMBOL || aaerrorhit ){ +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sDiscard input token %s\n", + aaTracePrompt,aaTokenName[aamajor]); + } +#endif + aa_destructor(aamajor,&aaminorunion); + aamajor = AANOCODE; + }else{ + while( + aapParser->aaidx >= 0 && + aamx != AAERRORSYMBOL && + (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE + ){ + aa_pop_parser_stack(aapParser); + } + if( aapParser->aaidx < 0 || aamajor==0 ){ + aa_destructor(aamajor,&aaminorunion); + aa_parse_failed(aapParser); + aamajor = AANOCODE; + }else if( aamx!=AAERRORSYMBOL ){ + AAMINORTYPE u2; + u2.AAERRSYMDT = 0; + aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); + } + } + aapParser->aaerrcnt = 3; + aaerrorhit = 1; +#else /* AAERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( aapParser->aaerrcnt<=0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aapParser->aaerrcnt = 3; + aa_destructor(aamajor,&aaminorunion); + if( aaendofinput ){ + aa_parse_failed(aapParser); + } + aamajor = AANOCODE; +#endif }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; + aa_accept(aapParser); + aamajor = AANOCODE; } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; + }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 28 "parser.php7.lemon" + + +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -36342,41 +31641,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** AACODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** AANOCODE is a number of type AACODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** AAFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** AAACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phannot_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** AAMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval aa8; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -36386,670 +31702,55 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < AANSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == AANSTATE+AANRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == AANSTATE+AANRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named aa_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** aa_action[ aa_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** aa_reduce_ofst[] For each state, the offset into aa_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. +** aa_default[] Default action for each state. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval* aa36; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, + /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, + /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, + /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, + /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, }; static AACODETYPE aa_lookahead[] = { /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, @@ -37245,7 +31946,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 15: case 16: case 17: -// 77 "parser.php5.lemon" +// 77 "parser.php7.lemon" { if ((aapminor->aa0)) { if ((aapminor->aa0)->free_flag) { @@ -37254,7 +31955,7 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ efree((aapminor->aa0)); } } -// 378 "parser.php5.c" +// 378 "parser.php7.c" break; case 20: case 21: @@ -37262,11 +31963,11 @@ static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ case 23: case 24: case 25: -// 90 "parser.php5.lemon" +// 90 "parser.php7.lemon" { - zval_ptr_dtor(&(aapminor->aa36)); + zval_ptr_dtor(&(aapminor->aa8)); } -// 390 "parser.php5.c" +// 390 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } @@ -37461,166 +32162,166 @@ static void aa_reduce( ** break; */ case 0: -// 86 "parser.php5.lemon" +// 86 "parser.php7.lemon" { - status->ret = aamsp[0].minor.aa36; + ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); } -// 632 "parser.php5.c" +// 632 "parser.php7.c" break; case 1: case 14: case 15: -// 94 "parser.php5.lemon" +// 94 "parser.php7.lemon" { - aagotominor.aa36 = aamsp[0].minor.aa36; + aagotominor.aa8 = aamsp[0].minor.aa8; } -// 641 "parser.php5.c" +// 641 "parser.php7.c" break; case 2: -// 102 "parser.php5.lemon" +// 102 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-1].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); } -// 648 "parser.php5.c" +// 648 "parser.php7.c" break; case 3: case 8: -// 106 "parser.php5.lemon" +// 106 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(NULL, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 656 "parser.php5.c" +// 656 "parser.php7.c" break; case 4: -// 114 "parser.php5.lemon" +// 114 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-3].minor.aa0, aamsp[-1].minor.aa36, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); aa_destructor(2,&aamsp[-4].minor); aa_destructor(4,&aamsp[-2].minor); aa_destructor(5,&aamsp[0].minor); } -// 666 "parser.php5.c" +// 666 "parser.php7.c" break; case 5: -// 118 "parser.php5.lemon" +// 118 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[-2].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-3].minor); aa_destructor(4,&aamsp[-1].minor); aa_destructor(5,&aamsp[0].minor); } -// 676 "parser.php5.c" +// 676 "parser.php7.c" break; case 6: -// 122 "parser.php5.lemon" +// 122 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_annotation(aamsp[0].minor.aa0, NULL, status->scanner_state); + phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); aa_destructor(2,&aamsp[-1].minor); } -// 684 "parser.php5.c" +// 684 "parser.php7.c" break; case 7: -// 130 "parser.php5.lemon" +// 130 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_zval_list(aamsp[-2].minor.aa36, aamsp[0].minor.aa36); + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); aa_destructor(1,&aamsp[-1].minor); } -// 692 "parser.php5.c" +// 692 "parser.php7.c" break; case 9: -// 142 "parser.php5.lemon" +// 142 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(NULL, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); } -// 699 "parser.php5.c" +// 699 "parser.php7.c" break; case 10: case 12: -// 146 "parser.php5.lemon" +// 146 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(7,&aamsp[-1].minor); } -// 708 "parser.php5.c" +// 708 "parser.php7.c" break; case 11: case 13: -// 150 "parser.php5.lemon" +// 150 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_named_item(aamsp[-2].minor.aa0, aamsp[0].minor.aa36); + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); aa_destructor(8,&aamsp[-1].minor); } -// 717 "parser.php5.c" +// 717 "parser.php7.c" break; case 16: -// 174 "parser.php5.lemon" +// 174 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); } -// 724 "parser.php5.c" +// 724 "parser.php7.c" break; case 17: -// 178 "parser.php5.lemon" +// 178 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); } -// 731 "parser.php5.c" +// 731 "parser.php7.c" break; case 18: -// 182 "parser.php5.lemon" +// 182 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_STRING, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); } -// 738 "parser.php5.c" +// 738 "parser.php7.c" break; case 19: -// 186 "parser.php5.lemon" +// 186 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); } -// 745 "parser.php5.c" +// 745 "parser.php7.c" break; case 20: -// 190 "parser.php5.lemon" +// 190 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); aa_destructor(11,&aamsp[0].minor); } -// 753 "parser.php5.c" +// 753 "parser.php7.c" break; case 21: -// 194 "parser.php5.lemon" +// 194 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); aa_destructor(12,&aamsp[0].minor); } -// 761 "parser.php5.c" +// 761 "parser.php7.c" break; case 22: -// 198 "parser.php5.lemon" +// 198 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); aa_destructor(13,&aamsp[0].minor); } -// 769 "parser.php5.c" +// 769 "parser.php7.c" break; case 23: -// 202 "parser.php5.lemon" +// 202 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(14,&aamsp[-2].minor); aa_destructor(15,&aamsp[0].minor); } -// 778 "parser.php5.c" +// 778 "parser.php7.c" break; case 24: -// 206 "parser.php5.lemon" +// 206 "parser.php7.lemon" { - aagotominor.aa36 = phannot_ret_array(aamsp[-1].minor.aa36); + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); aa_destructor(16,&aamsp[-2].minor); aa_destructor(17,&aamsp[0].minor); } -// 787 "parser.php5.c" +// 787 "parser.php7.c" break; }; aagoto = aaRuleInfo[aaruleno].lhs; @@ -37656,7 +32357,7 @@ static void aa_syntax_error( ){ phannot_ARG_FETCH; #define ATOKEN (aaminor.aa0) -// 32 "parser.php5.lemon" +// 32 "parser.php7.lemon" if (status->scanner_state->start_length) { char *token_name = NULL; @@ -37701,7 +32402,7 @@ static void aa_syntax_error( status->status = PHANNOT_PARSING_FAILED; -// 874 "parser.php5.c" +// 874 "parser.php7.c" phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -37869,1082 +32570,133 @@ static void phannot_( }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); return; } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 28 "parser.php7.lemon" - - -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval aa8; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static AACODETYPE aa_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define AA_SHIFT_USE_DFLT (-3) -static signed char aa_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define AA_REDUCE_USE_DFLT (-21) -static signed char aa_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static AAACTIONTYPE aa_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef AAFALLBACK -static const AACODETYPE aaFallback[] = { +const phannot_token_names phannot_tokens[] = +{ + { "INTEGER", PHANNOT_T_INTEGER }, + { "DOUBLE", PHANNOT_T_DOUBLE }, + { "STRING", PHANNOT_T_STRING }, + { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, + { "@", PHANNOT_T_AT }, + { ",", PHANNOT_T_COMMA }, + { "=", PHANNOT_T_EQUALS }, + { ":", PHANNOT_T_COLON }, + { "(", PHANNOT_T_PARENTHESES_OPEN }, + { ")", PHANNOT_T_PARENTHESES_CLOSE }, + { "{", PHANNOT_T_BRACKET_OPEN }, + { "}", PHANNOT_T_BRACKET_CLOSE }, + { "[", PHANNOT_T_SBRACKET_OPEN }, + { "]", PHANNOT_T_SBRACKET_CLOSE }, + { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, + { NULL, 0 } }; -#endif /* AAFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct aaStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - AAMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct aaStackEntry aaStackEntry; +static void *phannot_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct aaParser { - int aaidx; /* Index of top element in stack */ - int aaerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ -}; -typedef struct aaParser aaParser; +static void phannot_wrapper_free(void *pointer){ + efree(pointer); +} -#ifndef NDEBUG -static FILE *aaTraceFILE = 0; -static char *aaTracePrompt = 0; -#endif /* NDEBUG */ +static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - aaTraceFILE = TraceFILE; - aaTracePrompt = zTracePrompt; - if( aaTraceFILE==0 ) aaTracePrompt = 0; - else if( aaTracePrompt==0 ) aaTraceFILE = 0; -} -#endif /* NDEBUG */ + phannot_parser_token *pToken; -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *aaTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ + pToken = emalloc(sizeof(phannot_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *aaRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + phannot_(phannot_parser, parsercode, pToken, parser_status); -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ - return aaTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif + token->value = NULL; + token->len = 0; } -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - aaParser *pParser; - pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); - if( pParser ){ - pParser->aaidx = -1; - } - return pParser; +static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ + + phannot_scanner_state *state = parser_status->scanner_state; + + if (state->start) { + if (state->start_length > 16) { + spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); + } else { + spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); + } + } else { + spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); + } } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "aamajor" is the symbol code, and "aapminor" is a pointer to -** the value. -*/ -static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ - switch( aamajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -// 77 "parser.php7.lemon" -{ - if ((aapminor->aa0)) { - if ((aapminor->aa0)->free_flag) { - efree((aapminor->aa0)->token); +static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { + + char *comment_str; + int comment_len; + char *file_path_str; + int line_num; + + char *error_msg = NULL; + + ZVAL_NULL(result); + + if (Z_TYPE_P(comment) == IS_STRING) { + comment_str = Z_STRVAL_P(comment); + comment_len = Z_STRLEN_P(comment); + } else { + comment_str = ""; + comment_len = 0; + } + + if (Z_TYPE_P(file_path) == IS_STRING) { + file_path_str = Z_STRVAL_P(file_path); + } else { + file_path_str = "eval"; + } + + if (Z_TYPE_P(line) == IS_LONG) { + line_num = Z_LVAL_P(line); + } else { + line_num = 0; + } + + if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { + if (likely(error_msg != NULL)) { + zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); + efree(error_msg); + } else { + zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); } - efree((aapminor->aa0)); + + return FAILURE; } + + return SUCCESS; } -// 378 "parser.php7.c" - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -// 90 "parser.php7.lemon" + +static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) { - zval_ptr_dtor(&(aapminor->aa8)); -} -// 390 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} + char ch; + int start_mode = 1, j, i, open_parentheses; + smart_str processed_str = {0}; -static int aa_pop_parser_stack(aaParser *pParser){ - AACODETYPE aamajor; - aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; + (*start_lines) = 0; - if( pParser->aaidx<0 ) return 0; -#ifndef NDEBUG - if( aaTraceFILE && pParser->aaidx>=0 ){ - fprintf(aaTraceFILE,"%sPopping %s\n", - aaTracePrompt, - aaTokenName[aatos->major]); - } -#endif - aamajor = aatos->major; - aa_destructor( aamajor, &aatos->minor); - pParser->aaidx--; - return aamajor; -} + for (i = 0; i < length; i++) { -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - aaParser *pParser = (aaParser*)p; - if( pParser==0 ) return; - while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} + ch = comment[i]; -static int aa_find_shift_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ - i = aa_shift_ofst[stateno]; - if( i==AA_SHIFT_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ -#ifdef AAFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); - } -#endif - return aa_find_shift_action(pParser, iFallback); - } -#endif - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} + if (start_mode) { + if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { + continue; + } + start_mode = 0; + } -static int aa_find_reduce_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - i = aa_reduce_ofst[stateno]; - if( i==AA_REDUCE_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ - return aa_default[stateno]; - }else{ - return aa_action[i]; - } -} - -static void aa_shift( - aaParser *aapParser, /* The parser to be shifted */ - int aaNewState, /* The new state to shift in */ - int aaMajor, /* The major token to shift in */ - AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ -){ - aaStackEntry *aatos; - aapParser->aaidx++; - if( aapParser->aaidx>=AASTACKDEPTH ){ - phannot_ARG_FETCH; - aapParser->aaidx--; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - aatos = &aapParser->aastack[aapParser->aaidx]; - aatos->stateno = aaNewState; - aatos->major = aaMajor; - aatos->minor = *aapMinor; -#ifndef NDEBUG - if( aaTraceFILE && aapParser->aaidx>0 ){ - int i; - fprintf(aaTraceFILE,"%sShift %d\n",aaTracePrompt,aaNewState); - fprintf(aaTraceFILE,"%sStack:",aaTracePrompt); - for(i=1; i<=aapParser->aaidx; i++) - fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); - fprintf(aaTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} aaRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; - -static void aa_accept(aaParser*); /* Forward Declaration */ - -static void aa_reduce( - aaParser *aapParser, /* The parser */ - int aaruleno /* Number of the rule by which to reduce */ -){ - int aagoto; /* The next state */ - int aaact; /* The next action */ - AAMINORTYPE aagotominor; /* The LHS of the rule reduced */ - aaStackEntry *aamsp; /* The top of the parser's stack */ - int aasize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - aamsp = &aapParser->aastack[aapParser->aaidx]; -#ifndef NDEBUG - if( aaTraceFILE && aaruleno>=0 - && aaruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 86 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); -} -// 632 "parser.php7.c" - break; - case 1: - case 14: - case 15: -// 94 "parser.php7.lemon" -{ - aagotominor.aa8 = aamsp[0].minor.aa8; -} -// 641 "parser.php7.c" - break; - case 2: -// 102 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); -} -// 648 "parser.php7.c" - break; - case 3: - case 8: -// 106 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 656 "parser.php7.c" - break; - case 4: -// 114 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); - aa_destructor(2,&aamsp[-4].minor); - aa_destructor(4,&aamsp[-2].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 666 "parser.php7.c" - break; - case 5: -// 118 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-3].minor); - aa_destructor(4,&aamsp[-1].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 676 "parser.php7.c" - break; - case 6: -// 122 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-1].minor); -} -// 684 "parser.php7.c" - break; - case 7: -// 130 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); - aa_destructor(1,&aamsp[-1].minor); -} -// 692 "parser.php7.c" - break; - case 9: -// 142 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 699 "parser.php7.c" - break; - case 10: - case 12: -// 146 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(7,&aamsp[-1].minor); -} -// 708 "parser.php7.c" - break; - case 11: - case 13: -// 150 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(8,&aamsp[-1].minor); -} -// 717 "parser.php7.c" - break; - case 16: -// 174 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); -} -// 724 "parser.php7.c" - break; - case 17: -// 178 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); -} -// 731 "parser.php7.c" - break; - case 18: -// 182 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); -} -// 738 "parser.php7.c" - break; - case 19: -// 186 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); -} -// 745 "parser.php7.c" - break; - case 20: -// 190 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); - aa_destructor(11,&aamsp[0].minor); -} -// 753 "parser.php7.c" - break; - case 21: -// 194 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); - aa_destructor(12,&aamsp[0].minor); -} -// 761 "parser.php7.c" - break; - case 22: -// 198 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); - aa_destructor(13,&aamsp[0].minor); -} -// 769 "parser.php7.c" - break; - case 23: -// 202 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(14,&aamsp[-2].minor); - aa_destructor(15,&aamsp[0].minor); -} -// 778 "parser.php7.c" - break; - case 24: -// 206 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(16,&aamsp[-2].minor); - aa_destructor(17,&aamsp[0].minor); -} -// 787 "parser.php7.c" - break; - }; - aagoto = aaRuleInfo[aaruleno].lhs; - aasize = aaRuleInfo[aaruleno].nrhs; - aapParser->aaidx -= aasize; - aaact = aa_find_reduce_action(aapParser,aagoto); - if( aaact < AANSTATE ){ - aa_shift(aapParser,aaact,aagoto,&aagotominor); - }else if( aaact == AANSTATE + AANRULE + 1 ){ - aa_accept(aapParser); - } -} - -static void aa_parse_failed( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_syntax_error( - aaParser *aapParser, /* The parser */ - int aamajor, /* The major type of the error token */ - AAMINORTYPE aaminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define ATOKEN (aaminor.aa0) -// 32 "parser.php7.lemon" - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - - status->status = PHANNOT_PARSING_FAILED; - -// 874 "parser.php7.c" - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void aa_accept( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *aap, /* The parser */ - int aamajor, /* The major token code number */ - phannot_TOKENTYPE aaminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - AAMINORTYPE aaminorunion; - int aaact; /* The parser action. */ - int aaendofinput; /* True if we are at the end of input */ - int aaerrorhit = 0; /* True if aamajor has invoked an error */ - aaParser *aapParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - aapParser = (aaParser*)aap; - if( aapParser->aaidx<0 ){ - if( aamajor==0 ) return; - aapParser->aaidx = 0; - aapParser->aaerrcnt = -1; - aapParser->aastack[0].stateno = 0; - aapParser->aastack[0].major = 0; - } - aaminorunion.aa0 = aaminor; - aaendofinput = (aamajor==0); - phannot_ARG_STORE; - -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); - } -#endif - - do{ - aaact = aa_find_shift_action(aapParser,aamajor); - if( aaactaaerrcnt--; - if( aaendofinput && aapParser->aaidx>=0 ){ - aamajor = 0; - }else{ - aamajor = AANOCODE; - } - }else if( aaact < AANSTATE + AANRULE ){ - aa_reduce(aapParser,aaact-AANSTATE); - }else if( aaact == AA_ERROR_ACTION ){ - int aamx; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); - } -#endif -#ifdef AAERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( aapParser->aaerrcnt<0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aamx = aapParser->aastack[aapParser->aaidx].major; - if( aamx==AAERRORSYMBOL || aaerrorhit ){ -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sDiscard input token %s\n", - aaTracePrompt,aaTokenName[aamajor]); - } -#endif - aa_destructor(aamajor,&aaminorunion); - aamajor = AANOCODE; - }else{ - while( - aapParser->aaidx >= 0 && - aamx != AAERRORSYMBOL && - (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE - ){ - aa_pop_parser_stack(aapParser); - } - if( aapParser->aaidx < 0 || aamajor==0 ){ - aa_destructor(aamajor,&aaminorunion); - aa_parse_failed(aapParser); - aamajor = AANOCODE; - }else if( aamx!=AAERRORSYMBOL ){ - AAMINORTYPE u2; - u2.AAERRSYMDT = 0; - aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); - } - } - aapParser->aaerrcnt = 3; - aaerrorhit = 1; -#else /* AAERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( aapParser->aaerrcnt<=0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aapParser->aaerrcnt = 3; - aa_destructor(aamajor,&aaminorunion); - if( aaendofinput ){ - aa_parse_failed(aapParser); - } - aamajor = AANOCODE; -#endif - }else{ - aa_accept(aapParser); - aamajor = AANOCODE; - } - }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); - return; -} -#endif - - -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; - -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - - phannot_parser_token *pToken; - - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phannot_(phannot_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - - phannot_scanner_state *state = parser_status->scanner_state; - - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } -} - -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { - - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; - - char *error_msg = NULL; - - ZVAL_NULL(result); - - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); - } else { - comment_str = ""; - comment_len = 0; - } - - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; - } - - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); - } else { - line_num = 0; - } - - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - - return FAILURE; - } - - return SUCCESS; -} - -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; - - (*start_lines) = 0; - - for (i = 0; i < length; i++) { - - ch = comment[i]; - - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } - - if (ch == '@') { + if (ch == '@') { smart_str_appendc(&processed_str, ch); i++; @@ -39241,2185 +32993,381 @@ static int phannot_internal_parse_annotations(zval **result, const char *comment } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval* yy36; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); + + zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reader, parse) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ + HashTable *_3$$5, *_9$$10; + HashPosition _2$$5, _8$$10; + int ZEPHIR_LAST_CALL_STATUS, line = 0; + zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; + zval *className = NULL; -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &className_param); -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_get_strval(className, className_param); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + + ZEPHIR_INIT_VAR(annotations); + array_init(annotations); + ZEPHIR_INIT_VAR(reflection); + object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_VAR(classAnnotations); + ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { + zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); } - efree((yypminor->yy0)); } + ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); + zephir_check_call_status(); + if (zephir_fast_count_int(properties TSRMLS_CC)) { + line = 1; + ZEPHIR_INIT_VAR(annotationsProperties); + array_init(annotationsProperties); + zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); + for ( + ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) + ) { + ZEPHIR_GET_HVALUE(property, _4$$5); + ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(propertyAnnotations); + ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_6$$7); + ZVAL_LONG(_6$$7, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_7$$8); + zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); + zephir_check_call_status(); + if (zephir_fast_count_int(methods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(annotationsMethods); + array_init(annotationsMethods); + zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); + for ( + ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) + ) { + ZEPHIR_GET_HVALUE(method, _10$$10); + ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(comment) == IS_STRING) { + ZEPHIR_INIT_NVAR(methodAnnotations); + ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(_13$$13); + zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); + } + } + } + if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { + zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); + } + } + RETURN_CCTOR(annotations); + } - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy36)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } + +static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *docBlock_param = NULL, *file = NULL, *line = NULL; + zval *docBlock = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); + + zephir_get_strval(docBlock, docBlock_param); + if (!file) { + ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(file); + } + if (!line) { + line = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(file) != IS_STRING) { + ZEPHIR_INIT_NVAR(file); + ZVAL_STRING(file, "eval code", 1); + } + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); + } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } + + +#ifdef HAVE_CONFIG_H #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; -static void yy_accept(yyParser*); /* Forward Declaration */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy36; -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy36 = yymsp[0].minor.yy36; -} - break; - case 2: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-1].minor.yy36, yymsp[0].minor.yy36); -} - break; - case 3: - case 8: -{ - yygotominor.yy36 = phannot_ret_zval_list(NULL, yymsp[0].minor.yy36); -} - break; - case 4: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-3].minor.yy0, yymsp[-1].minor.yy36, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - yygotominor.yy36 = phannot_ret_annotation(yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - yygotominor.yy36 = phannot_ret_zval_list(yymsp[-2].minor.yy36, yymsp[0].minor.yy36); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - yygotominor.yy36 = phannot_ret_named_item(NULL, yymsp[0].minor.yy36); -} - break; - case 10: - case 12: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} + return SUCCESS; -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; - - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - if (!token_name) { - token_name = "UNKNOWN"; - } +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } - status->status = PHANNOT_PARSING_FAILED; - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } +#ifdef HAVE_CONFIG_H #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into yypParser -** phannot_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 28 -#define YYACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE yy0; - zval yy8; - int yy55; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = yypParser->status -#define phannot_ARG_STORE yypParser->status = status -#define YYNSTATE 40 -#define YYNRULE 25 -#define YYERRORSYMBOL 18 -#define YYERRSYMDT yy55 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 37, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 17, 15, 40, 19, - /* 20 */ 35, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 28, 15, 6, 12, 30, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 54, 31, 15, 25, 27, 11, 16, - /* 50 */ 13, 36, 15, 7, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 15, 9, 10, 11, 16, 66, 1, 2, - /* 70 */ 39, 15, 9, 5, 14, 16, 41, 26, 4, 9, - /* 80 */ 29, 34, 54, 8, 54, 54, 54, 54, 33, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 27, 16, 22, 23, 24, 25, 26, - /* 50 */ 7, 8, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 22, 1, 24, 25, 26, 19, 20, 21, - /* 70 */ 22, 22, 1, 3, 25, 26, 0, 15, 2, 1, - /* 80 */ 7, 8, 27, 5, 27, 27, 27, 27, 17, -}; -#define YY_SHIFT_USE_DFLT (-3) -static signed char yy_shift_ofst[] = { - /* 0 */ 11, 18, 76, -3, 70, 29, -2, 78, -3, 28, - /* 10 */ -3, -3, 43, 13, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 28, 62, -3, -3, 73, 13, - /* 30 */ -3, 28, 71, -3, 13, -3, 13, -3, -3, -3, -}; -#define YY_REDUCE_USE_DFLT (-21) -static signed char yy_reduce_ofst[] = { - /* 0 */ 48, -21, 6, -21, -21, -21, 30, -21, -21, 40, - /* 10 */ -21, -21, -21, 49, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 23, -21, -21, -21, -21, 10, - /* 30 */ -21, 35, -21, -21, -5, -21, -20, -21, -21, -21, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; } -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ +static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + zval *reflectionData = NULL; -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + zephir_fetch_params(0, 0, 1, &reflectionData); -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); - } - efree((yypminor->yy0)); + if (!reflectionData) { + reflectionData = ZEPHIR_GLOBAL(global_null); } -} - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -{ - zval_ptr_dtor(&(yypminor->yy8)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} + if (Z_TYPE_P(reflectionData) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); + } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phannot_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; + zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; + int ZEPHIR_LAST_CALL_STATUS; -static void yy_accept(yyParser*); /* Forward Declaration */ + ZEPHIR_MM_GROW(); -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy8, 1, 1); -} - break; - case 1: - case 14: - case 15: -{ - yygotominor.yy8 = yymsp[0].minor.yy8; -} - break; - case 2: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-1].minor.yy8, &yymsp[0].minor.yy8); -} - break; - case 3: - case 8: -{ - phannot_ret_zval_list(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 4: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-3].minor.yy0, &yymsp[-1].minor.yy8, status->scanner_state); - yy_destructor(2,&yymsp[-4].minor); - yy_destructor(4,&yymsp[-2].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 5: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[-2].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-3].minor); - yy_destructor(4,&yymsp[-1].minor); - yy_destructor(5,&yymsp[0].minor); -} - break; - case 6: -{ - phannot_ret_annotation(&yygotominor.yy8, yymsp[0].minor.yy0, NULL, status->scanner_state); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 7: -{ - phannot_ret_zval_list(&yygotominor.yy8, &yymsp[-2].minor.yy8, &yymsp[0].minor.yy8); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 9: -{ - phannot_ret_named_item(&yygotominor.yy8, NULL, &yymsp[0].minor.yy8); -} - break; - case 10: - case 12: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 11: - case 13: -{ - phannot_ret_named_item(&yygotominor.yy8, yymsp[-2].minor.yy0, &yymsp[0].minor.yy8); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 16: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0); -} - break; - case 17: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 18: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_STRING, yymsp[0].minor.yy0); -} - break; - case 19: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 20: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_NULL, NULL); - yy_destructor(11,&yymsp[0].minor); -} - break; - case 21: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_FALSE, NULL); - yy_destructor(12,&yymsp[0].minor); -} - break; - case 22: -{ - phannot_ret_literal_zval(&yygotominor.yy8, PHANNOT_T_TRUE, NULL); - yy_destructor(13,&yymsp[0].minor); -} - break; - case 23: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(14,&yymsp[-2].minor); - yy_destructor(15,&yymsp[0].minor); -} - break; - case 24: -{ - phannot_ret_array(&yygotominor.yy8, &yymsp[-1].minor.yy8); - yy_destructor(16,&yymsp[-2].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define TOKEN (yyminor.yy0) + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - uint active_token = status->scanner_state->active_token; - uint near_length = status->scanner_state->start_length; + ZEPHIR_MM_GROW(); - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionMethods); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); + zephir_check_call_status(); + zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); } - ++tokens; - } while (tokens[0].code != 0); - } - - if (!token_name) { - token_name = "UNKNOWN"; - } - - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } + zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + RETURN_MM_BOOL(0); } + RETURN_CCTOR(annotations); - status->status = PHANNOT_PARSING_FAILED; - - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} +static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phannot_TOKENTYPE yyminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + HashTable *_2$$5; + HashPosition _1$$5; + zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phannot_ARG_STORE; + ZEPHIR_MM_GROW(); -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif + ZEPHIR_OBS_VAR(annotations); + zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); + if (Z_TYPE_P(annotations) != IS_OBJECT) { + ZEPHIR_OBS_VAR(reflectionProperties); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { + if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { + ZEPHIR_INIT_VAR(collections); + array_init(collections); + zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); + ZEPHIR_INIT_NVAR(_4$$6); + object_init_ex(_4$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); + zephir_check_call_status(); + zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); + } + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); + RETURN_CCTOR(collections); + } + } + if (0) { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + RETURN_CCTOR(annotations); - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; } +static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { + -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(this_ptr, "_reflectionData"); +} +static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { + int ZEPHIR_LAST_CALL_STATUS; + zval *data, *reflectionData = NULL; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); - zend_class_implements(phalcon_annotations_reader_ce TSRMLS_CC, 1, phalcon_annotations_readerinterface_ce); - return SUCCESS; + if (Z_TYPE_P(data) == IS_ARRAY) { + if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); + zephir_check_call_status(); + RETURN_MM(); + } + } + object_init_ex(return_value, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Annotations_Reader, parse) { - HashTable *_3$$5, *_9$$10; - HashPosition _2$$5, _8$$10; - int ZEPHIR_LAST_CALL_STATUS, line = 0; - zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL; - zval *className = NULL; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); - - zephir_get_strval(className, className_param); - - - ZEPHIR_INIT_VAR(annotations); - array_init(annotations); - ZEPHIR_INIT_VAR(reflection); - object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 94, className); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 95); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_VAR(classAnnotations); - ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 97); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(classAnnotations, comment, _0$$3, _1$$3 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_ARRAY) { - zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&properties, reflection, "getproperties", NULL, 98); - zephir_check_call_status(); - if (zephir_fast_count_int(properties TSRMLS_CC)) { - line = 1; - ZEPHIR_INIT_VAR(annotationsProperties); - array_init(annotationsProperties); - zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96); - for ( - ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$5, &_2$$5) - ) { - ZEPHIR_GET_HVALUE(property, _4$$5); - ZEPHIR_CALL_METHOD(&comment, property, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(propertyAnnotations); - ZEPHIR_CALL_METHOD(&_5$$7, reflection, "getfilename", NULL, 96); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_6$$7); - ZVAL_LONG(_6$$7, line); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_7$$8); - zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 99); - zephir_check_call_status(); - if (zephir_fast_count_int(methods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(annotationsMethods); - array_init(annotationsMethods); - zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126); - for ( - ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$10, &_8$$10) - ) { - ZEPHIR_GET_HVALUE(method, _10$$10); - ZEPHIR_CALL_METHOD(&comment, method, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(methodAnnotations); - ZEPHIR_CALL_METHOD(&_11$$12, method, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(_13$$13); - zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) { - zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); - } - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *docBlock_param = NULL, *file = NULL, *line = NULL; - zval *docBlock = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); - - zephir_get_strval(docBlock, docBlock_param); - if (!file) { - ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(file); - } - if (!line) { - line = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(file) != IS_STRING) { - ZEPHIR_INIT_NVAR(file); - ZVAL_STRING(file, "eval code", 1); - } - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations, ReaderInterface, phalcon, annotations_readerinterface, phalcon_annotations_readerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_reflectionData"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_classAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_methodAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("_propertyAnnotations"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { - - zval *reflectionData = NULL; - - zephir_fetch_params(0, 0, 1, &reflectionData); - - if (!reflectionData) { - reflectionData = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(reflectionData) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_reflectionData"), reflectionData TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { - - zval *annotations = NULL, *reflectionClass = NULL, *collection = NULL, *_0$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - annotations = zephir_fetch_nproperty_this(this_ptr, SL("_classAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionClass, _0$$3, SS("class"), 1 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collection); - object_init_ex(collection, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, collection, "__construct", NULL, 17, reflectionClass); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC); - RETURN_CCTOR(collection); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_classAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionMethods = NULL, *collections = NULL, *methodName = NULL, *reflectionMethod = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionMethods); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionMethods, _0$$3, SS("methods"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionMethods TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionMethods, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 104); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(methodName, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionMethod, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionMethod); - zephir_check_call_status(); - zephir_array_update_zval(&collections, methodName, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_methodAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *annotations = NULL, *reflectionProperties = NULL, *collections = NULL, *property = NULL, *reflectionProperty = NULL, *_0$$3, **_3$$5, *_4$$6 = NULL; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(annotations); - zephir_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); - if (Z_TYPE_P(annotations) != IS_OBJECT) { - ZEPHIR_OBS_VAR(reflectionProperties); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (zephir_array_isset_string_fetch(&reflectionProperties, _0$$3, SS("properties"), 0 TSRMLS_CC)) { - if (zephir_fast_count_int(reflectionProperties TSRMLS_CC)) { - ZEPHIR_INIT_VAR(collections); - array_init(collections); - zephir_is_iterable(reflectionProperties, &_2$$5, &_1$$5, 0, 0, "phalcon/annotations/reflection.zep", 131); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(property, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(reflectionProperty, _3$$5); - ZEPHIR_INIT_NVAR(_4$$6); - object_init_ex(_4$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", &_5, 17, reflectionProperty); - zephir_check_call_status(); - zephir_array_update_zval(&collections, property, &_4$$6, PH_COPY | PH_SEPARATE); - } - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); - RETURN_CCTOR(collections); - } - } - if (0) { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_propertyAnnotations"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - RETURN_CCTOR(annotations); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { - - - - RETURN_MEMBER(this_ptr, "_reflectionData"); - -} - -static PHP_METHOD(Phalcon_Annotations_Reflection, __set_state) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data, *reflectionData = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - - - - if (Z_TYPE_P(data) == IS_ARRAY) { - if (zephir_array_isset_string_fetch(&reflectionData, data, SS("_reflectionData"), 1 TSRMLS_CC)) { - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, reflectionData); - zephir_check_call_status(); - RETURN_MM(); - } - } - object_init_ex(return_value, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15); - zephir_check_call_status(); - RETURN_MM(); - -} - - - -/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ -// 1 "scanner.re" +/* Generated by re2c 0.13.6 on Tue Apr 26 22:58:08 2016 */ +// 1 "scanner.re" @@ -47040,9 +38988,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, delete) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { - zend_object_iterator *_2; + zend_object_iterator *_3; + zephir_nts_static zend_class_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_1 = NULL, _3$$5 = zval_used_for_init, *_4$$5 = NULL; + zval *prefix_param = NULL, *prefixPattern = NULL, *apc = NULL, *keys = NULL, *key = NULL, *_2 = NULL, _4$$5 = zval_used_for_init, *_5$$5 = NULL; zval *prefix = NULL, *_0$$4; ZEPHIR_MM_GROW(); @@ -47067,29 +39016,34 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) { ZEPHIR_INIT_VAR(keys); array_init(keys); ZEPHIR_INIT_VAR(apc); - object_init_ex(apc, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _1, prefixPattern); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_1); - _2 = zephir_get_iterator(apc TSRMLS_CC); - _2->funcs->rewind(_2 TSRMLS_CC); - for (;_2->funcs->valid(_2 TSRMLS_CC) == SUCCESS && !EG(exception); _2->funcs->move_forward(_2 TSRMLS_CC)) { - ZEPHIR_GET_IMKEY(key, _2); + if (!_1) { + _1 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(apc, _1); + if (zephir_has_constructor(apc TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2); + ZVAL_STRING(_2, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, apc, "__construct", NULL, 0, _2, prefixPattern); + zephir_check_temp_parameter(_2); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_2); + _3 = zephir_get_iterator(apc TSRMLS_CC); + _3->funcs->rewind(_3 TSRMLS_CC); + for (;_3->funcs->valid(_3 TSRMLS_CC) == SUCCESS && !EG(exception); _3->funcs->move_forward(_3 TSRMLS_CC)) { + ZEPHIR_GET_IMKEY(key, _3); { zval **ZEPHIR_TMP_ITERATOR_PTR; - _2->funcs->get_current_data(_2, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); - ZEPHIR_CPY_WRT(_1, (*ZEPHIR_TMP_ITERATOR_PTR)); + _3->funcs->get_current_data(_3, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); + ZEPHIR_CPY_WRT(_2, (*ZEPHIR_TMP_ITERATOR_PTR)); } - ZEPHIR_SINIT_NVAR(_3$$5); - ZVAL_LONG(&_3$$5, 5); - ZEPHIR_INIT_NVAR(_4$$5); - zephir_substr(_4$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_array_append(&keys, _4$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); + ZEPHIR_SINIT_NVAR(_4$$5); + ZVAL_LONG(&_4$$5, 5); + ZEPHIR_INIT_NVAR(_5$$5); + zephir_substr(_5$$5, key, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_array_append(&keys, _5$$5, PH_SEPARATE, "phalcon/cache/backend/apc.zep", 237); } - _2->funcs->dtor(_2 TSRMLS_CC); + _3->funcs->dtor(_3 TSRMLS_CC); RETURN_CCTOR(keys); } @@ -47131,9 +39085,10 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, exists) { static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { + zephir_nts_static zend_class_entry *_3 = NULL; zend_object_iterator *_1; - zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_3, *_4$$3; - zephir_fcall_cache_entry *_5 = NULL; + zval *item = NULL, *prefixPattern = NULL, *_0, *_2, *_4, *_5$$3; + zephir_fcall_cache_entry *_6 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -47142,12 +39097,17 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { ZEPHIR_INIT_VAR(prefixPattern); ZEPHIR_CONCAT_SVS(prefixPattern, "/^_PHCA", _0, "/"); ZEPHIR_INIT_VAR(_2); - object_init_ex(_2, zephir_get_internal_ce(SS("apciterator") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_3); - ZVAL_STRING(_3, "user", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _3, prefixPattern); - zephir_check_temp_parameter(_3); - zephir_check_call_status(); + if (!_3) { + _3 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + } + object_init_ex(_2, _3); + if (zephir_has_constructor(_2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "user", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 0, _4, prefixPattern); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } _1 = zephir_get_iterator(_2 TSRMLS_CC); _1->funcs->rewind(_1 TSRMLS_CC); for (;_1->funcs->valid(_1 TSRMLS_CC) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1 TSRMLS_CC)) { @@ -47156,8 +39116,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Apc, flush) { _1->funcs->get_current_data(_1, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); ZEPHIR_CPY_WRT(item, (*ZEPHIR_TMP_ITERATOR_PTR)); } - zephir_array_fetch_string(&_4$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_5, 111, _4$$3); + zephir_array_fetch_string(&_5$$3, item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/apc.zep", 289 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(NULL, "apc_delete", &_6, 111, _5$$3); zephir_check_call_status(); } _1->funcs->dtor(_1 TSRMLS_CC); @@ -50047,10 +42007,8 @@ static PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); - if (zephir_has_constructor(redis TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); + zephir_check_call_status(); ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { @@ -75944,7 +67902,7 @@ static PHP_METHOD(Phalcon_Http_Response, setStatusCode) { } if (ZEPHIR_IS_STRING_IDENTICAL(message, "")) { ZEPHIR_INIT_VAR(statusCodes); - zephir_create_array(statusCodes, 67, 0 TSRMLS_CC); + zephir_create_array(statusCodes, 63, 0 TSRMLS_CC); add_index_stringl(statusCodes, 100, SL("Continue"), 1); add_index_stringl(statusCodes, 101, SL("Switching Protocols"), 1); add_index_stringl(statusCodes, 102, SL("Processing"), 1); @@ -78737,9 +70695,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, check) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { zend_bool _26$$14; - zephir_fcall_cache_entry *_25 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, _30$$14, _31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; + zval *file_param = NULL, *width_param = NULL, *height_param = NULL, *imageinfo = NULL, *_0, *_1, *_2$$4, *_3$$4 = NULL, *_4$$4, *_9$$4, *_24$$4, *_25$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5, *_10$$6, *_11$$6 = NULL, *_12$$7, *_13$$7 = NULL, *_14$$8, *_15$$8 = NULL, *_16$$9, *_17$$9 = NULL, *_18$$10, *_19$$10 = NULL, *_20$$11, *_21$$12, *_22$$12, *_23$$12, *_30$$14 = NULL, *_31$$14, *_32$$14 = NULL, *_33$$14, *_34$$14, *_35$$14, *_36$$14, *_27$$15, *_28$$15, *_29$$15; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -78796,35 +70753,35 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { do { if (ZEPHIR_IS_LONG(_9$$4, 1)) { _10$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 255, _10$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 0, _10$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _11$$6 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 2)) { _12$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 256, _12$$7); + ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 0, _12$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _13$$7 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 3)) { _14$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 257, _14$$8); + ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 0, _14$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _15$$8 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 15)) { _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 258, _16$$9); + ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 0, _16$$9); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _17$$9 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(_9$$4, 16)) { _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 259, _18$$10); + ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 0, _18$$10); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _19$$10 TSRMLS_CC); break; @@ -78849,7 +70806,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { } while(0); _24$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _24$$4, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_25$$4); + ZVAL_BOOL(_25$$4, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _24$$4, _25$$4); zephir_check_call_status(); } else { _26$$14 = !width; @@ -78868,18 +70827,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_SINIT_VAR(_30$$14); - ZVAL_LONG(&_30$$14, width); - ZEPHIR_SINIT_VAR(_31$$14); - ZVAL_LONG(&_31$$14, height); - ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 261, &_30$$14, &_31$$14); + ZEPHIR_INIT_VAR(_30$$14); + ZVAL_LONG(_30$$14, width); + ZEPHIR_INIT_VAR(_31$$14); + ZVAL_LONG(_31$$14, height); + ZEPHIR_CALL_FUNCTION(&_32$$14, "imagecreatetruecolor", NULL, 0, _30$$14, _31$$14); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), _32$$14 TSRMLS_CC); _33$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _33$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _33$$14, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _34$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_25, 260, _34$$14, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_30$$14); + ZVAL_BOOL(_30$$14, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, _34$$14, _30$$14); zephir_check_call_status(); _35$$14 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_realpath"), _35$$14 TSRMLS_CC); @@ -78903,8 +70864,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { zend_bool _4$$3, _8$$4; - zephir_fcall_cache_entry *_9 = NULL, *_19 = NULL, *_32 = NULL, *_34 = NULL; - zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_20$$3, *_21$$3, *_22$$3, _23$$3, _24$$3, _25$$3, _26$$3, _27$$3, _28$$3, *_29$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, _13$$4, _14$$4, _15$$4, _16$$4, *_17$$4 = NULL, *_18$$6, *_30$$7, *_31$$7 = NULL, *_33$$7 = NULL, *_35$$8, _36$$8, _37$$8, *_38$$8, *_39$$8 = NULL, *_40$$8 = NULL; + zephir_fcall_cache_entry *_9 = NULL; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *pre_width = NULL, *pre_height = NULL, *reduction_width = NULL, *reduction_height = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_5$$3, *_19$$3 = NULL, *_20$$3 = NULL, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_25$$3, *_26$$3 = NULL, _6$$4, _7$$4, *_10$$4, *_11$$4, *_12$$4, *_13$$4, *_14$$4, *_15$$4, *_16$$4, *_17$$4 = NULL, *_18$$6, *_27$$7, *_28$$7 = NULL, *_29$$7 = NULL, *_30$$8, *_31$$8, *_32$$8, *_33$$8, *_34$$8 = NULL, *_35$$8 = NULL; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -78958,74 +70919,74 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { _10$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _11$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _12$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_13$$4); - ZVAL_LONG(&_13$$4, 0); - ZEPHIR_SINIT_VAR(_14$$4); - ZVAL_LONG(&_14$$4, 0); - ZEPHIR_SINIT_VAR(_15$$4); - ZVAL_LONG(&_15$$4, 0); - ZEPHIR_SINIT_VAR(_16$$4); - ZVAL_LONG(&_16$$4, 0); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 263, image, _10$$4, &_13$$4, &_14$$4, &_15$$4, &_16$$4, pre_width, pre_height, _11$$4, _12$$4); + ZEPHIR_INIT_VAR(_13$$4); + ZVAL_LONG(_13$$4, 0); + ZEPHIR_INIT_VAR(_14$$4); + ZVAL_LONG(_14$$4, 0); + ZEPHIR_INIT_VAR(_15$$4); + ZVAL_LONG(_15$$4, 0); + ZEPHIR_INIT_VAR(_16$$4); + ZVAL_LONG(_16$$4, 0); + ZEPHIR_CALL_FUNCTION(&_17$$4, "imagecopyresized", NULL, 0, image, _10$$4, _13$$4, _14$$4, _15$$4, _16$$4, pre_width, pre_height, _11$$4, _12$$4); zephir_check_call_status(); if (zephir_is_true(_17$$4)) { _18$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _18$$6); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$6); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); } } + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, width); ZEPHIR_INIT_VAR(_20$$3); - ZVAL_LONG(_20$$3, width); - ZEPHIR_INIT_VAR(_21$$3); - ZVAL_LONG(_21$$3, height); - ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _20$$3, _21$$3); - zephir_check_call_status(); - _22$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, 0); - ZEPHIR_SINIT_VAR(_24$$3); - ZVAL_LONG(&_24$$3, 0); - ZEPHIR_SINIT_VAR(_25$$3); - ZVAL_LONG(&_25$$3, 0); - ZEPHIR_SINIT_VAR(_26$$3); - ZVAL_LONG(&_26$$3, 0); - ZEPHIR_SINIT_VAR(_27$$3); - ZVAL_LONG(&_27$$3, width); - ZEPHIR_SINIT_VAR(_28$$3); - ZVAL_LONG(&_28$$3, height); - ZEPHIR_CALL_FUNCTION(&_29$$3, "imagecopyresampled", NULL, 265, image, _22$$3, &_23$$3, &_24$$3, &_25$$3, &_26$$3, &_27$$3, &_28$$3, pre_width, pre_height); - zephir_check_call_status(); - if (zephir_is_true(_29$$3)) { - _30$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _30$$7); + ZVAL_LONG(_20$$3, height); + ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", &_9, 0, _19$$3, _20$$3); + zephir_check_call_status(); + _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_NVAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, 0); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, width); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, height); + ZEPHIR_CALL_FUNCTION(&_26$$3, "imagecopyresampled", NULL, 0, image, _21$$3, _19$$3, _20$$3, _22$$3, _23$$3, _24$$3, _25$$3, pre_width, pre_height); + zephir_check_call_status(); + if (zephir_is_true(_26$$3)) { + _27$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _27$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_31$$7, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_28$$7, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _31$$7 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33$$7, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _28$$7 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_29$$7, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33$$7 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _29$$7 TSRMLS_CC); } } else { - _35$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_36$$8); - ZVAL_LONG(&_36$$8, width); - ZEPHIR_SINIT_VAR(_37$$8); - ZVAL_LONG(&_37$$8, height); - ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 268, _35$$8, &_36$$8, &_37$$8); + _30$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_31$$8); + ZVAL_LONG(_31$$8, width); + ZEPHIR_INIT_VAR(_32$$8); + ZVAL_LONG(_32$$8, height); + ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 0, _30$$8, _31$$8, _32$$8); zephir_check_call_status(); - _38$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_19, 264, _38$$8); + _33$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _33$$8); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_39$$8, "imagesx", &_32, 266, image); + ZEPHIR_CALL_FUNCTION(&_34$$8, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _39$$8 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_40$$8, "imagesy", &_34, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _34$$8 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_35$$8, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _40$$8 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _35$$8 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79033,8 +70994,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _resize) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { - zephir_fcall_cache_entry *_16 = NULL, *_18 = NULL, *_20 = NULL; - zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, *_14$$3 = NULL, *_15$$4, *_17$$4 = NULL, *_19$$4 = NULL, *_21$$5 = NULL, *_22$$5, *_23$$5, *_24$$5 = NULL, *_25$$5 = NULL; + zval *width_param = NULL, *height_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *image = NULL, *rect = NULL, *_0, _1, *_2 = NULL, *_3$$3 = NULL, *_4$$3 = NULL, *_5$$3, *_6$$3, *_7$$3, *_8$$3, *_9$$3, *_10$$3, *_11$$3, *_12$$3 = NULL, *_13$$4, *_14$$4 = NULL, *_15$$4 = NULL, *_16$$5 = NULL, *_17$$5, *_18$$5, *_19$$5 = NULL, *_20$$5 = NULL; int width, height, offsetX, offsetY, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79060,64 +71020,64 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { ZEPHIR_CALL_METHOD(&image, this_ptr, "_create", NULL, 0, _3$$3, _4$$3); zephir_check_call_status(); _5$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_VAR(_7$$3); - ZVAL_LONG(&_7$$3, 0); - ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, offsetX); - ZEPHIR_SINIT_VAR(_9$$3); - ZVAL_LONG(&_9$$3, offsetY); - ZEPHIR_SINIT_VAR(_10$$3); - ZVAL_LONG(&_10$$3, width); - ZEPHIR_SINIT_VAR(_11$$3); - ZVAL_LONG(&_11$$3, height); - ZEPHIR_SINIT_VAR(_12$$3); - ZVAL_LONG(&_12$$3, width); - ZEPHIR_SINIT_VAR(_13$$3); - ZVAL_LONG(&_13$$3, height); - ZEPHIR_CALL_FUNCTION(&_14$$3, "imagecopyresampled", NULL, 265, image, _5$$3, &_6$$3, &_7$$3, &_8$$3, &_9$$3, &_10$$3, &_11$$3, &_12$$3, &_13$$3); + ZEPHIR_INIT_NVAR(_3$$3); + ZVAL_LONG(_3$$3, 0); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, 0); + ZEPHIR_INIT_VAR(_6$$3); + ZVAL_LONG(_6$$3, offsetX); + ZEPHIR_INIT_VAR(_7$$3); + ZVAL_LONG(_7$$3, offsetY); + ZEPHIR_INIT_VAR(_8$$3); + ZVAL_LONG(_8$$3, width); + ZEPHIR_INIT_VAR(_9$$3); + ZVAL_LONG(_9$$3, height); + ZEPHIR_INIT_VAR(_10$$3); + ZVAL_LONG(_10$$3, width); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, height); + ZEPHIR_CALL_FUNCTION(&_12$$3, "imagecopyresampled", NULL, 0, image, _5$$3, _3$$3, _4$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3); zephir_check_call_status(); - if (zephir_is_true(_14$$3)) { - _15$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _15$$4); + if (zephir_is_true(_12$$3)) { + _13$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_17$$4, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_14$$4, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _17$$4 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_19$$4, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _14$$4 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_15$$4, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _19$$4 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _15$$4 TSRMLS_CC); } } else { ZEPHIR_INIT_VAR(rect); zephir_create_array(rect, 4, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$5); - ZVAL_LONG(_21$$5, offsetX); - zephir_array_update_string(&rect, SL("x"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, offsetY); - zephir_array_update_string(&rect, SL("y"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, width); - zephir_array_update_string(&rect, SL("width"), &_21$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, height); - zephir_array_update_string(&rect, SL("height"), &_21$$5, PH_COPY | PH_SEPARATE); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 269, _22$$5, rect); - zephir_check_call_status(); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_16, 264, _23$$5); + ZEPHIR_INIT_VAR(_16$$5); + ZVAL_LONG(_16$$5, offsetX); + zephir_array_update_string(&rect, SL("x"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, offsetY); + zephir_array_update_string(&rect, SL("y"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, width); + zephir_array_update_string(&rect, SL("width"), &_16$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_16$$5); + ZVAL_LONG(_16$$5, height); + zephir_array_update_string(&rect, SL("height"), &_16$$5, PH_COPY | PH_SEPARATE); + _17$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 0, _17$$5, rect); + zephir_check_call_status(); + _18$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _18$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_24$$5, "imagesx", &_18, 266, image); + ZEPHIR_CALL_FUNCTION(&_19$$5, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _24$$5 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$5, "imagesy", &_20, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _19$$5 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_20$$5, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _25$$5 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _20$$5 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79125,7 +71085,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _crop) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { - zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1 = zval_used_for_init, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, *_5, *_6, _7, *_8 = NULL, *_9$$3; + zval *degrees_param = NULL, *image = NULL, *transparent = NULL, *width = NULL, *height = NULL, *_0, _1, _2, _3, _4, *_5, *_6 = NULL, *_7 = NULL, *_8, *_9, *_10, *_11, *_12 = NULL, *_13$$3; int degrees, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79143,37 +71103,39 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { ZVAL_LONG(&_3, 0); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, 127); - ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 270, _0, &_1, &_2, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 256, _0, &_1, &_2, &_3, &_4); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, (360 - degrees)); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 1); - ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 271, _5, &_1, transparent, &_2); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, (360 - degrees)); + ZEPHIR_INIT_VAR(_7); + ZVAL_LONG(_7, 1); + ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 0, _5, _6, transparent, _7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_6); + ZVAL_BOOL(_6, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _6); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 0, image); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 267, image); + ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 0, image); zephir_check_call_status(); - _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 100); - ZEPHIR_CALL_FUNCTION(&_8, "imagecopymerge", NULL, 272, _6, image, &_1, &_2, &_3, &_4, width, height, &_7); + _8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_INIT_NVAR(_7); + ZVAL_LONG(_7, 0); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 100); + ZEPHIR_CALL_FUNCTION(&_12, "imagecopymerge", NULL, 0, _8, image, _6, _7, _9, _10, width, height, _11); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _9$$3); + if (zephir_is_true(_12)) { + _13$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _13$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_width"), width TSRMLS_CC); @@ -79185,8 +71147,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _rotate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { - zephir_fcall_cache_entry *_14 = NULL, *_29 = NULL; - zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_24$$3, *_25$$3 = NULL, *_26$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, _9$$5 = zval_used_for_init, _10$$5 = zval_used_for_init, _11$$5 = zval_used_for_init, _12$$5 = zval_used_for_init, _13$$5 = zval_used_for_init, *_15$$6, *_16$$7, *_17$$7, *_18$$7, _19$$7 = zval_used_for_init, _20$$7 = zval_used_for_init, _21$$7 = zval_used_for_init, _22$$7 = zval_used_for_init, _23$$7 = zval_used_for_init, *_27$$9, _28$$9, *_30$$10, _31$$10; + zval *direction_param = NULL, *image = NULL, *_0, _1, *_2 = NULL, *_3$$3, *_4$$3, *_23$$3, *_24$$3 = NULL, *_25$$3 = NULL, *_5$$4, *_6$$5, *_7$$5, *_8$$5, *_9$$5 = NULL, *_10$$5 = NULL, *_11$$5 = NULL, *_12$$5 = NULL, *_13$$5 = NULL, *_14$$6, *_15$$7, *_16$$7, *_17$$7, *_18$$7 = NULL, *_19$$7 = NULL, *_20$$7 = NULL, *_21$$7 = NULL, *_22$$7 = NULL, *_26$$9, *_27$$9, *_28$$10, *_29$$10; int direction, ZEPHIR_LAST_CALL_STATUS, x = 0; ZEPHIR_MM_GROW(); @@ -79217,66 +71178,66 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_9$$5); - ZVAL_LONG(&_9$$5, x); - ZEPHIR_SINIT_NVAR(_10$$5); - ZVAL_LONG(&_10$$5, 0); - ZEPHIR_SINIT_NVAR(_11$$5); - ZVAL_LONG(&_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); - ZEPHIR_SINIT_NVAR(_12$$5); - ZVAL_LONG(&_12$$5, 0); - ZEPHIR_SINIT_NVAR(_13$$5); - ZVAL_LONG(&_13$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _6$$5, &_9$$5, &_10$$5, &_11$$5, &_12$$5, &_13$$5, _8$$5); + ZEPHIR_INIT_NVAR(_9$$5); + ZVAL_LONG(_9$$5, x); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_LONG(_10$$5, 0); + ZEPHIR_INIT_NVAR(_11$$5); + ZVAL_LONG(_11$$5, ((zephir_get_numberval(_7$$5) - x) - 1)); + ZEPHIR_INIT_NVAR(_12$$5); + ZVAL_LONG(_12$$5, 0); + ZEPHIR_INIT_NVAR(_13$$5); + ZVAL_LONG(_13$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _6$$5, _9$$5, _10$$5, _11$$5, _12$$5, _13$$5, _8$$5); zephir_check_call_status(); } } else { x = 0; while (1) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - if (!(ZEPHIR_GT_LONG(_15$$6, x))) { + _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + if (!(ZEPHIR_GT_LONG(_14$$6, x))) { break; } x++; - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _18$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, 0); - ZEPHIR_SINIT_NVAR(_20$$7); - ZVAL_LONG(&_20$$7, x); - ZEPHIR_SINIT_NVAR(_21$$7); - ZVAL_LONG(&_21$$7, 0); - ZEPHIR_SINIT_NVAR(_22$$7); - ZVAL_LONG(&_22$$7, ((zephir_get_numberval(_17$$7) - x) - 1)); - ZEPHIR_SINIT_NVAR(_23$$7); - ZVAL_LONG(&_23$$7, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_14, 273, image, _16$$7, &_19$$7, &_20$$7, &_21$$7, &_22$$7, _18$$7, &_23$$7); + _15$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_18$$7); + ZVAL_LONG(_18$$7, 0); + ZEPHIR_INIT_NVAR(_19$$7); + ZVAL_LONG(_19$$7, x); + ZEPHIR_INIT_NVAR(_20$$7); + ZVAL_LONG(_20$$7, 0); + ZEPHIR_INIT_NVAR(_21$$7); + ZVAL_LONG(_21$$7, ((zephir_get_numberval(_16$$7) - x) - 1)); + ZEPHIR_INIT_NVAR(_22$$7); + ZVAL_LONG(_22$$7, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, image, _15$$7, _18$$7, _19$$7, _20$$7, _21$$7, _17$$7, _22$$7); zephir_check_call_status(); } } - _24$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _24$$3); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _23$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), image TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesx", NULL, 266, image); + ZEPHIR_CALL_FUNCTION(&_24$$3, "imagesx", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _25$$3 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_26$$3, "imagesy", NULL, 267, image); + zephir_update_property_this(this_ptr, SL("_width"), _24$$3 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_25$$3, "imagesy", NULL, 0, image); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _26$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _25$$3 TSRMLS_CC); } else { if (direction == 11) { - _27$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_28$$9); - ZVAL_LONG(&_28$$9, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _27$$9, &_28$$9); + _26$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_27$$9); + ZEPHIR_GET_CONSTANT(_27$$9, "IMG_FLIP_HORIZONTAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _26$$9, _27$$9); zephir_check_call_status(); } else { - _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_31$$10); - ZVAL_LONG(&_31$$10, 2); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", &_29, 274, _30$$10, &_31$$10); + _28$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_29$$10); + ZEPHIR_GET_CONSTANT(_29$$10, "IMG_FLIP_VERTICAL"); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 0, _28$$10, _29$$10); zephir_check_call_status(); } } @@ -79287,7 +71248,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _flip) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zval *_3 = NULL; - zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, _6, _7, *_8 = NULL, *_9$$3, *_10$$3 = NULL, *_11$$3, *_12$$3 = NULL; + zval *amount_param = NULL, *matrix = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_4 = NULL, *_5, *_6, *_7 = NULL, *_8$$3, *_9$$3 = NULL, *_10$$3, *_11$$3 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79344,21 +71305,21 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { zephir_array_fast_append(_3, _4); zephir_array_fast_append(matrix, _3); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_6); - ZVAL_LONG(&_6, (amount - 8)); - ZEPHIR_SINIT_VAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(&_8, "imageconvolution", NULL, 275, _5, matrix, &_6, &_7); + ZEPHIR_INIT_NVAR(_4); + ZVAL_LONG(_4, (amount - 8)); + ZEPHIR_INIT_VAR(_6); + ZVAL_LONG(_6, 0); + ZEPHIR_CALL_FUNCTION(&_7, "imageconvolution", NULL, 0, _5, matrix, _4, _6); zephir_check_call_status(); - if (zephir_is_true(_8)) { - _9$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_10$$3, "imagesx", NULL, 266, _9$$3); + if (zephir_is_true(_7)) { + _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_9$$3, "imagesx", NULL, 0, _8$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _10$$3 TSRMLS_CC); - _11$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_12$$3, "imagesy", NULL, 267, _11$$3); + zephir_update_property_this(this_ptr, SL("_width"), _9$$3 TSRMLS_CC); + _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_11$$3, "imagesy", NULL, 0, _10$$3); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _12$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _11$$3 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); @@ -79366,9 +71327,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _sharpen) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { - zephir_fcall_cache_entry *_6 = NULL, *_13 = NULL, *_29 = NULL; + zephir_fcall_cache_entry *_6 = NULL; zend_bool fadeIn; - zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_3, *_4, *_5, *_7, *_8, *_9, _10, _11, _12, *_31, *_32 = NULL, *_33 = NULL, *_14$$5, *_15$$5, *_20$$5, *_21$$5 = NULL, *_22$$5, *_23$$5, _24$$5 = zval_used_for_init, _25$$5 = zval_used_for_init, _26$$5 = zval_used_for_init, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_30$$5, *_16$$6 = NULL, _17$$6 = zval_used_for_init, *_18$$7 = NULL, _19$$7 = zval_used_for_init; + zval *height_param = NULL, *opacity_param = NULL, *fadeIn_param = NULL, *reflection = NULL, *line = NULL, *_0, _1, *_2 = NULL, *_3, *_4, *_5 = NULL, *_7, *_8, *_9, *_10, *_11, *_12, *_29, *_30 = NULL, *_31 = NULL, *_13$$5, *_14$$5, *_19$$5, *_20$$5 = NULL, *_21$$5, *_22$$5, *_23$$5 = NULL, *_24$$5 = NULL, *_25$$5 = NULL, *_26$$5 = NULL, *_27$$5, *_28$$5 = NULL, *_15$$6 = NULL, _16$$6 = zval_used_for_init, *_17$$7 = NULL, _18$$7 = zval_used_for_init; int height, opacity, ZEPHIR_LAST_CALL_STATUS, stepping = 0, offset = 0, src_y = 0, dst_y = 0, dst_opacity = 0; ZEPHIR_MM_GROW(); @@ -79400,94 +71361,94 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { _7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _9 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1); - ZVAL_LONG(&_1, 0); - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, 0); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 0); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, _7, &_1, &_10, &_11, &_12, _8, _9); + ZEPHIR_INIT_NVAR(_5); + ZVAL_LONG(_5, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, _7, _5, _10, _11, _12, _8, _9); zephir_check_call_status(); offset = 0; while (1) { if (!(height >= offset)) { break; } + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + src_y = ((zephir_get_numberval(_13$$5) - offset) - 1); _14$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - src_y = ((zephir_get_numberval(_14$$5) - offset) - 1); - _15$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - dst_y = (zephir_get_numberval(_15$$5) + offset); + dst_y = (zephir_get_numberval(_14$$5) + offset); if (fadeIn) { - ZEPHIR_INIT_NVAR(_16$$6); - ZEPHIR_SINIT_NVAR(_17$$6); - ZVAL_LONG(&_17$$6, (opacity + ((stepping * ((height - offset)))))); - zephir_round(_16$$6, &_17$$6, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_16$$6); + ZEPHIR_INIT_NVAR(_15$$6); + ZEPHIR_SINIT_NVAR(_16$$6); + ZVAL_LONG(&_16$$6, (opacity + ((stepping * ((height - offset)))))); + zephir_round(_15$$6, &_16$$6, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_15$$6); } else { - ZEPHIR_INIT_NVAR(_18$$7); - ZEPHIR_SINIT_NVAR(_19$$7); - ZVAL_LONG(&_19$$7, (opacity + ((stepping * offset)))); - zephir_round(_18$$7, &_19$$7, NULL, NULL TSRMLS_CC); - dst_opacity = zephir_get_intval(_18$$7); - } - _20$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(_21$$5); - ZVAL_LONG(_21$$5, 1); - ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _20$$5, _21$$5); - zephir_check_call_status(); - _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - _23$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, src_y); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, line, _22$$5, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _23$$5, &_28$$5); - zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 4); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, 0); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, dst_opacity); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_29, 276, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, &_28$$5); - zephir_check_call_status(); - _30$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_24$$5); - ZVAL_LONG(&_24$$5, 0); - ZEPHIR_SINIT_NVAR(_25$$5); - ZVAL_LONG(&_25$$5, dst_y); - ZEPHIR_SINIT_NVAR(_26$$5); - ZVAL_LONG(&_26$$5, 0); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, 0); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", &_13, 273, reflection, line, &_24$$5, &_25$$5, &_26$$5, &_27$$5, _30$$5, &_28$$5); + ZEPHIR_INIT_NVAR(_17$$7); + ZEPHIR_SINIT_NVAR(_18$$7); + ZVAL_LONG(&_18$$7, (opacity + ((stepping * offset)))); + zephir_round(_17$$7, &_18$$7, NULL, NULL TSRMLS_CC); + dst_opacity = zephir_get_intval(_17$$7); + } + _19$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 1); + ZEPHIR_CALL_METHOD(&line, this_ptr, "_create", &_6, 0, _19$$5, _20$$5); + zephir_check_call_status(); + _21$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + _22$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_20$$5); + ZVAL_LONG(_20$$5, 0); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, src_y); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, line, _21$$5, _20$$5, _23$$5, _24$$5, _25$$5, _22$$5, _26$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_20$$5); + ZEPHIR_GET_CONSTANT(_20$$5, "IMG_FILTER_COLORIZE"); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, 0); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, dst_opacity); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, line, _20$$5, _23$$5, _24$$5, _25$$5, _26$$5); + zephir_check_call_status(); + _27$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_23$$5); + ZVAL_LONG(_23$$5, 0); + ZEPHIR_INIT_NVAR(_24$$5); + ZVAL_LONG(_24$$5, dst_y); + ZEPHIR_INIT_NVAR(_25$$5); + ZVAL_LONG(_25$$5, 0); + ZEPHIR_INIT_NVAR(_26$$5); + ZVAL_LONG(_26$$5, 0); + ZEPHIR_INIT_NVAR(_28$$5); + ZVAL_LONG(_28$$5, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 0, reflection, line, _23$$5, _24$$5, _25$$5, _26$$5, _27$$5, _28$$5); zephir_check_call_status(); offset++; } - _31 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _31); + _29 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _29); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), reflection TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_32, "imagesx", NULL, 266, reflection); + ZEPHIR_CALL_FUNCTION(&_30, "imagesx", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_width"), _32 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_33, "imagesy", NULL, 267, reflection); + zephir_update_property_this(this_ptr, SL("_width"), _30 TSRMLS_CC); + ZEPHIR_CALL_FUNCTION(&_31, "imagesy", NULL, 0, reflection); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_height"), _33 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_height"), _31 TSRMLS_CC); ZEPHIR_MM_RESTORE(); } @@ -79495,7 +71456,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _reflection) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { int offsetX, offsetY, opacity, ZEPHIR_LAST_CALL_STATUS, width = 0, height = 0; - zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_9, *_10, _11, _12, _13, _14, _15, _16, *_17 = NULL, *_3$$3, _4$$3 = zval_used_for_init, *_5$$3 = NULL, _6$$3 = zval_used_for_init, _7$$3 = zval_used_for_init, _8$$3 = zval_used_for_init; + zval *watermark, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *overlay = NULL, *color = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22 = NULL, *_4$$3, _5$$3 = zval_used_for_init, *_6$$3 = NULL, _7$$3, _8$$3, _9$$3, *_10$$3, *_11$$3, *_12$$3, *_13$$3, *_14$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &watermark, &offsetX_param, &offsetY_param, &opacity_param); @@ -79507,69 +71468,71 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { ZEPHIR_CALL_METHOD(&_0, watermark, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, overlay, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_1); + ZVAL_BOOL(_1, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, overlay, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, overlay); + ZEPHIR_CALL_FUNCTION(&_2, "imagesx", NULL, 0, overlay); zephir_check_call_status(); - width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, overlay); + width = zephir_get_intval(_2); + ZEPHIR_CALL_FUNCTION(&_3, "imagesy", NULL, 0, overlay); zephir_check_call_status(); - height = zephir_get_intval(_2); + height = zephir_get_intval(_3); if (opacity < 100) { - ZEPHIR_INIT_VAR(_3$$3); - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_DOUBLE(&_4$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_5$$3, "abs", NULL, 202, &_4$$3); + ZEPHIR_INIT_VAR(_4$$3); + ZEPHIR_SINIT_VAR(_5$$3); + ZVAL_DOUBLE(&_5$$3, ((zephir_safe_div_long_long((opacity * 127), 100 TSRMLS_CC)) - (double) (127))); + ZEPHIR_CALL_FUNCTION(&_6$$3, "abs", NULL, 202, &_5$$3); zephir_check_call_status(); - zephir_round(_3$$3, _5$$3, NULL, NULL TSRMLS_CC); - opacity = zephir_get_intval(_3$$3); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 127); - ZEPHIR_SINIT_VAR(_6$$3); - ZVAL_LONG(&_6$$3, 127); + zephir_round(_4$$3, _6$$3, NULL, NULL TSRMLS_CC); + opacity = zephir_get_intval(_4$$3); + ZEPHIR_SINIT_NVAR(_5$$3); + ZVAL_LONG(&_5$$3, 127); ZEPHIR_SINIT_VAR(_7$$3); ZVAL_LONG(&_7$$3, 127); ZEPHIR_SINIT_VAR(_8$$3); - ZVAL_LONG(&_8$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3); + ZVAL_LONG(&_8$$3, 127); + ZEPHIR_SINIT_VAR(_9$$3); + ZVAL_LONG(&_9$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, overlay, &_5$$3, &_7$$3, &_8$$3, &_9$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 278, overlay, &_4$$3); + ZEPHIR_INIT_VAR(_10$$3); + ZEPHIR_GET_CONSTANT(_10$$3, "IMG_EFFECT_OVERLAY"); + ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 0, overlay, _10$$3); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, 0); - ZEPHIR_SINIT_NVAR(_6$$3); - ZVAL_LONG(&_6$$3, 0); - ZEPHIR_SINIT_NVAR(_7$$3); - ZVAL_LONG(&_7$$3, width); - ZEPHIR_SINIT_NVAR(_8$$3); - ZVAL_LONG(&_8$$3, height); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 279, overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3, color); + ZEPHIR_INIT_VAR(_11$$3); + ZVAL_LONG(_11$$3, 0); + ZEPHIR_INIT_VAR(_12$$3); + ZVAL_LONG(_12$$3, 0); + ZEPHIR_INIT_VAR(_13$$3); + ZVAL_LONG(_13$$3, width); + ZEPHIR_INIT_VAR(_14$$3); + ZVAL_LONG(_14$$3, height); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, overlay, _11$$3, _12$$3, _13$$3, _14$$3, color); zephir_check_call_status(); } - _9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, _9, ZEPHIR_GLOBAL(global_true)); + _15 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, _15, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); - _10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, offsetX); - ZEPHIR_SINIT_VAR(_12); - ZVAL_LONG(&_12, offsetY); - ZEPHIR_SINIT_VAR(_13); - ZVAL_LONG(&_13, 0); - ZEPHIR_SINIT_VAR(_14); - ZVAL_LONG(&_14, 0); - ZEPHIR_SINIT_VAR(_15); - ZVAL_LONG(&_15, width); - ZEPHIR_SINIT_VAR(_16); - ZVAL_LONG(&_16, height); - ZEPHIR_CALL_FUNCTION(&_17, "imagecopy", NULL, 273, _10, overlay, &_11, &_12, &_13, &_14, &_15, &_16); - zephir_check_call_status(); - if (zephir_is_true(_17)) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, overlay); + _16 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_1); + ZVAL_LONG(_1, offsetX); + ZEPHIR_INIT_VAR(_17); + ZVAL_LONG(_17, offsetY); + ZEPHIR_INIT_VAR(_18); + ZVAL_LONG(_18, 0); + ZEPHIR_INIT_VAR(_19); + ZVAL_LONG(_19, 0); + ZEPHIR_INIT_VAR(_20); + ZVAL_LONG(_20, width); + ZEPHIR_INIT_VAR(_21); + ZVAL_LONG(_21, height); + ZEPHIR_CALL_FUNCTION(&_22, "imagecopy", NULL, 0, _16, overlay, _1, _17, _18, _19, _20, _21); + zephir_check_call_status(); + if (zephir_is_true(_22)) { + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, overlay); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79579,9 +71542,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _watermark) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zend_bool _10$$3, _11$$3, _12$$3; - zephir_fcall_cache_entry *_3 = NULL, *_20 = NULL; + zephir_fcall_cache_entry *_3 = NULL, *_22 = NULL; int offsetX, offsetY, opacity, r, g, b, size, ZEPHIR_LAST_CALL_STATUS, angle = 0, s0, s1, s4, s5, width = 0, height = 0; - zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, _4$$3 = zval_used_for_init, _5$$3 = zval_used_for_init, *_13$$3 = NULL, *_14$$3 = NULL, *_17$$3, _18$$3 = zval_used_for_init, _19$$3 = zval_used_for_init, *_21$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_15$$6, *_16$$7, _22$$8 = zval_used_for_init, *_23$$8 = NULL, *_24$$8 = NULL, *_27$$8, _28$$8 = zval_used_for_init, _29$$8 = zval_used_for_init, _30$$8, *_31$$8, *_25$$9, *_26$$10; + zval *text_param = NULL, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, *r_param = NULL, *g_param = NULL, *b_param = NULL, *size_param = NULL, *fontfile_param = NULL, *space = NULL, *color = NULL, *_0, _1, *_2 = NULL, *_4$$3 = NULL, *_5$$3 = NULL, _13$$3 = zval_used_for_init, *_14$$3 = NULL, *_15$$3 = NULL, *_18$$3, _19$$3, _20$$3, _21$$3, *_23$$3, *_24$$3, *_25$$3, *_6$$4, *_7$$4, *_8$$4, *_9$$4, *_16$$6, *_17$$7, *_26$$8 = NULL, *_27$$8 = NULL, *_28$$8 = NULL, *_31$$8, _32$$8, _33$$8, _34$$8, _35$$8, *_36$$8, *_37$$8, *_38$$8, *_29$$9, *_30$$10; zval *text = NULL, *fontfile = NULL; ZEPHIR_MM_GROW(); @@ -79610,11 +71573,11 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { zephir_round(_0, _2, NULL, NULL TSRMLS_CC); opacity = zephir_get_intval(_0); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { - ZEPHIR_SINIT_VAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_VAR(_5$$3); - ZVAL_LONG(&_5$$3, 0); - ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 280, &_4$$3, &_5$$3, fontfile, text); + ZEPHIR_INIT_VAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_VAR(_5$$3); + ZVAL_LONG(_5$$3, 0); + ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 0, _4$$3, _5$$3, fontfile, text); zephir_check_call_status(); if (zephir_array_isset_long(space, 0)) { ZEPHIR_OBS_VAR(_6$$4); @@ -79646,85 +71609,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "Call to imagettfbbox() failed", "phalcon/image/adapter/gd.zep", 357); return; } - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s4 - s0)); - ZEPHIR_CALL_FUNCTION(&_13$$3, "abs", &_3, 202, &_4$$3); + ZEPHIR_SINIT_VAR(_13$$3); + ZVAL_LONG(&_13$$3, (s4 - s0)); + ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - width = (zephir_get_numberval(_13$$3) + 10); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, (s5 - s1)); - ZEPHIR_CALL_FUNCTION(&_14$$3, "abs", &_3, 202, &_4$$3); + width = (zephir_get_numberval(_14$$3) + 10); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, (s5 - s1)); + ZEPHIR_CALL_FUNCTION(&_15$$3, "abs", &_3, 202, &_13$$3); zephir_check_call_status(); - height = (zephir_get_numberval(_14$$3) + 10); + height = (zephir_get_numberval(_15$$3) + 10); if (offsetX < 0) { - _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_15$$6) - width) + offsetX); + _16$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_16$$6) - width) + offsetX); } if (offsetY < 0) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_16$$7) - height) + offsetY); + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_17$$7) - height) + offsetY); } - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, r); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, g); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, b); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_SINIT_NVAR(_13$$3); + ZVAL_LONG(&_13$$3, r); ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _17$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3); + ZVAL_LONG(&_19$$3, g); + ZEPHIR_SINIT_VAR(_20$$3); + ZVAL_LONG(&_20$$3, b); + ZEPHIR_SINIT_VAR(_21$$3); + ZVAL_LONG(&_21$$3, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _18$$3, &_13$$3, &_19$$3, &_20$$3, &_21$$3); zephir_check_call_status(); angle = 0; - _21$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_4$$3); - ZVAL_LONG(&_4$$3, size); - ZEPHIR_SINIT_NVAR(_5$$3); - ZVAL_LONG(&_5$$3, angle); - ZEPHIR_SINIT_NVAR(_18$$3); - ZVAL_LONG(&_18$$3, offsetX); - ZEPHIR_SINIT_NVAR(_19$$3); - ZVAL_LONG(&_19$$3, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 281, _21$$3, &_4$$3, &_5$$3, &_18$$3, &_19$$3, color, fontfile, text); + _23$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_4$$3); + ZVAL_LONG(_4$$3, size); + ZEPHIR_INIT_NVAR(_5$$3); + ZVAL_LONG(_5$$3, angle); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, offsetX); + ZEPHIR_INIT_VAR(_25$$3); + ZVAL_LONG(_25$$3, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 0, _23$$3, _4$$3, _5$$3, _24$$3, _25$$3, color, fontfile, text); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_23$$8, "imagefontwidth", NULL, 282, &_22$$8); + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_27$$8, "imagefontwidth", NULL, 0, _26$$8); zephir_check_call_status(); - width = (zephir_get_intval(_23$$8) * zephir_fast_strlen_ev(text)); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_24$$8, "imagefontheight", NULL, 283, &_22$$8); + width = (zephir_get_intval(_27$$8) * zephir_fast_strlen_ev(text)); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_CALL_FUNCTION(&_28$$8, "imagefontheight", NULL, 0, _26$$8); zephir_check_call_status(); - height = zephir_get_intval(_24$$8); + height = zephir_get_intval(_28$$8); if (offsetX < 0) { - _25$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - offsetX = ((zephir_get_numberval(_25$$9) - width) + offsetX); + _29$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + offsetX = ((zephir_get_numberval(_29$$9) - width) + offsetX); } if (offsetY < 0) { - _26$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - offsetY = ((zephir_get_numberval(_26$$10) - height) + offsetY); - } - _27$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, r); - ZEPHIR_SINIT_VAR(_28$$8); - ZVAL_LONG(&_28$$8, g); - ZEPHIR_SINIT_VAR(_29$$8); - ZVAL_LONG(&_29$$8, b); - ZEPHIR_SINIT_VAR(_30$$8); - ZVAL_LONG(&_30$$8, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_20, 270, _27$$8, &_22$$8, &_28$$8, &_29$$8, &_30$$8); - zephir_check_call_status(); + _30$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + offsetY = ((zephir_get_numberval(_30$$10) - height) + offsetY); + } _31$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_22$$8); - ZVAL_LONG(&_22$$8, size); - ZEPHIR_SINIT_NVAR(_28$$8); - ZVAL_LONG(&_28$$8, offsetX); - ZEPHIR_SINIT_NVAR(_29$$8); - ZVAL_LONG(&_29$$8, offsetY); - ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 284, _31$$8, &_22$$8, &_28$$8, &_29$$8, text, color); + ZEPHIR_SINIT_VAR(_32$$8); + ZVAL_LONG(&_32$$8, r); + ZEPHIR_SINIT_VAR(_33$$8); + ZVAL_LONG(&_33$$8, g); + ZEPHIR_SINIT_VAR(_34$$8); + ZVAL_LONG(&_34$$8, b); + ZEPHIR_SINIT_VAR(_35$$8); + ZVAL_LONG(&_35$$8, opacity); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_22, 256, _31$$8, &_32$$8, &_33$$8, &_34$$8, &_35$$8); + zephir_check_call_status(); + _36$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(_26$$8); + ZVAL_LONG(_26$$8, size); + ZEPHIR_INIT_VAR(_37$$8); + ZVAL_LONG(_37$$8, offsetX); + ZEPHIR_INIT_VAR(_38$$8); + ZVAL_LONG(_38$$8, offsetY); + ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 0, _36$$8, _26$$8, _37$$8, _38$$8, text, color); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -79733,10 +71696,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _text) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { - zend_bool _12; - zephir_fcall_cache_entry *_3 = NULL, *_10 = NULL, *_24 = NULL, *_29 = NULL, *_30 = NULL, *_35 = NULL; + zend_bool _13; + zephir_fcall_cache_entry *_10 = NULL, *_29 = NULL, *_30 = NULL; int ZEPHIR_LAST_CALL_STATUS, mask_width = 0, mask_height = 0, x = 0, y = 0, alpha = 0; - zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4, *_5, _6 = zval_used_for_init, _7 = zval_used_for_init, _8, _9, *_11, *_13, *_25, *_36, *_14$$3, *_15$$3, *_16$$3, *_17$$3, _18$$3, _19$$3, _20$$3, _21$$3, _22$$3, _23$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_31$$6, _32$$6 = zval_used_for_init; + zval *mask, *maskImage = NULL, *newimage = NULL, *tempImage = NULL, *color = NULL, *index = NULL, *r = NULL, *g = NULL, *b = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4, *_5, _6, _7, _8, _9, *_11, *_12, *_14, *_25, *_37, *_15$$3, *_16$$3, *_17$$3, *_18$$3, *_19$$3, *_20$$3, *_21$$3, *_22$$3, *_23$$3, *_24$$3, *_26$$4, _27$$5 = zval_used_for_init, _28$$5 = zval_used_for_init, *_33$$5, *_34$$5, *_35$$5 = NULL, *_36$$5 = NULL, *_31$$6, _32$$6 = zval_used_for_init; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &mask); @@ -79745,22 +71708,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZEPHIR_CALL_METHOD(&_0, mask, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 277, _0); + ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 266, maskImage); + ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 0, maskImage); zephir_check_call_status(); mask_width = zephir_get_intval(_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 267, maskImage); + ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 0, maskImage); zephir_check_call_status(); mask_height = zephir_get_intval(_2); alpha = 127; - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, maskImage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, maskImage, _3); zephir_check_call_status(); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&newimage, this_ptr, "_create", NULL, 0, _4, _5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_3, 260, newimage, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_3); + ZVAL_BOOL(_3, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, newimage, _3); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, 0); @@ -79770,42 +71737,42 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_8, 0); ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, &_6, &_7, &_8, &_9); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, &_6, &_7, &_8, &_9); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_6); - ZVAL_LONG(&_6, 0); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 285, newimage, &_6, &_7, color); + ZEPHIR_INIT_NVAR(_3); + ZVAL_LONG(_3, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 0, newimage, _3, _11, color); zephir_check_call_status(); - _11 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_11, mask_width); - if (!(_12)) { - _13 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - _12 = !ZEPHIR_IS_LONG(_13, mask_height); + _12 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_12, mask_width); + if (!(_13)) { + _14 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + _13 = !ZEPHIR_IS_LONG(_14, mask_height); } - if (_12) { - _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 261, _14$$3, _15$$3); - zephir_check_call_status(); - _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); - _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_18$$3); - ZVAL_LONG(&_18$$3, 0); - ZEPHIR_SINIT_VAR(_19$$3); - ZVAL_LONG(&_19$$3, 0); - ZEPHIR_SINIT_VAR(_20$$3); - ZVAL_LONG(&_20$$3, 0); - ZEPHIR_SINIT_VAR(_21$$3); - ZVAL_LONG(&_21$$3, 0); - ZEPHIR_SINIT_VAR(_22$$3); - ZVAL_LONG(&_22$$3, mask_width); - ZEPHIR_SINIT_VAR(_23$$3); - ZVAL_LONG(&_23$$3, mask_height); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 265, tempImage, maskImage, &_18$$3, &_19$$3, &_20$$3, &_21$$3, _16$$3, _17$$3, &_22$$3, &_23$$3); + if (_13) { + _15$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 0, _15$$3, _16$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + _17$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); + _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_19$$3); + ZVAL_LONG(_19$$3, 0); + ZEPHIR_INIT_VAR(_20$$3); + ZVAL_LONG(_20$$3, 0); + ZEPHIR_INIT_VAR(_21$$3); + ZVAL_LONG(_21$$3, 0); + ZEPHIR_INIT_VAR(_22$$3); + ZVAL_LONG(_22$$3, 0); + ZEPHIR_INIT_VAR(_23$$3); + ZVAL_LONG(_23$$3, mask_width); + ZEPHIR_INIT_VAR(_24$$3); + ZVAL_LONG(_24$$3, mask_height); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 0, tempImage, maskImage, _19$$3, _20$$3, _21$$3, _22$$3, _17$$3, _18$$3, _23$$3, _24$$3); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); ZEPHIR_CPY_WRT(maskImage, tempImage); } @@ -79825,9 +71792,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, maskImage, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, maskImage, &_27$$5, &_28$$5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, maskImage, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, maskImage, index); zephir_check_call_status(); if (zephir_array_isset_string(color, SS("red"))) { zephir_array_fetch_string(&_31$$6, color, SL("red"), PH_NOISY | PH_READONLY, "phalcon/image/adapter/gd.zep", 430 TSRMLS_CC); @@ -79840,10 +71807,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { ZVAL_LONG(&_27$$5, x); ZEPHIR_SINIT_NVAR(_28$$5); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 286, _33$$5, &_27$$5, &_28$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_29, 257, _33$$5, &_27$$5, &_28$$5); zephir_check_call_status(); _34$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 287, _34$$5, index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_30, 258, _34$$5, index); zephir_check_call_status(); ZEPHIR_OBS_NVAR(r); zephir_array_fetch_string(&r, color, SL("red"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); @@ -79853,22 +71820,22 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { zephir_array_fetch_string(&b, color, SL("blue"), PH_NOISY, "phalcon/image/adapter/gd.zep", 435 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_27$$5); ZVAL_LONG(&_27$$5, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 270, newimage, r, g, b, &_27$$5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", &_10, 256, newimage, r, g, b, &_27$$5); zephir_check_call_status(); - ZEPHIR_SINIT_NVAR(_27$$5); - ZVAL_LONG(&_27$$5, x); - ZEPHIR_SINIT_NVAR(_28$$5); - ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", &_35, 288, newimage, &_27$$5, &_28$$5, color); + ZEPHIR_INIT_NVAR(_35$$5); + ZVAL_LONG(_35$$5, x); + ZEPHIR_INIT_NVAR(_36$$5); + ZVAL_LONG(_36$$5, y); + ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", NULL, 0, newimage, _35$$5, _36$$5, color); zephir_check_call_status(); y++; } x++; } - _36 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, _36); + _37 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _37); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", &_24, 264, maskImage); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, maskImage); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), newimage TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -79877,7 +71844,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _mask) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { - zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, _5 = zval_used_for_init, *_6, *_7, *_8, *_9 = NULL, *_10$$3; + zval *r_param = NULL, *g_param = NULL, *b_param = NULL, *opacity_param = NULL, *background = NULL, *color = NULL, *_0, *_1, _2, _3, _4, _5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13 = NULL, *_14$$3; int r, g, b, opacity, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -79902,26 +71869,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { ZVAL_LONG(&_4, b); ZEPHIR_SINIT_VAR(_5); ZVAL_LONG(&_5, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 270, background, &_2, &_3, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 256, background, &_2, &_3, &_4, &_5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, background, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, background, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); _7 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_2); - ZVAL_LONG(&_2, 0); - ZEPHIR_SINIT_NVAR(_3); - ZVAL_LONG(&_3, 0); - ZEPHIR_SINIT_NVAR(_4); - ZVAL_LONG(&_4, 0); - ZEPHIR_SINIT_NVAR(_5); - ZVAL_LONG(&_5, 0); - ZEPHIR_CALL_FUNCTION(&_9, "imagecopy", NULL, 273, background, _6, &_2, &_3, &_4, &_5, _7, _8); + ZEPHIR_INIT_VAR(_9); + ZVAL_LONG(_9, 0); + ZEPHIR_INIT_VAR(_10); + ZVAL_LONG(_10, 0); + ZEPHIR_INIT_VAR(_11); + ZVAL_LONG(_11, 0); + ZEPHIR_INIT_VAR(_12); + ZVAL_LONG(_12, 0); + ZEPHIR_CALL_FUNCTION(&_13, "imagecopy", NULL, 0, background, _6, _9, _10, _11, _12, _7, _8); zephir_check_call_status(); - if (zephir_is_true(_9)) { - _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, _10$$3); + if (zephir_is_true(_13)) { + _14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, _14$$3); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_image"), background TSRMLS_CC); } @@ -79931,8 +71898,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _background) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { - zephir_fcall_cache_entry *_2 = NULL; - zval *radius_param = NULL, *_0$$3, _1$$3 = zval_used_for_init; + zval *radius_param = NULL, *_0$$3, *_1$$3 = NULL; int radius, ZEPHIR_LAST_CALL_STATUS, i = 0; ZEPHIR_MM_GROW(); @@ -79947,9 +71913,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { break; } _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_1$$3); - ZVAL_LONG(&_1$$3, 7); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_2, 276, _0$$3, &_1$$3); + ZEPHIR_INIT_NVAR(_1$$3); + ZEPHIR_GET_CONSTANT(_1$$3, "IMG_FILTER_GAUSSIAN_BLUR"); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", NULL, 0, _0$$3, _1$$3); zephir_check_call_status(); i++; } @@ -79959,8 +71925,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _blur) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { - zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; - zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, _7$$4 = zval_used_for_init, _8$$4 = zval_used_for_init; + zephir_fcall_cache_entry *_5 = NULL; + zval *amount_param = NULL, *color = NULL, *_0, *_1$$3, *_2$$4, _3$$4 = zval_used_for_init, _4$$4 = zval_used_for_init, *_6$$4, *_7$$4 = NULL, *_8$$4 = NULL, *_9$$4 = NULL, *_10$$4 = NULL; int amount, ZEPHIR_LAST_CALL_STATUS, x = 0, y = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0; ZEPHIR_MM_GROW(); @@ -79988,20 +71954,20 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { ZVAL_LONG(&_3$$4, x1); ZEPHIR_SINIT_NVAR(_4$$4); ZVAL_LONG(&_4$$4, y1); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 286, _2$$4, &_3$$4, &_4$$4); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_5, 257, _2$$4, &_3$$4, &_4$$4); zephir_check_call_status(); x2 = (x + amount); y2 = (y + amount); _6$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_NVAR(_3$$4); - ZVAL_LONG(&_3$$4, x); - ZEPHIR_SINIT_NVAR(_4$$4); - ZVAL_LONG(&_4$$4, y); - ZEPHIR_SINIT_NVAR(_7$$4); - ZVAL_LONG(&_7$$4, x2); - ZEPHIR_SINIT_NVAR(_8$$4); - ZVAL_LONG(&_8$$4, y2); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", &_9, 279, _6$$4, &_3$$4, &_4$$4, &_7$$4, &_8$$4, color); + ZEPHIR_INIT_NVAR(_7$$4); + ZVAL_LONG(_7$$4, x); + ZEPHIR_INIT_NVAR(_8$$4); + ZVAL_LONG(_8$$4, y); + ZEPHIR_INIT_NVAR(_9$$4); + ZVAL_LONG(_9$$4, x2); + ZEPHIR_INIT_NVAR(_10$$4); + ZVAL_LONG(_10$$4, y2); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 0, _6$$4, _7$$4, _8$$4, _9$$4, _10$$4, color); zephir_check_call_status(); y += amount; } @@ -80014,9 +71980,9 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _pixelate) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zend_bool _10; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL, *_16 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_18 = NULL, *_22 = NULL, *_26 = NULL, *_30, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, _15$$6, *_17$$9, *_19$$10, *_20$$10 = NULL, *_21$$10, *_23$$11, *_24$$11 = NULL, *_25$$11, *_27$$12, *_28$$12 = NULL, *_29$$12; + zval *file_param = NULL, *quality_param = NULL, *ext = NULL, _0 = zval_used_for_init, *_2 = NULL, *_3 = NULL, *_9 = NULL, *_11 = NULL, *_17 = NULL, *_21 = NULL, *_25 = NULL, *_29, *_1$$3, *_5$$4, *_6$$4 = NULL, *_8$$4, *_12$$5, *_13$$5 = NULL, *_14$$6, *_15$$6, *_16$$9, *_18$$10, *_19$$10 = NULL, *_20$$10, *_22$$11, *_23$$11 = NULL, *_24$$11, *_26$$12, *_27$$12 = NULL, *_28$$12; zval *file = NULL; ZEPHIR_MM_GROW(); @@ -80032,7 +71998,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { zephir_check_call_status(); if (!(zephir_is_true(ext))) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 289, _1$$3, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&ext, "image_type_to_extension", NULL, 259, _1$$3, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_2); @@ -80040,30 +72006,30 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZEPHIR_CPY_WRT(ext, _2); ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_3, 0)) { ZEPHIR_INIT_ZVAL_NREF(_5$$4); ZVAL_LONG(_5$$4, 1); zephir_update_property_this(this_ptr, SL("_type"), _5$$4 TSRMLS_CC); _5$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 291, _5$$4); + ZEPHIR_CALL_FUNCTION(&_6$$4, "image_type_to_mime_type", &_7, 261, _5$$4); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _6$$4 TSRMLS_CC); _8$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _8$$4, file); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _8$$4, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_9, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_9, 0); if (!(_10)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); _10 = ZEPHIR_IS_LONG(_11, 0); } @@ -80072,7 +72038,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { ZVAL_LONG(_12$$5, 2); zephir_update_property_this(this_ptr, SL("_type"), _12$$5 TSRMLS_CC); _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 291, _12$$5); + ZEPHIR_CALL_FUNCTION(&_13$$5, "image_type_to_mime_type", &_7, 261, _12$$5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_mime"), _13$$5 TSRMLS_CC); if (quality >= 0) { @@ -80082,73 +72048,73 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _save) { quality = 100; } _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_15$$6); - ZVAL_LONG(&_15$$6, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _14$$6, file, &_15$$6); + ZEPHIR_INIT_VAR(_15$$6); + ZVAL_LONG(_15$$6, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _14$$6, file, _15$$6); zephir_check_call_status(); } else { - _17$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", &_16, 293, _17$$9, file); + _16$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _16$$9, file); zephir_check_call_status(); } RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "png", 0); - ZEPHIR_CALL_FUNCTION(&_18, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_17, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_18, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_19$$10); - ZVAL_LONG(_19$$10, 3); - zephir_update_property_this(this_ptr, SL("_type"), _19$$10 TSRMLS_CC); - _19$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_20$$10, "image_type_to_mime_type", &_7, 291, _19$$10); + if (ZEPHIR_IS_LONG(_17, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_18$$10); + ZVAL_LONG(_18$$10, 3); + zephir_update_property_this(this_ptr, SL("_type"), _18$$10 TSRMLS_CC); + _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_19$$10, "image_type_to_mime_type", &_7, 261, _18$$10); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _20$$10 TSRMLS_CC); - _21$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _21$$10, file); + zephir_update_property_this(this_ptr, SL("_mime"), _19$$10 TSRMLS_CC); + _20$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _20$$10, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_22, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_21, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_22, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_23$$11); - ZVAL_LONG(_23$$11, 15); - zephir_update_property_this(this_ptr, SL("_type"), _23$$11 TSRMLS_CC); - _23$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_24$$11, "image_type_to_mime_type", &_7, 291, _23$$11); + if (ZEPHIR_IS_LONG(_21, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_22$$11); + ZVAL_LONG(_22$$11, 15); + zephir_update_property_this(this_ptr, SL("_type"), _22$$11 TSRMLS_CC); + _22$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_23$$11, "image_type_to_mime_type", &_7, 261, _22$$11); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _24$$11 TSRMLS_CC); - _25$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _25$$11, file); + zephir_update_property_this(this_ptr, SL("_mime"), _23$$11 TSRMLS_CC); + _24$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _24$$11, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_26, "strcmp", &_4, 290, ext, &_0); + ZEPHIR_CALL_FUNCTION(&_25, "strcmp", &_4, 260, ext, &_0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_26, 0)) { - ZEPHIR_INIT_ZVAL_NREF(_27$$12); - ZVAL_LONG(_27$$12, 16); - zephir_update_property_this(this_ptr, SL("_type"), _27$$12 TSRMLS_CC); - _27$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_28$$12, "image_type_to_mime_type", &_7, 291, _27$$12); + if (ZEPHIR_IS_LONG(_25, 0)) { + ZEPHIR_INIT_ZVAL_NREF(_26$$12); + ZVAL_LONG(_26$$12, 16); + zephir_update_property_this(this_ptr, SL("_type"), _26$$12 TSRMLS_CC); + _26$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_27$$12, "image_type_to_mime_type", &_7, 261, _26$$12); zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_mime"), _28$$12 TSRMLS_CC); - _29$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _29$$12, file); + zephir_update_property_this(this_ptr, SL("_mime"), _27$$12 TSRMLS_CC); + _28$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _28$$12, file); zephir_check_call_status(); RETURN_MM_BOOL(1); } ZEPHIR_INIT_NVAR(_2); object_init_ex(_2, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_30); - ZEPHIR_CONCAT_SVS(_30, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _30); + ZEPHIR_INIT_VAR(_29); + ZEPHIR_CONCAT_SVS(_29, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _29); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/image/adapter/gd.zep", 554 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -80161,8 +72127,8 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zend_bool _7; zephir_fcall_cache_entry *_3 = NULL, *_5 = NULL; int quality, ZEPHIR_LAST_CALL_STATUS; - zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_11 = NULL, *_13 = NULL, *_15 = NULL, *_17, *_4$$3, *_9$$4, _10$$4, *_12$$5, *_14$$6, *_16$$7; - zval *ext = NULL, *_18; + zval *ext_param = NULL, *quality_param = NULL, *_0, _1 = zval_used_for_init, *_2 = NULL, *_6 = NULL, *_8 = NULL, *_12 = NULL, *_14 = NULL, *_16 = NULL, *_19, *_4$$3, *_9$$4, *_10$$4, *_11$$4, *_13$$5, *_15$$6, *_17$$7, *_18$$7; + zval *ext = NULL, *_20; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &ext_param, &quality_param); @@ -80178,81 +72144,85 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "gif", 0); - ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_2, 0)) { _4$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 292, _4$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 0, _4$$3); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpg", 0); - ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_6, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_6, 0); if (!(_7)) { ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "jpeg", 0); - ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_8, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); _7 = ZEPHIR_IS_LONG(_8, 0); } if (_7) { _9$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_10$$4); - ZVAL_LONG(&_10$$4, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 293, _9$$4, ZEPHIR_GLOBAL(global_null), &_10$$4); + ZEPHIR_INIT_VAR(_10$$4); + ZVAL_NULL(_10$$4); + ZEPHIR_INIT_VAR(_11$$4); + ZVAL_LONG(_11$$4, quality); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 0, _9$$4, _10$$4, _11$$4); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "png", 0); - ZEPHIR_CALL_FUNCTION(&_11, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_12, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_11, 0)) { - _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 294, _12$$5); + if (ZEPHIR_IS_LONG(_12, 0)) { + _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 0, _13$$5); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "wbmp", 0); - ZEPHIR_CALL_FUNCTION(&_13, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_14, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_13, 0)) { - _14$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 295, _14$$6); + if (ZEPHIR_IS_LONG(_14, 0)) { + _15$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 0, _15$$6); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "xbm", 0); - ZEPHIR_CALL_FUNCTION(&_15, "strcmp", &_3, 290, ext, &_1); + ZEPHIR_CALL_FUNCTION(&_16, "strcmp", &_3, 260, ext, &_1); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_15, 0)) { - _16$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 296, _16$$7, ZEPHIR_GLOBAL(global_null)); + if (ZEPHIR_IS_LONG(_16, 0)) { + _17$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_18$$7); + ZVAL_NULL(_18$$7); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 0, _17$$7, _18$$7); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", &_5, 262); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_INIT_VAR(_17); - object_init_ex(_17, phalcon_image_exception_ce); - ZEPHIR_INIT_VAR(_18); - ZEPHIR_CONCAT_SVS(_18, "Installed GD does not support '", ext, "' images"); - ZEPHIR_CALL_METHOD(NULL, _17, "__construct", NULL, 9, _18); + ZEPHIR_INIT_VAR(_19); + object_init_ex(_19, phalcon_image_exception_ce); + ZEPHIR_INIT_VAR(_20); + ZEPHIR_CONCAT_SVS(_20, "Installed GD does not support '", ext, "' images"); + ZEPHIR_CALL_METHOD(NULL, _19, "__construct", NULL, 9, _20); zephir_check_call_status(); - zephir_throw_exception_debug(_17, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); + zephir_throw_exception_debug(_19, "phalcon/image/adapter/gd.zep", 582 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; @@ -80260,7 +72230,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _render) { static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { - zval *width_param = NULL, *height_param = NULL, *image = NULL, _0, _1; + zval *width_param = NULL, *height_param = NULL, *image = NULL, *_0 = NULL, *_1; int width, height, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); @@ -80270,15 +72240,17 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, _create) { height = zephir_get_intval(height_param); - ZEPHIR_SINIT_VAR(_0); - ZVAL_LONG(&_0, width); - ZEPHIR_SINIT_VAR(_1); - ZVAL_LONG(&_1, height); - ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 261, &_0, &_1); + ZEPHIR_INIT_VAR(_0); + ZVAL_LONG(_0, width); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, height); + ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 0, _0, _1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 262, image, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 255, image, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 260, image, ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_NVAR(_0); + ZVAL_BOOL(_0, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, image, _0); zephir_check_call_status(); RETURN_CCTOR(image); @@ -80294,7 +72266,7 @@ static PHP_METHOD(Phalcon_Image_Adapter_Gd, __destruct) { ZEPHIR_OBS_VAR(image); zephir_read_property_this(&image, this_ptr, SL("_image"), PH_NOISY_CC); if (Z_TYPE_P(image) == IS_RESOURCE) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 264, image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, image); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -80397,8 +72369,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { zephir_update_property_this(this_ptr, SL("_file"), file TSRMLS_CC); ZEPHIR_INIT_VAR(_1); object_init_ex(_1, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(_1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); + zephir_check_call_status(); + } zephir_update_property_this(this_ptr, SL("_image"), _1 TSRMLS_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_file"), PH_NOISY_CC); if ((zephir_file_exists(_2 TSRMLS_CC) == SUCCESS)) { @@ -80467,11 +72441,13 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) { _24$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_25$$8); object_init_ex(_25$$8, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_26$$8); - ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); - zephir_check_temp_parameter(_26$$8); - zephir_check_call_status(); + if (zephir_has_constructor(_25$$8 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_26$$8); + ZVAL_STRING(_26$$8, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, _25$$8, "__construct", NULL, 0, _26$$8); + zephir_check_temp_parameter(_26$$8); + zephir_check_call_status(); + } ZEPHIR_INIT_NVAR(_26$$8); ZVAL_LONG(_26$$8, width); ZEPHIR_INIT_VAR(_27$$8); @@ -80685,8 +72661,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _rotate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } while (1) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3$$3); @@ -80875,8 +72853,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { } ZEPHIR_INIT_VAR(fade); object_init_ex(fade, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(fade TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, fade, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_17, reflection, "getimagewidth", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_18, reflection, "getimageheight", NULL, 0); @@ -80925,12 +72905,16 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _reflection) { zephir_check_call_status(); ZEPHIR_INIT_VAR(image); object_init_ex(image, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(image TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, image, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(pixel); object_init_ex(pixel, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(pixel TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel, "__construct", NULL, 0); + zephir_check_call_status(); + } _30 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_31, _30, "getimageheight", NULL, 0); zephir_check_call_status(); @@ -81057,8 +73041,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _watermark) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(watermark); object_init_ex(watermark, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(watermark TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, watermark, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(method); ZVAL_STRING(method, "setImageOpacity", 1); if (likely((zephir_method_exists_ex(watermark, SS("getversion") TSRMLS_CC) == SUCCESS))) { @@ -81140,8 +73126,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(draw); object_init_ex(draw, zephir_get_internal_ce(SS("imagickdraw") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(draw TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, draw, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rgb(%d, %d, %d)", 0); ZEPHIR_SINIT_VAR(_1); @@ -81154,8 +73142,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _text) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_4); object_init_ex(_4, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(_4 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 0, color); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(NULL, draw, "setfillcolor", NULL, 0, _4); zephir_check_call_status(); if (!(!fontfile) && Z_STRLEN_P(fontfile)) { @@ -81374,8 +73364,10 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _mask) { ZEPHIR_INIT_VAR(mask); object_init_ex(mask, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(mask TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, mask, "__construct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_CALL_METHOD(&_0, image, "render", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, mask, "readimageblob", NULL, 0, _0); @@ -81448,20 +73440,26 @@ static PHP_METHOD(Phalcon_Image_Adapter_Imagick, _background) { zephir_check_call_status(); ZEPHIR_INIT_VAR(pixel1); object_init_ex(pixel1, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); - zephir_check_call_status(); + if (zephir_has_constructor(pixel1 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, pixel1, "__construct", NULL, 0, color); + zephir_check_call_status(); + } opacity = (long) (zephir_safe_div_long_long(opacity, 100 TSRMLS_CC)); ZEPHIR_INIT_VAR(pixel2); object_init_ex(pixel2, zephir_get_internal_ce(SS("imagickpixel") TSRMLS_CC)); - ZEPHIR_INIT_VAR(_4); - ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); - zephir_check_temp_parameter(_4); - zephir_check_call_status(); + if (zephir_has_constructor(pixel2 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4); + ZVAL_STRING(_4, "transparent", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, pixel2, "__construct", NULL, 0, _4); + zephir_check_temp_parameter(_4); + zephir_check_call_status(); + } ZEPHIR_INIT_VAR(background); object_init_ex(background, zephir_get_internal_ce(SS("imagick") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(background TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, background, "__construct", NULL, 0); + zephir_check_call_status(); + } _5 = zephir_fetch_nproperty_this(this_ptr, SL("_image"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 0); @@ -83192,7 +75190,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&handler, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (Z_TYPE_P(handler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_0$$7); @@ -83224,7 +75222,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83304,7 +75302,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_File, __wakeup) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode", "phalcon/logger/adapter/file.zep", 153); return; } - ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 298, path, mode); + ZEPHIR_CALL_FUNCTION(&_1, "fopen", NULL, 263, path, mode); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_fileHandler"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -83493,7 +75491,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } - ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 298, name, mode); + ZEPHIR_CALL_FUNCTION(&stream, "fopen", NULL, 263, name, mode); zephir_check_call_status(); if (!(zephir_is_true(stream))) { ZEPHIR_INIT_VAR(_0$$6); @@ -83523,7 +75521,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Stream, getFormatter) { if (Z_TYPE_P(_0) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_logger_formatter_line_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 302); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 267); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_formatter"), _1$$3 TSRMLS_CC); } @@ -83620,7 +75618,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, __construct) { ZEPHIR_INIT_NVAR(facility); ZVAL_LONG(facility, 8); } - ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 303, name, option, facility); + ZEPHIR_CALL_FUNCTION(NULL, "openlog", NULL, 268, name, option, facility); zephir_check_call_status(); if (1) { zephir_update_property_this(this_ptr, SL("_opened"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); @@ -83684,7 +75682,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, logInternal) { } zephir_array_fetch_long(&_3, appliedFormat, 0, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); zephir_array_fetch_long(&_4, appliedFormat, 1, PH_NOISY | PH_READONLY, "phalcon/logger/adapter/syslog.zep", 104 TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 304, _3, _4); + ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 269, _3, _4); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -83701,7 +75699,7 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, close) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(1); } - ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 305); + ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 270); zephir_check_call_status(); RETURN_MM(); @@ -84109,7 +76107,7 @@ static PHP_METHOD(Phalcon_Logger_Formatter_Line, format) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_LONG(&_2$$3, timestamp); - ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 306, _1$$3, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 271, _1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2$$3); ZVAL_STRING(&_2$$3, "%date%", 0); @@ -85089,7 +77087,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, _getResultset) { } ZEPHIR_INIT_VAR(collections); array_init(collections); - ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 307, documentsCursor, ZEPHIR_GLOBAL(global_false)); + ZEPHIR_CALL_FUNCTION(&_5, "iterator_to_array", NULL, 272, documentsCursor, ZEPHIR_GLOBAL(global_false)); zephir_check_call_status(); zephir_is_iterable(_5, &_7, &_6, 0, 0, "phalcon/mvc/collection.zep", 443); for ( @@ -85563,7 +77561,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _2 TSRMLS_CC); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _5 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 308, _4, _5, exists); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "_presave", NULL, 273, _4, _5, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { RETURN_MM_BOOL(0); @@ -85597,7 +77595,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, save) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -85629,7 +77627,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85669,7 +77667,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, create) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _6, _7, _8); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _6, _7, _8); zephir_check_call_status(); RETURN_MM(); @@ -85709,22 +77707,22 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_4, 0); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, _4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, _4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 310, criteria); + ZEPHIR_CALL_FUNCTION(&keys, "array_flip", NULL, 275, criteria); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&data, this_ptr, "toarray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 311, keys, data); + ZEPHIR_CALL_FUNCTION(&_5, "array_diff_key", NULL, 276, keys, data); zephir_check_call_status(); if (zephir_is_true(_5)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Criteria parameter must be array with one or more attributes of the model", "phalcon/mvc/collection.zep", 1046); return; } - ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 312, data, keys); + ZEPHIR_CALL_FUNCTION(&query, "array_intersect_key", NULL, 277, data, keys); zephir_check_call_status(); success = 0; ZEPHIR_INIT_VAR(_6); @@ -85773,7 +77771,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, createIfNotExist) { } else { ZVAL_BOOL(_14, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _13, _8, _14); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _13, _8, _14); zephir_check_call_status(); RETURN_MM(); @@ -85804,7 +77802,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); _3 = zephir_fetch_static_property_ce(phalcon_mvc_collection_ce, SL("_disableEvents") TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 308, _0, _3, exists); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "_presave", NULL, 273, _0, _3, exists); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2)) { RETURN_MM_BOOL(0); @@ -85839,7 +77837,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection, update) { } else { ZVAL_BOOL(_8, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 309, _7, _8, exists); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_postsave", NULL, 274, _7, _8, exists); zephir_check_call_status(); RETURN_MM(); @@ -87182,7 +79180,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, mount) { if (zephir_is_true(_0$$5)) { ZEPHIR_INIT_VAR(lazyHandler); object_init_ex(lazyHandler, phalcon_mvc_micro_lazyloader_ce); - ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 313, mainHandler); + ZEPHIR_CALL_METHOD(NULL, lazyHandler, "__construct", NULL, 278, mainHandler); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(lazyHandler, mainHandler); @@ -87340,7 +79338,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, setService) { } else { ZVAL_BOOL(_0, 0); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 314, serviceName, definition, _0); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "set", NULL, 279, serviceName, definition, _0); zephir_check_call_status(); RETURN_MM(); @@ -87376,7 +79374,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, hasService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 315, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "has", NULL, 280, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87412,7 +79410,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 316, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "get", NULL, 281, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -87437,7 +79435,7 @@ static PHP_METHOD(Phalcon_Mvc_Micro, getSharedService) { zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); } - ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 317, serviceName); + ZEPHIR_RETURN_CALL_METHOD(dependencyInjector, "getshared", NULL, 282, serviceName); zephir_check_call_status(); RETURN_MM(); @@ -88547,7 +80545,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, assign) { continue; } } - ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 318, attributeField, value); + ZEPHIR_CALL_METHOD(&_10$$16, this_ptr, "_possiblesetter", &_11, 283, attributeField, value); zephir_check_call_status(); if (!(zephir_is_true(_10$$16))) { zephir_update_property_zval_zval(this_ptr, attributeField, value TSRMLS_CC); @@ -89000,12 +80998,12 @@ static PHP_METHOD(Phalcon_Mvc_Model, query) { ZEPHIR_CALL_METHOD(NULL, criteria, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 319, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, criteria, "setdi", NULL, 284, dependencyInjector); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_3); zephir_get_called_class(_3 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, _3); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, _3); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -90031,7 +82029,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, _preSave) { } } if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 321); + ZEPHIR_CALL_METHOD(&_7$$9, this_ptr, "_checkforeignkeysrestrict", NULL, 286); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_7$$9)) { RETURN_MM_BOOL(0); @@ -90595,9 +82593,9 @@ static PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) { break; } if (ZEPHIR_IS_LONG(dataType, 3) || ZEPHIR_IS_LONG(dataType, 7)) { - ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 322, snapshotValue); + ZEPHIR_CALL_FUNCTION(&_12$$25, "floatval", &_13, 287, snapshotValue); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 322, value); + ZEPHIR_CALL_FUNCTION(&_14$$25, "floatval", &_13, 287, value); zephir_check_call_status(); changed = !ZEPHIR_IS_IDENTICAL(_12$$25, _14$$25); break; @@ -91107,7 +83105,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, save) { object_init_ex(_9$$12, phalcon_mvc_model_validationfailed_ce); ZEPHIR_CALL_METHOD(&_10$$12, this_ptr, "getmessages", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 323, this_ptr, _10$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 288, this_ptr, _10$$12); zephir_check_call_status(); zephir_throw_exception_debug(_9$$12, "phalcon/mvc/model.zep", 3030 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -91277,7 +83275,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { array_init(_1); zephir_update_property_this(this_ptr, SL("_errorMessages"), _1 TSRMLS_CC); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 324); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "_checkforeignkeysreverserestrict", NULL, 289); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_2$$3)) { RETURN_MM_BOOL(0); @@ -91395,7 +83393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, delete) { ZEPHIR_CALL_METHOD(&success, writeConnection, "delete", NULL, 0, table, _19, values, bindTypes); zephir_check_call_status(); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 325); + ZEPHIR_CALL_METHOD(&_20$$20, this_ptr, "_checkforeignkeysreversecascade", NULL, 290); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_20$$20)) { RETURN_MM_BOOL(0); @@ -92307,7 +84305,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __call) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) != IS_NULL) { RETURN_CCTOR(records); @@ -92350,7 +84348,7 @@ static PHP_METHOD(Phalcon_Mvc_Model, __callStatic) { zephir_get_strval(method, method_param); - ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 326, method, arguments); + ZEPHIR_CALL_SELF(&records, "_invokefinder", &_0, 291, method, arguments); zephir_check_call_status(); if (Z_TYPE_P(records) == IS_NULL) { ZEPHIR_INIT_VAR(_1$$3); @@ -92447,13 +84445,13 @@ static PHP_METHOD(Phalcon_Mvc_Model, __set) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 318, property, value); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_possiblesetter", NULL, 283, property, value); zephir_check_call_status(); if (zephir_is_true(_10)) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 327, this_ptr, property); + ZEPHIR_CALL_FUNCTION(&_11, "property_exists", NULL, 292, this_ptr, property); zephir_check_call_status(); if (zephir_is_true(_11)) { ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", &_1, 0); @@ -94849,7 +86847,7 @@ static PHP_METHOD(Phalcon_Mvc_Url, get) { } } if (zephir_is_true(args)) { - ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 385, args); + ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 350, args); zephir_check_call_status(); _25$$19 = Z_TYPE_P(queryString) == IS_STRING; if (_25$$19) { @@ -95591,7 +87589,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _loadTemplateEngines) { if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_1$$4, PH_COPY | PH_SEPARATE); } else { @@ -95682,7 +87680,7 @@ static PHP_METHOD(Phalcon_Mvc_View, _engineRender) { ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(viewsDir, _4); - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 387, viewPath); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_isabsolutepath", &_6, 352, viewPath); zephir_check_call_status(); if (!(zephir_is_true(_5$$3))) { ZEPHIR_INIT_NVAR(viewsDirPath); @@ -96223,7 +88221,7 @@ static PHP_METHOD(Phalcon_Mvc_View, getPartial) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "partial", NULL, 0, partialPath, params); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 297); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 262); zephir_check_call_status(); RETURN_MM(); @@ -97892,7 +89890,7 @@ static PHP_METHOD(Phalcon_Mvc_Collection_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -99928,12 +91926,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) { ZEPHIR_INIT_VAR(_12$$10); ZEPHIR_CONCAT_SVS(_12$$10, " ", operator, " "); zephir_fast_join(_11$$10, _12$$10, conditions TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 328, _11$$10); + ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 293, _11$$10); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 329, bind); + ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 294, bind); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, modelName); + ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 285, modelName); zephir_check_call_status(); RETURN_CCTOR(criteria); @@ -100946,7 +92944,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOne) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 1); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101022,7 +93020,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addBelongsTo) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _1, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _1, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101099,7 +93097,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101194,9 +93192,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasManyToMany) { object_init_ex(relation, phalcon_mvc_model_relation_ce); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 4); - ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 330, _0, referencedModel, fields, referencedFields, options); + ZEPHIR_CALL_METHOD(NULL, relation, "__construct", NULL, 295, _0, referencedModel, fields, referencedFields, options); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 331, intermediateFields, intermediateModel, intermediateReferencedFields); + ZEPHIR_CALL_METHOD(NULL, relation, "setintermediaterelation", NULL, 296, intermediateFields, intermediateModel, intermediateReferencedFields); zephir_check_call_status(); ZEPHIR_OBS_VAR(alias); if (zephir_array_isset_string_fetch(&alias, options, SS("alias"), 0 TSRMLS_CC)) { @@ -101644,7 +93642,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not supported", "phalcon/mvc/model/manager.zep", 1254); return; } - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 332, extraParameters, parameters); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "_mergefindparameters", &_6, 297, extraParameters, parameters); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&builder, this_ptr, "createbuilder", NULL, 0, _5$$3); zephir_check_call_status(); @@ -101728,10 +93726,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) { ZEPHIR_CALL_METHOD(&_26, record, "getdi", NULL, 0); zephir_check_call_status(); zephir_array_update_string(&findParams, SL("di"), &_26, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 332, findParams, parameters); + ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "_mergefindparameters", &_6, 297, findParams, parameters); zephir_check_call_status(); if (Z_TYPE_P(extraParameters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 332, findArguments, extraParameters); + ZEPHIR_CALL_METHOD(&findParams, this_ptr, "_mergefindparameters", &_6, 297, findArguments, extraParameters); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(findParams, findArguments); @@ -102448,7 +94446,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Manager, __destruct) { ZEPHIR_MM_GROW(); phalcon_orm_destroy_cache(TSRMLS_C); - ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 333); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 298); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -104180,7 +96178,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCallArgument) { add_assoc_stringl_ex(return_value, SS("type"), SL("all"), 1); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 339, argument); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getexpression", NULL, 304, argument); zephir_check_call_status(); RETURN_MM(); @@ -104215,11 +96213,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_4$$4, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(_4$$4, SS("type"), SL("when"), 1); zephir_array_fetch_string(&_6$$4, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 369 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _6$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _6$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("expr"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_8$$4, whenExpr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 370 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 339, _8$$4); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_getexpression", &_7, 304, _8$$4); zephir_check_call_status(); zephir_array_update_string(&_4$$4, SL("then"), &_5$$4, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _4$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 371); @@ -104228,7 +96226,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(_9$$5, 2, 0 TSRMLS_CC); add_assoc_stringl_ex(_9$$5, SS("type"), SL("else"), 1); zephir_array_fetch_string(&_11$$5, whenExpr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 375 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 339, _11$$5); + ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "_getexpression", &_7, 304, _11$$5); zephir_check_call_status(); zephir_array_update_string(&_9$$5, SL("expr"), &_10$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&whenClauses, _9$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 376); @@ -104237,7 +96235,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getCaseExpression) { zephir_create_array(return_value, 3, 0 TSRMLS_CC); add_assoc_stringl_ex(return_value, SS("type"), SL("case"), 1); zephir_array_fetch_string(&_13, expr, SL("left"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 382 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 339, _13); + ZEPHIR_CALL_METHOD(&_12, this_ptr, "_getexpression", &_7, 304, _13); zephir_check_call_status(); zephir_array_update_string(&return_value, SL("expr"), &_12, PH_COPY | PH_SEPARATE); zephir_array_update_string(&return_value, SL("when-clauses"), &whenClauses, PH_COPY | PH_SEPARATE); @@ -104276,13 +96274,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getFunctionCall) { ; zephir_hash_move_forward_ex(_1$$6, &_0$$6) ) { ZEPHIR_GET_HVALUE(argument, _2$$6); - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 340, argument); + ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "_getcallargument", &_4, 305, argument); zephir_check_call_status(); zephir_array_append(&functionArgs, _3$$7, PH_SEPARATE, "phalcon/mvc/model/query.zep", 406); } } else { zephir_create_array(functionArgs, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 340, arguments); + ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getcallargument", &_4, 305, arguments); zephir_check_call_status(); zephir_array_fast_append(functionArgs, _5$$8); } @@ -104351,7 +96349,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_0$$5, 0); } - ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 339, exprLeft, _0$$5); + ZEPHIR_CALL_METHOD(&left, this_ptr, "_getexpression", &_1, 304, exprLeft, _0$$5); zephir_check_call_status(); } ZEPHIR_OBS_VAR(exprRight); @@ -104362,7 +96360,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { } else { ZVAL_BOOL(_2$$6, 0); } - ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 339, exprRight, _2$$6); + ZEPHIR_CALL_METHOD(&right, this_ptr, "_getexpression", &_1, 304, exprRight, _2$$6); zephir_check_call_status(); } } @@ -104440,7 +96438,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 355)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); break; } @@ -104885,12 +96883,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { break; } if (ZEPHIR_IS_LONG(exprType, 350)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 342, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getfunctioncall", NULL, 307, expr); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(exprType, 409)) { - ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 343, expr); + ZEPHIR_CALL_METHOD(&exprReturn, this_ptr, "_getcaseexpression", NULL, 308, expr); zephir_check_call_status(); break; } @@ -104900,7 +96898,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { add_assoc_stringl_ex(exprReturn, SS("type"), SL("select"), 1); ZEPHIR_INIT_VAR(_36$$68); ZVAL_BOOL(_36$$68, 1); - ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 344, expr, _36$$68); + ZEPHIR_CALL_METHOD(&_35$$68, this_ptr, "_prepareselect", NULL, 309, expr, _36$$68); zephir_check_call_status(); zephir_array_update_string(&exprReturn, SL("value"), &_35$$68, PH_COPY | PH_SEPARATE); break; @@ -104919,7 +96917,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { RETURN_CCTOR(exprReturn); } if (zephir_array_isset_string(expr, SS("domain"))) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 341, expr); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_getqualified", &_3, 306, expr); zephir_check_call_status(); RETURN_MM(); } @@ -104932,7 +96930,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression) { ; zephir_hash_move_forward_ex(_40$$71, &_39$$71) ) { ZEPHIR_GET_HVALUE(exprListItem, _41$$71); - ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 339, exprListItem); + ZEPHIR_CALL_METHOD(&_42$$72, this_ptr, "_getexpression", &_1, 304, exprListItem); zephir_check_call_status(); zephir_array_append(&listItems, _42$$72, PH_SEPARATE, "phalcon/mvc/model/query.zep", 760); } @@ -105053,7 +97051,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSelectColumn) { add_assoc_stringl_ex(sqlColumn, SS("type"), SL("scalar"), 1); ZEPHIR_OBS_VAR(columnData); zephir_array_fetch_string(&columnData, column, SL("column"), PH_NOISY, "phalcon/mvc/model/query.zep", 886 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 339, columnData); + ZEPHIR_CALL_METHOD(&sqlExprColumn, this_ptr, "_getexpression", NULL, 304, columnData); zephir_check_call_status(); ZEPHIR_OBS_VAR(balias); if (zephir_array_isset_string_fetch(&balias, sqlExprColumn, SS("balias"), 0 TSRMLS_CC)) { @@ -105250,7 +97248,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_2$$3, SS("type"), 355); zephir_array_update_string(&_2$$3, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_2$$3, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _2$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _2$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("left"), &_1$$3, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_4$$3); @@ -105258,7 +97256,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_4$$3, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_4$$3, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_4$$3, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 341, _4$$3); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "_getqualified", &_3, 306, _4$$3); zephir_check_call_status(); zephir_array_update_string(&_0$$3, SL("right"), &_1$$3, PH_COPY | PH_SEPARATE); zephir_array_fast_append(sqlJoinConditions, _0$$3); @@ -105294,7 +97292,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_long_ex(_14$$5, SS("type"), 355); zephir_array_update_string(&_14$$5, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_14$$5, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _14$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _14$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("left"), &_13$$5, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_15$$5); @@ -105302,7 +97300,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getSingleJoin) { add_assoc_stringl_ex(_15$$5, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_15$$5, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$5, SL("name"), &referencedField, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 341, _15$$5); + ZEPHIR_CALL_METHOD(&_13$$5, this_ptr, "_getqualified", &_3, 306, _15$$5); zephir_check_call_status(); zephir_array_update_string(&_12$$5, SL("right"), &_13$$5, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlJoinPartialConditions, _12$$5, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1093); @@ -105385,7 +97383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_8$$4, SS("type"), 355); zephir_array_update_string(&_8$$4, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_8$$4, SL("name"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _8$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _8$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("left"), &_7$$4, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$4); @@ -105393,7 +97391,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_10$$4, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_10$$4, SL("domain"), &joinAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$4, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 341, _10$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "_getqualified", &_9, 306, _10$$4); zephir_check_call_status(); zephir_array_update_string(&sqlEqualsJoinCondition, SL("right"), &_7$$4, PH_COPY | PH_SEPARATE); } @@ -105415,7 +97413,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_15$$6, SS("type"), 355); zephir_array_update_string(&_15$$6, SL("domain"), &modelAlias, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$6, SL("name"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _15$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _15$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_16$$6); @@ -105423,7 +97421,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_16$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_16$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_16$$6, SL("name"), &intermediateFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _16$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _16$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105444,7 +97442,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_long_ex(_17$$6, SS("type"), 355); zephir_array_update_string(&_17$$6, SL("domain"), &intermediateModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_17$$6, SL("name"), &intermediateReferencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _17$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _17$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("left"), &_14$$6, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_18$$6); @@ -105452,7 +97450,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getMultiJoin) { add_assoc_stringl_ex(_18$$6, SS("type"), SL("qualified"), 1); zephir_array_update_string(&_18$$6, SL("domain"), &referencedModelName, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_18$$6, SL("name"), &referencedFields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 341, _18$$6); + ZEPHIR_CALL_METHOD(&_14$$6, this_ptr, "_getqualified", &_9, 306, _18$$6); zephir_check_call_status(); zephir_array_update_string(&_13$$6, SL("right"), &_14$$6, PH_COPY | PH_SEPARATE); zephir_array_fast_append(_12$$6, _13$$6); @@ -105528,7 +97526,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(joinItem, _2); - ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 345, manager, joinItem); + ZEPHIR_CALL_METHOD(&joinData, this_ptr, "_getjoin", &_3, 310, manager, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, joinData, SL("source"), PH_NOISY, "phalcon/mvc/model/query.zep", 1334 TSRMLS_CC); @@ -105542,7 +97540,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { zephir_create_array(completeSource, 2, 0 TSRMLS_CC); zephir_array_fast_append(completeSource, source); zephir_array_fast_append(completeSource, schema); - ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 346, joinItem); + ZEPHIR_CALL_METHOD(&joinType, this_ptr, "_getjointype", &_4, 311, joinItem); zephir_check_call_status(); ZEPHIR_OBS_NVAR(aliasExpr); if (zephir_array_isset_string_fetch(&aliasExpr, joinItem, SS("alias"), 0 TSRMLS_CC)) { @@ -105610,7 +97608,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_GET_HVALUE(joinItem, _14); ZEPHIR_OBS_NVAR(joinExpr); if (zephir_array_isset_string_fetch(&joinExpr, joinItem, SS("conditions"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 339, joinExpr); + ZEPHIR_CALL_METHOD(&_15$$13, this_ptr, "_getexpression", &_16, 304, joinExpr); zephir_check_call_status(); zephir_array_update_zval(&joinPreCondition, joinAliasName, &_15$$13, PH_COPY | PH_SEPARATE); } @@ -105707,10 +97705,10 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins) { ZEPHIR_CALL_METHOD(&_41$$23, relation, "isthrough", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_41$$23))) { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 347, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getsinglejoin", &_42, 312, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } else { - ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 348, joinType, joinSource, modelAlias, joinAlias, relation); + ZEPHIR_CALL_METHOD(&sqlJoin, this_ptr, "_getmultijoin", &_43, 313, joinType, joinSource, modelAlias, joinAlias, relation); zephir_check_call_status(); } if (zephir_array_isset_long(sqlJoin, 0)) { @@ -105781,7 +97779,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getOrderClause) { ) { ZEPHIR_GET_HVALUE(orderItem, _2); zephir_array_fetch_string(&_3$$5, orderItem, SL("column"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/query.zep", 1650 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 339, _3$$5); + ZEPHIR_CALL_METHOD(&orderPartExpr, this_ptr, "_getexpression", &_4, 304, _3$$5); zephir_check_call_status(); if (zephir_array_isset_string_fetch(&orderSort, orderItem, SS("sort"), 1 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(orderPartSort); @@ -105833,13 +97831,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getGroupClause) { ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HVALUE(groupItem, _2$$3); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 339, groupItem); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_getexpression", &_4, 304, groupItem); zephir_check_call_status(); zephir_array_append(&groupParts, _3$$4, PH_SEPARATE, "phalcon/mvc/model/query.zep", 1684); } } else { zephir_create_array(groupParts, 1, 0 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 339, group); + ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "_getexpression", &_4, 304, group); zephir_check_call_status(); zephir_array_fast_append(groupParts, _5$$5); } @@ -105864,13 +97862,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getLimitClause) { array_init(limit); ZEPHIR_OBS_VAR(number); if (zephir_array_isset_string_fetch(&number, limitClause, SS("number"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 339, number); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "_getexpression", &_1, 304, number); zephir_check_call_status(); zephir_array_update_string(&limit, SL("number"), &_0$$3, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(offset); if (zephir_array_isset_string_fetch(&offset, limitClause, SS("offset"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 339, offset); + ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "_getexpression", &_1, 304, offset); zephir_check_call_status(); zephir_array_update_string(&limit, SL("offset"), &_2$$4, PH_COPY | PH_SEPARATE); } @@ -106193,12 +98191,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { if (zephir_fast_count_int(automaticJoins TSRMLS_CC)) { zephir_array_update_string(&select, SL("joins"), &automaticJoins, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 349, select); + ZEPHIR_CALL_METHOD(&sqlJoins, this_ptr, "_getjoins", &_41, 314, select); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(sqlJoins); @@ -106214,7 +98212,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { ; zephir_hash_move_forward_ex(_43, &_42) ) { ZEPHIR_GET_HVALUE(column, _44); - ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 350, column); + ZEPHIR_CALL_METHOD(&_45$$41, this_ptr, "_getselectcolumn", &_46, 315, column); zephir_check_call_status(); zephir_is_iterable(_45$$41, &_48$$41, &_47$$41, 0, 0, "phalcon/mvc/model/query.zep", 2024); for ( @@ -106263,31 +98261,31 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareSelect) { } ZEPHIR_OBS_VAR(where); if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 339, where); + ZEPHIR_CALL_METHOD(&_53$$51, this_ptr, "_getexpression", &_54, 304, where); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("where"), &_53$$51, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(groupBy); if (zephir_array_isset_string_fetch(&groupBy, ast, SS("groupBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 351, groupBy); + ZEPHIR_CALL_METHOD(&_55$$52, this_ptr, "_getgroupclause", NULL, 316, groupBy); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("group"), &_55$$52, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(having); if (zephir_array_isset_string_fetch(&having, ast, SS("having"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 339, having); + ZEPHIR_CALL_METHOD(&_56$$53, this_ptr, "_getexpression", &_54, 304, having); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("having"), &_56$$53, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(order); if (zephir_array_isset_string_fetch(&order, ast, SS("orderBy"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 352, order); + ZEPHIR_CALL_METHOD(&_57$$54, this_ptr, "_getorderclause", NULL, 317, order); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("order"), &_57$$54, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_58$$55, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlSelect, SL("limit"), &_58$$55, PH_COPY | PH_SEPARATE); } @@ -106385,7 +98383,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareInsert) { } else { ZVAL_BOOL(_11$$9, 0); } - ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 339, exprValue, _11$$9); + ZEPHIR_CALL_METHOD(&_10$$9, this_ptr, "_getexpression", &_12, 304, exprValue, _11$$9); zephir_check_call_status(); zephir_array_update_string(&_8$$9, SL("value"), &_10$$9, PH_COPY | PH_SEPARATE); zephir_array_append(&exprValues, _8$$9, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2139); @@ -106566,7 +98564,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_14$$17, 0); } - ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 339, _13$$17, _14$$17); + ZEPHIR_CALL_METHOD(&_12$$17, this_ptr, "_getexpression", &_15, 304, _13$$17, _14$$17); zephir_check_call_status(); zephir_array_append(&sqlFields, _12$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2289); ZEPHIR_OBS_NVAR(exprColumn); @@ -106582,7 +98580,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { } else { ZVAL_BOOL(_19$$17, 0); } - ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 339, exprColumn, _19$$17); + ZEPHIR_CALL_METHOD(&_18$$17, this_ptr, "_getexpression", &_15, 304, exprColumn, _19$$17); zephir_check_call_status(); zephir_array_update_string(&_16$$17, SL("value"), &_18$$17, PH_COPY | PH_SEPARATE); zephir_array_append(&sqlValues, _16$$17, PH_SEPARATE, "phalcon/mvc/model/query.zep", 2294); @@ -106597,13 +98595,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareUpdate) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_21$$18); ZVAL_BOOL(_21$$18, 1); - ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 339, where, _21$$18); + ZEPHIR_CALL_METHOD(&_20$$18, this_ptr, "_getexpression", &_15, 304, where, _21$$18); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("where"), &_20$$18, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_22$$19, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlUpdate, SL("limit"), &_22$$19, PH_COPY | PH_SEPARATE); } @@ -106722,13 +98720,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _prepareDelete) { if (zephir_array_isset_string_fetch(&where, ast, SS("where"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_10$$14); ZVAL_BOOL(_10$$14, 1); - ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 339, where, _10$$14); + ZEPHIR_CALL_METHOD(&_9$$14, this_ptr, "_getexpression", NULL, 304, where, _10$$14); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("where"), &_9$$14, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(limit); if (zephir_array_isset_string_fetch(&limit, ast, SS("limit"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 353, limit); + ZEPHIR_CALL_METHOD(&_11$$15, this_ptr, "_getlimitclause", NULL, 318, limit); zephir_check_call_status(); zephir_array_update_string(&sqlDelete, SL("limit"), &_11$$15, PH_COPY | PH_SEPARATE); } @@ -106776,22 +98774,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, parse) { zephir_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 344); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareselect", NULL, 309); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 354); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareinsert", NULL, 319); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 355); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_prepareupdate", NULL, 320); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 356); + ZEPHIR_CALL_METHOD(&irPhql, this_ptr, "_preparedelete", NULL, 321); zephir_check_call_status(); break; } @@ -107191,12 +99189,12 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeSelect) { } else { ZVAL_BOOL(_55$$53, 0); } - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 357, simpleColumnMap, resultObject, resultData, cache, _55$$53); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 322, simpleColumnMap, resultObject, resultData, cache, _55$$53); zephir_check_call_status(); RETURN_MM(); } object_init_ex(return_value, phalcon_mvc_model_resultset_complex_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 358, columns1, resultData, cache); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 323, columns1, resultData, cache); zephir_check_call_status(); RETURN_MM(); @@ -107356,7 +99354,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeInsert) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_CALL_METHOD(&_20, insertModel, "create", NULL, 0, insertValues); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 359, _20, insertModel); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 324, _20, insertModel); zephir_check_call_status(); RETURN_MM(); @@ -107486,13 +99484,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { zephir_array_update_zval(&updateValues, fieldName, &updateValue, PH_COPY | PH_SEPARATE); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, selectBindParams, selectBindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, selectBindParams, selectBindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_17$$19); ZVAL_BOOL(_17$$19, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _17$$19); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _17$$19); zephir_check_call_status(); RETURN_MM(); } @@ -107527,7 +99525,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_23$$24); ZVAL_BOOL(_23$$24, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _23$$24, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _23$$24, record); zephir_check_call_status(); RETURN_MM(); } @@ -107539,7 +99537,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeUpdate) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_25); ZVAL_BOOL(_25, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 359, _25); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_18, 324, _25); zephir_check_call_status(); RETURN_MM(); @@ -107571,13 +99569,13 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { ZEPHIR_CALL_METHOD(&model, _1$$4, "load", NULL, 0, modelName); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 360, model, intermediate, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&records, this_ptr, "_getrelatedrecords", NULL, 325, model, intermediate, bindParams, bindTypes); zephir_check_call_status(); if (!(zephir_fast_count_int(records TSRMLS_CC))) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_2$$5); ZVAL_BOOL(_2$$5, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _2$$5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _2$$5); zephir_check_call_status(); RETURN_MM(); } @@ -107612,7 +99610,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_NVAR(_8$$10); ZVAL_BOOL(_8$$10, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _8$$10, record); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _8$$10, record); zephir_check_call_status(); RETURN_MM(); } @@ -107624,7 +99622,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _executeDelete) { object_init_ex(return_value, phalcon_mvc_model_query_status_ce); ZEPHIR_INIT_VAR(_10); ZVAL_BOOL(_10, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 359, _10); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, 324, _10); zephir_check_call_status(); RETURN_MM(); @@ -107672,18 +99670,18 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, _getRelatedRecords) { } ZEPHIR_INIT_VAR(query); object_init_ex(query, phalcon_mvc_model_query_ce); - ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 361); + ZEPHIR_CALL_METHOD(NULL, query, "__construct", NULL, 326); zephir_check_call_status(); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 362, _5); + ZEPHIR_CALL_METHOD(NULL, query, "setdi", NULL, 327, _5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 309); - ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 363, _2); + ZEPHIR_CALL_METHOD(NULL, query, "settype", NULL, 328, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 364, selectIr); + ZEPHIR_CALL_METHOD(NULL, query, "setintermediate", NULL, 329, selectIr); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_RETURN_CALL_METHOD(query, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); RETURN_MM(); @@ -107804,22 +99802,22 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, execute) { zephir_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 366, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeselect", NULL, 331, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 367, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeinsert", NULL, 332, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 368, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executeupdate", NULL, 333, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(type, 303)) { - ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 369, intermediate, mergedParams, mergedTypes); + ZEPHIR_CALL_METHOD(&result, this_ptr, "_executedelete", NULL, 334, intermediate, mergedParams, mergedTypes); zephir_check_call_status(); break; } @@ -107874,7 +99872,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSingleResult) { zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 365, bindParams, bindTypes); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "execute", NULL, 330, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(_1, "getfirst", NULL, 0); zephir_check_call_status(); @@ -108071,7 +100069,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query, getSql) { _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_bindTypes"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3$$3); ZVAL_BOOL(_3$$3, 1); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 366, intermediate, _1$$3, _2$$3, _3$$3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_executeselect", NULL, 331, intermediate, _1$$3, _2$$3, _3$$3); zephir_check_call_status(); RETURN_MM(); } @@ -109503,7 +101501,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, rollback) { ZEPHIR_INIT_VAR(_1$$4); object_init_ex(_1$$4, phalcon_mvc_model_transaction_failed_ce); _2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackRecord"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 376, rollbackMessage, _2$$4); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 341, rollbackMessage, _2$$4); zephir_check_call_status(); zephir_throw_exception_debug(_1$$4, "phalcon/mvc/model/transaction.zep", 163 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -109522,7 +101520,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Transaction, getConnection) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackOnAbort"), PH_NOISY_CC); if (zephir_is_true(_0)) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 377); + ZEPHIR_CALL_FUNCTION(&_1$$3, "connection_aborted", NULL, 342); zephir_check_call_status(); if (zephir_is_true(_1$$3)) { ZEPHIR_INIT_VAR(_2$$4); @@ -110080,7 +102078,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, notify) { ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 306, format); + ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 271, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); @@ -110458,9 +102456,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 335, _2, options); + ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 300, _2, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110554,7 +102552,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_libmemcached_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110658,9 +102656,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 337, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 302, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -110754,7 +102752,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Memcache, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_memcache_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -110962,9 +102960,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, __construct) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_6, SL("lifetime"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 334, _6); + ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 299, _6); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 338, _5, options); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 303, _5, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -111058,7 +103056,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, reset) { zephir_check_call_status(); } } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 336); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_metadata_redis_ce, this_ptr, "reset", &_5, 301); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -111904,703 +103902,6 @@ static PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getColumnMa - -const phql_token_names phql_tokens[] = -{ - { SL("INTEGER"), PHQL_T_INTEGER }, - { SL("DOUBLE"), PHQL_T_DOUBLE }, - { SL("STRING"), PHQL_T_STRING }, - { SL("IDENTIFIER"), PHQL_T_IDENTIFIER }, - { SL("HEXAINTEGER"), PHQL_T_HINTEGER }, - { SL("MINUS"), PHQL_T_MINUS }, - { SL("+"), PHQL_T_ADD }, - { SL("-"), PHQL_T_SUB }, - { SL("*"), PHQL_T_MUL }, - { SL("/"), PHQL_T_DIV }, - { SL("&"), PHQL_T_BITWISE_AND }, - { SL("|"), PHQL_T_BITWISE_OR }, - { SL("%%"), PHQL_T_MOD }, - { SL("AND"), PHQL_T_AND }, - { SL("OR"), PHQL_T_OR }, - { SL("LIKE"), PHQL_T_LIKE }, - { SL("ILIKE"), PHQL_T_ILIKE }, - { SL("DOT"), PHQL_T_DOT }, - { SL("COLON"), PHQL_T_COLON }, - { SL("COMMA"), PHQL_T_COMMA }, - { SL("EQUALS"), PHQL_T_EQUALS }, - { SL("NOT EQUALS"), PHQL_T_NOTEQUALS }, - { SL("NOT"), PHQL_T_NOT }, - { SL("<"), PHQL_T_LESS }, - { SL("<="), PHQL_T_LESSEQUAL }, - { SL(">"), PHQL_T_GREATER }, - { SL(">="), PHQL_T_GREATEREQUAL }, - { SL("("), PHQL_T_PARENTHESES_OPEN }, - { SL(")"), PHQL_T_PARENTHESES_CLOSE }, - { SL("NUMERIC PLACEHOLDER"), PHQL_T_NPLACEHOLDER }, - { SL("STRING PLACEHOLDER"), PHQL_T_SPLACEHOLDER }, - { SL("UPDATE"), PHQL_T_UPDATE }, - { SL("SET"), PHQL_T_SET }, - { SL("WHERE"), PHQL_T_WHERE }, - { SL("DELETE"), PHQL_T_DELETE }, - { SL("FROM"), PHQL_T_FROM }, - { SL("AS"), PHQL_T_AS }, - { SL("INSERT"), PHQL_T_INSERT }, - { SL("INTO"), PHQL_T_INTO }, - { SL("VALUES"), PHQL_T_VALUES }, - { SL("SELECT"), PHQL_T_SELECT }, - { SL("ORDER"), PHQL_T_ORDER }, - { SL("BY"), PHQL_T_BY }, - { SL("LIMIT"), PHQL_T_LIMIT }, - { SL("OFFSET"), PHQL_T_OFFSET }, - { SL("GROUP"), PHQL_T_GROUP }, - { SL("HAVING"), PHQL_T_HAVING }, - { SL("IN"), PHQL_T_IN }, - { SL("ON"), PHQL_T_ON }, - { SL("INNER"), PHQL_T_INNER }, - { SL("JOIN"), PHQL_T_JOIN }, - { SL("LEFT"), PHQL_T_LEFT }, - { SL("RIGHT"), PHQL_T_RIGHT }, - { SL("IS"), PHQL_T_IS }, - { SL("NULL"), PHQL_T_NULL }, - { SL("NOT IN"), PHQL_T_NOTIN }, - { SL("CROSS"), PHQL_T_CROSS }, - { SL("OUTER"), PHQL_T_OUTER }, - { SL("FULL"), PHQL_T_FULL }, - { SL("ASC"), PHQL_T_ASC }, - { SL("DESC"), PHQL_T_DESC }, - { SL("BETWEEN"), PHQL_T_BETWEEN }, - { SL("DISTINCT"), PHQL_T_DISTINCT }, - { SL("AGAINST"), PHQL_T_AGAINST }, - { SL("CAST"), PHQL_T_CAST }, - { SL("CONVERT"), PHQL_T_CONVERT }, - { SL("USING"), PHQL_T_USING }, - { SL("ALL"), PHQL_T_ALL }, - { SL("EXISTS"), PHQL_T_EXISTS }, - { SL("CASE"), PHQL_T_CASE }, - { SL("WHEN"), PHQL_T_WHEN }, - { SL("THEN"), PHQL_T_THEN }, - { SL("ELSE"), PHQL_T_ELSE }, - { SL("END"), PHQL_T_END }, - { SL("FOR"), PHQL_T_FOR }, - { SL("WITH"), PHQL_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phql_wrapper_alloc(size_t bytes) -{ - return emalloc(bytes); -} - -static void phql_wrapper_free(void *pointer) -{ - efree(pointer); -} - -static void phql_parse_with_token(void* phql_parser, int opcode, int parsercode, phql_scanner_token *token, phql_parser_status *parser_status) -{ - - phql_parser_token *pToken; - - pToken = emalloc(sizeof(phql_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - phql_(phql_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phql_scanner_error_msg(phql_parser_status *parser_status, zval **error_msg TSRMLS_DC) -{ - - char *error = NULL, *error_part; - unsigned int length; - phql_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_UNDEF(*error_msg); -#endif - - if (state->start) { - length = 64 + state->start_length + parser_status->phql_length; - error = emalloc(sizeof(char) * length); - if (state->start_length > 16) { - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' when parsing: %s (%d)", error_part, parser_status->phql, parser_status->phql_length); - efree(error_part); - } else { - snprintf(error, length, "Scanning error before '%s' when parsing: %s (%d)", state->start, parser_status->phql, parser_status->phql_length); - } - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - } else { -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, "Scanning error near to EOF", 1); -#else - ZVAL_STRING(*error_msg, "Scanning error near to EOF"); -#endif - } - - if (error) { - efree(error); - } -} - -static int phql_parse_phql(zval *result, zval *phql TSRMLS_DC) -{ -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval err_msg, *error_msg = &err_msg; - ZVAL_UNDEF(error_msg); -#endif - - ZVAL_NULL(result); - - if (phql_internal_parse_phql(&result, Z_STRVAL_P(phql), Z_STRLEN_P(phql), &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, Z_STRVAL_P(error_msg)); - return FAILURE; - } - - return SUCCESS; -} - -static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length, zval **error_msg TSRMLS_DC) -{ - zend_phalcon_globals *phalcon_globals_ptr = ZEPHIR_VGLOBAL; - phql_parser_status *parser_status = NULL; - int scanner_status, status = SUCCESS, error_length, cache_level; - phql_scanner_state *state; - phql_scanner_token token; - void* phql_parser; - char *error; - unsigned long phql_key = 0; -#if PHP_VERSION_ID < 70000 - zval **temp_ast; -#else - zval *temp_ast; -#endif - - if (!phql) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL", 1); -#else - ZVAL_STRING(*error_msg, "PHQL statement cannot be NULL"); -#endif - return FAILURE; - } - - cache_level = phalcon_globals_ptr->orm.cache_level; - if (cache_level >= 0) { - phql_key = zend_inline_hash_func(phql, phql_length + 1); - if (phalcon_globals_ptr->orm.parser_cache != NULL) { -#if PHP_VERSION_ID < 70000 - if (zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key, (void**) &temp_ast) == SUCCESS) { - ZVAL_ZVAL(*result, *temp_ast, 1, 0); - Z_SET_REFCOUNT_P(*result, 1); - return SUCCESS; - } -#else - if ((temp_ast = zend_hash_index_find(phalcon_globals_ptr->orm.parser_cache, phql_key)) != NULL) { - ZVAL_ZVAL(*result, temp_ast, 1, 0); - Z_TRY_ADDREF_P(*result); - return SUCCESS; - } -#endif - } - } - - phql_parser = phql_Alloc(phql_wrapper_alloc); - - parser_status = emalloc(sizeof(phql_parser_status)); - state = emalloc(sizeof(phql_scanner_state)); - - parser_status->status = PHQL_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->syntax_error = NULL; - parser_status->token = &token; - parser_status->enable_literals = phalcon_globals_ptr->orm.enable_literals; - parser_status->phql = phql; - parser_status->phql_length = phql_length; - - state->active_token = 0; - state->start = phql; - state->start_length = 0; - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phql_get_token(state, &token))) { - - /* Calculate the 'start' length */ - state->start_length = (phql + phql_length - state->start); - - state->active_token = token.opcode; - - /* Parse the token found */ - switch (token.opcode) { - - case PHQL_T_IGNORE: - break; - - case PHQL_T_ADD: - phql_(phql_parser, PHQL_PLUS, NULL, parser_status); - break; - case PHQL_T_SUB: - phql_(phql_parser, PHQL_MINUS, NULL, parser_status); - break; - case PHQL_T_MUL: - phql_(phql_parser, PHQL_TIMES, NULL, parser_status); - break; - case PHQL_T_DIV: - phql_(phql_parser, PHQL_DIVIDE, NULL, parser_status); - break; - case PHQL_T_MOD: - phql_(phql_parser, PHQL_MOD, NULL, parser_status); - break; - case PHQL_T_AND: - phql_(phql_parser, PHQL_AND, NULL, parser_status); - break; - case PHQL_T_OR: - phql_(phql_parser, PHQL_OR, NULL, parser_status); - break; - case PHQL_T_EQUALS: - phql_(phql_parser, PHQL_EQUALS, NULL, parser_status); - break; - case PHQL_T_NOTEQUALS: - phql_(phql_parser, PHQL_NOTEQUALS, NULL, parser_status); - break; - case PHQL_T_LESS: - phql_(phql_parser, PHQL_LESS, NULL, parser_status); - break; - case PHQL_T_GREATER: - phql_(phql_parser, PHQL_GREATER, NULL, parser_status); - break; - case PHQL_T_GREATEREQUAL: - phql_(phql_parser, PHQL_GREATEREQUAL, NULL, parser_status); - break; - case PHQL_T_LESSEQUAL: - phql_(phql_parser, PHQL_LESSEQUAL, NULL, parser_status); - break; - - case PHQL_T_IDENTIFIER: - phql_parse_with_token(phql_parser, PHQL_T_IDENTIFIER, PHQL_IDENTIFIER, &token, parser_status); - break; - - case PHQL_T_DOT: - phql_(phql_parser, PHQL_DOT, NULL, parser_status); - break; - case PHQL_T_COMMA: - phql_(phql_parser, PHQL_COMMA, NULL, parser_status); - break; - - case PHQL_T_PARENTHESES_OPEN: - phql_(phql_parser, PHQL_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHQL_T_PARENTHESES_CLOSE: - phql_(phql_parser, PHQL_PARENTHESES_CLOSE, NULL, parser_status); - break; - - case PHQL_T_LIKE: - phql_(phql_parser, PHQL_LIKE, NULL, parser_status); - break; - case PHQL_T_ILIKE: - phql_(phql_parser, PHQL_ILIKE, NULL, parser_status); - break; - case PHQL_T_NOT: - phql_(phql_parser, PHQL_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_AND: - phql_(phql_parser, PHQL_BITWISE_AND, NULL, parser_status); - break; - case PHQL_T_BITWISE_OR: - phql_(phql_parser, PHQL_BITWISE_OR, NULL, parser_status); - break; - case PHQL_T_BITWISE_NOT: - phql_(phql_parser, PHQL_BITWISE_NOT, NULL, parser_status); - break; - case PHQL_T_BITWISE_XOR: - phql_(phql_parser, PHQL_BITWISE_XOR, NULL, parser_status); - break; - case PHQL_T_AGAINST: - phql_(phql_parser, PHQL_AGAINST, NULL, parser_status); - break; - case PHQL_T_CASE: - phql_(phql_parser, PHQL_CASE, NULL, parser_status); - break; - case PHQL_T_WHEN: - phql_(phql_parser, PHQL_WHEN, NULL, parser_status); - break; - case PHQL_T_THEN: - phql_(phql_parser, PHQL_THEN, NULL, parser_status); - break; - case PHQL_T_END: - phql_(phql_parser, PHQL_END, NULL, parser_status); - break; - case PHQL_T_ELSE: - phql_(phql_parser, PHQL_ELSE, NULL, parser_status); - break; - case PHQL_T_FOR: - phql_(phql_parser, PHQL_FOR, NULL, parser_status); - break; - case PHQL_T_WITH: - phql_(phql_parser, PHQL_WITH, NULL, parser_status); - break; - - case PHQL_T_INTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_INTEGER, PHQL_INTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_DOUBLE: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_DOUBLE, PHQL_DOUBLE, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_STRING: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_STRING, PHQL_STRING, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_TRUE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_TRUE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_FALSE: - if (parser_status->enable_literals) { - phql_(phql_parser, PHQL_FALSE, NULL, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - case PHQL_T_HINTEGER: - if (parser_status->enable_literals) { - phql_parse_with_token(phql_parser, PHQL_T_HINTEGER, PHQL_HINTEGER, &token, parser_status); - } else { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements", 1); -#else - ZVAL_STRING(*error_msg, "Literals are disabled in PHQL statements"); -#endif - parser_status->status = PHQL_PARSING_FAILED; - } - break; - - case PHQL_T_NPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_NPLACEHOLDER, PHQL_NPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_SPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_SPLACEHOLDER, PHQL_SPLACEHOLDER, &token, parser_status); - break; - case PHQL_T_BPLACEHOLDER: - phql_parse_with_token(phql_parser, PHQL_T_BPLACEHOLDER, PHQL_BPLACEHOLDER, &token, parser_status); - break; - - case PHQL_T_FROM: - phql_(phql_parser, PHQL_FROM, NULL, parser_status); - break; - case PHQL_T_UPDATE: - phql_(phql_parser, PHQL_UPDATE, NULL, parser_status); - break; - case PHQL_T_SET: - phql_(phql_parser, PHQL_SET, NULL, parser_status); - break; - case PHQL_T_WHERE: - phql_(phql_parser, PHQL_WHERE, NULL, parser_status); - break; - case PHQL_T_DELETE: - phql_(phql_parser, PHQL_DELETE, NULL, parser_status); - break; - case PHQL_T_INSERT: - phql_(phql_parser, PHQL_INSERT, NULL, parser_status); - break; - case PHQL_T_INTO: - phql_(phql_parser, PHQL_INTO, NULL, parser_status); - break; - case PHQL_T_VALUES: - phql_(phql_parser, PHQL_VALUES, NULL, parser_status); - break; - case PHQL_T_SELECT: - phql_(phql_parser, PHQL_SELECT, NULL, parser_status); - break; - case PHQL_T_AS: - phql_(phql_parser, PHQL_AS, NULL, parser_status); - break; - case PHQL_T_ORDER: - phql_(phql_parser, PHQL_ORDER, NULL, parser_status); - break; - case PHQL_T_BY: - phql_(phql_parser, PHQL_BY, NULL, parser_status); - break; - case PHQL_T_LIMIT: - phql_(phql_parser, PHQL_LIMIT, NULL, parser_status); - break; - case PHQL_T_OFFSET: - phql_(phql_parser, PHQL_OFFSET, NULL, parser_status); - break; - case PHQL_T_GROUP: - phql_(phql_parser, PHQL_GROUP, NULL, parser_status); - break; - case PHQL_T_HAVING: - phql_(phql_parser, PHQL_HAVING, NULL, parser_status); - break; - case PHQL_T_ASC: - phql_(phql_parser, PHQL_ASC, NULL, parser_status); - break; - case PHQL_T_DESC: - phql_(phql_parser, PHQL_DESC, NULL, parser_status); - break; - case PHQL_T_IN: - phql_(phql_parser, PHQL_IN, NULL, parser_status); - break; - case PHQL_T_ON: - phql_(phql_parser, PHQL_ON, NULL, parser_status); - break; - case PHQL_T_INNER: - phql_(phql_parser, PHQL_INNER, NULL, parser_status); - break; - case PHQL_T_JOIN: - phql_(phql_parser, PHQL_JOIN, NULL, parser_status); - break; - case PHQL_T_LEFT: - phql_(phql_parser, PHQL_LEFT, NULL, parser_status); - break; - case PHQL_T_RIGHT: - phql_(phql_parser, PHQL_RIGHT, NULL, parser_status); - break; - case PHQL_T_CROSS: - phql_(phql_parser, PHQL_CROSS, NULL, parser_status); - break; - case PHQL_T_FULL: - phql_(phql_parser, PHQL_FULL, NULL, parser_status); - break; - case PHQL_T_OUTER: - phql_(phql_parser, PHQL_OUTER, NULL, parser_status); - break; - case PHQL_T_IS: - phql_(phql_parser, PHQL_IS, NULL, parser_status); - break; - case PHQL_T_NULL: - phql_(phql_parser, PHQL_NULL, NULL, parser_status); - break; - case PHQL_T_BETWEEN: - phql_(phql_parser, PHQL_BETWEEN, NULL, parser_status); - break; - case PHQL_T_DISTINCT: - phql_(phql_parser, PHQL_DISTINCT, NULL, parser_status); - break; - case PHQL_T_ALL: - phql_(phql_parser, PHQL_ALL, NULL, parser_status); - break; - case PHQL_T_CAST: - phql_(phql_parser, PHQL_CAST, NULL, parser_status); - break; - case PHQL_T_CONVERT: - phql_(phql_parser, PHQL_CONVERT, NULL, parser_status); - break; - case PHQL_T_USING: - phql_(phql_parser, PHQL_USING, NULL, parser_status); - break; - case PHQL_T_EXISTS: - phql_(phql_parser, PHQL_EXISTS, NULL, parser_status); - break; - - default: - parser_status->status = PHQL_PARSING_FAILED; - error_length = sizeof(char) * 32; - error = emalloc(error_length); - snprintf(error, error_length, "Scanner: Unknown opcode %d", token.opcode); - error[error_length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - efree(error); - break; - } - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - - case PHQL_SCANNER_RETCODE_ERR: - case PHQL_SCANNER_RETCODE_IMPOSSIBLE: -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - phql_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } -#endif - status = FAILURE; - break; - - default: - phql_(phql_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - - if (parser_status->status != PHQL_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_UNDEF) { - ZVAL_STRING(*error_msg, parser_status->syntax_error); - } -#endif - efree(parser_status->syntax_error); - } - } - - phql_Free(phql_parser, phql_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHQL_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { -#endif - - if (phalcon_globals_ptr->orm.cache_level >= 1) { -#if PHP_VERSION_ID < 70000 - if (Z_TYPE_P(parser_status->ret) == IS_ARRAY) { - add_assoc_long(parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#else - if (Z_TYPE_P(&parser_status->ret) == IS_ARRAY) { - add_assoc_long(&parser_status->ret, "id", phalcon_globals_ptr->orm.unique_cache_id++); - } -#endif - } - -#if PHP_VERSION_ID < 70000 - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); -#else - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); -#endif - - if (cache_level >= 0) { - - if (!phalcon_globals_ptr->orm.parser_cache) { - ALLOC_HASHTABLE(phalcon_globals_ptr->orm.parser_cache); - zend_hash_init(phalcon_globals_ptr->orm.parser_cache, 0, NULL, ZVAL_PTR_DTOR, 0); - } - -#if PHP_VERSION_ID < 70000 - - Z_ADDREF_PP(result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - result, - sizeof(zval *), - NULL - ); -#else - Z_TRY_ADDREF_P(*result); - - zend_hash_index_update( - phalcon_globals_ptr->orm.parser_cache, - phql_key, - *result - ); -#endif - } - - } else { -#if PHP_VERSION_ID < 70000 - efree(parser_status->ret); -#endif - } - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - #ifdef HAVE_CONFIG_H #endif @@ -113855,9 +105156,9 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { } else { ZEPHIR_CPY_WRT(attributeField, firstPrimaryKey); } - ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_6$$13, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 370, attributeField); + ZEPHIR_CALL_METHOD(&_8$$13, this_ptr, "autoescape", &_7, 335, attributeField); zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$13); ZEPHIR_CONCAT_VSVSV(_9$$13, _6$$13, ".", _8$$13, " = ", conditions); @@ -113903,7 +105204,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { if (Z_TYPE_P(columnAlias) == IS_LONG) { zephir_array_append(&selectedColumns, column, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1135); } else { - ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 370, columnAlias); + ZEPHIR_CALL_METHOD(&_14$$28, this_ptr, "autoescape", &_7, 335, columnAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_15$$28); ZEPHIR_CONCAT_VSV(_15$$28, column, " AS ", _14$$28); @@ -113929,11 +105230,11 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HVALUE(model, _19$$31); ZEPHIR_INIT_NVAR(selectedColumn); if (Z_TYPE_P(modelColumnAlias) == IS_LONG) { - ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_20$$33, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _20$$33, ".*"); } else { - ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 370, modelColumnAlias); + ZEPHIR_CALL_METHOD(&_21$$34, this_ptr, "autoescape", &_7, 335, modelColumnAlias); zephir_check_call_status(); ZEPHIR_CONCAT_VS(selectedColumn, _21$$34, ".*"); } @@ -113943,7 +105244,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { zephir_fast_join_str(_22$$31, SL(", "), selectedColumns TSRMLS_CC); zephir_concat_self(&phql, _22$$31 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_23$$35, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_24$$35); ZEPHIR_CONCAT_VS(_24$$35, _23$$35, ".*"); @@ -113961,14 +105262,14 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_GET_HMKEY(modelAlias, _26$$36, _25$$36); ZEPHIR_GET_HVALUE(model, _27$$36); if (Z_TYPE_P(modelAlias) == IS_STRING) { - ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&_28$$38, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 370, modelAlias); + ZEPHIR_CALL_METHOD(&_29$$38, this_ptr, "autoescape", &_7, 335, modelAlias); zephir_check_call_status(); ZEPHIR_INIT_NVAR(selectedModel); ZEPHIR_CONCAT_VSV(selectedModel, _28$$38, " AS ", _29$$38); } else { - ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 370, model); + ZEPHIR_CALL_METHOD(&selectedModel, this_ptr, "autoescape", &_7, 335, model); zephir_check_call_status(); } zephir_array_append(&selectedModels, selectedModel, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1184); @@ -113979,7 +105280,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_CONCAT_SV(_31$$36, " FROM ", _30$$36); zephir_concat_self(&phql, _31$$36 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 370, models); + ZEPHIR_CALL_METHOD(&_32$$40, this_ptr, "autoescape", &_7, 335, models); zephir_check_call_status(); ZEPHIR_INIT_VAR(_33$$40); ZEPHIR_CONCAT_SV(_33$$40, " FROM ", _32$$40); @@ -114003,20 +105304,20 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ZEPHIR_OBS_NVAR(joinType); zephir_array_fetch_long(&joinType, join, 3, PH_NOISY, "phalcon/mvc/model/query/builder.zep", 1219 TSRMLS_CC); if (zephir_is_true(joinType)) { - ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_37$$43, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_38$$43); ZEPHIR_CONCAT_SVSV(_38$$43, " ", joinType, " JOIN ", _37$$43); zephir_concat_self(&phql, _38$$43 TSRMLS_CC); } else { - ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 370, joinModel); + ZEPHIR_CALL_METHOD(&_39$$44, this_ptr, "autoescape", &_7, 335, joinModel); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_40$$44); ZEPHIR_CONCAT_SV(_40$$44, " JOIN ", _39$$44); zephir_concat_self(&phql, _40$$44 TSRMLS_CC); } if (zephir_is_true(joinAlias)) { - ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 370, joinAlias); + ZEPHIR_CALL_METHOD(&_41$$45, this_ptr, "autoescape", &_7, 335, joinAlias); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_42$$45); ZEPHIR_CONCAT_SV(_42$$45, " AS ", _41$$45); @@ -114061,7 +105362,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_50$$49, &_49$$49) ) { ZEPHIR_GET_HVALUE(groupItem, _51$$49); - ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 370, groupItem); + ZEPHIR_CALL_METHOD(&_52$$52, this_ptr, "autoescape", &_7, 335, groupItem); zephir_check_call_status(); zephir_array_append(&groupItems, _52$$52, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1268); } @@ -114092,7 +105393,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getPhql) { ; zephir_hash_move_forward_ex(_57$$56, &_56$$56) ) { ZEPHIR_GET_HVALUE(orderItem, _58$$56); - ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 370, orderItem); + ZEPHIR_CALL_METHOD(&_59$$57, this_ptr, "autoescape", &_7, 335, orderItem); zephir_check_call_status(); zephir_array_append(&orderItems, _59$$57, PH_SEPARATE, "phalcon/mvc/model/query/builder.zep", 1289); } @@ -114184,7 +105485,7 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, getQuery) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 371); + ZEPHIR_CALL_METHOD(&phql, this_ptr, "getphql", NULL, 336); zephir_check_call_status(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); @@ -114378,4372 +105679,19 @@ static PHP_METHOD(Phalcon_Mvc_Model_Query_Lang, parsePHQL) { - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || - spy->prec<0 || spx->prec==spy->prec ){ - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ -%% +// 39 "parser.php5.lemon" + + +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -%% /* Make sure the INTERFACE macro is defined. */ #ifndef INTERFACE @@ -118751,41 +105699,58 @@ int(*f)(/* struct config * */); #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** PPCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** PPNOCODE is a number of type PPCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** PPFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** PPACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given +** phql_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** PPMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** which is phql_TOKENTYPE. The entry in the union +** for base tokens is called "pp0". +** PPSTACKDEPTH is the maximum depth of the parser's stack. +** phql_ARG_SDECL A static variable declaration for the %extra_argument +** phql_ARG_PDECL A parameter declaration for the %extra_argument +** phql_ARG_STORE Code to store %extra_argument into pppParser +** phql_ARG_FETCH Code to extract %extra_argument from pppParser +** PPNSTATE the combined number of states. +** PPNRULE the number of rules in the grammar +** PPERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define PPCODETYPE unsigned char +#define PPNOCODE 134 +#define PPACTIONTYPE unsigned short int +#define phql_TOKENTYPE phql_parser_token* +typedef union { + phql_TOKENTYPE pp0; + zval* pp162; + int pp267; +} PPMINORTYPE; +#define PPSTACKDEPTH 100 +#define phql_ARG_SDECL phql_parser_status *status; +#define phql_ARG_PDECL ,phql_parser_status *status +#define phql_ARG_FETCH phql_parser_status *status = pppParser->status +#define phql_ARG_STORE pppParser->status = status +#define PPNSTATE 293 +#define PPNRULE 161 +#define PPERRORSYMBOL 79 +#define PPERRSYMDT pp267 +#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) +#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) +#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -118795,741 +105760,126 @@ int(*f)(/* struct config * */); ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < PPNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == PPNSTATE+PPNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == PPNSTATE+PPNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused +** slots in the pp_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named pp_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** pp_action[ pp_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value pp_shift_ofst[S]+X is out of range or if the value +** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] +** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table +** and that pp_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the pp_reduce_ofst[] array is used in place of +** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of +** PP_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** pp_action[] A single table containing all actions. +** pp_lookahead[] A table containing the lookahead for each entry in +** pp_action. Used to detect hash collisions. +** pp_shift_ofst[] For each state, the offset into pp_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** pp_reduce_ofst[] For each state, the offset into pp_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. +** pp_default[] Default action for each state. */ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 39 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** PPCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** PPNOCODE is a number of type PPCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** PPFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** PPACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** PPMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "pp0". -** PPSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into pppParser -** phql_ARG_FETCH Code to extract %extra_argument from pppParser -** PPNSTATE the combined number of states. -** PPNRULE the number of rules in the grammar -** PPERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define PPCODETYPE unsigned char -#define PPNOCODE 134 -#define PPACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE pp0; - zval* pp162; - int pp267; -} PPMINORTYPE; -#define PPSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = pppParser->status -#define phql_ARG_STORE pppParser->status = status -#define PPNSTATE 293 -#define PPNRULE 161 -#define PPERRORSYMBOL 79 -#define PPERRSYMDT pp267 -#define PP_NO_ACTION (PPNSTATE+PPNRULE+2) -#define PP_ACCEPT_ACTION (PPNSTATE+PPNRULE+1) -#define PP_ERROR_ACTION (PPNSTATE+PPNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < PPNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** PPNSTATE <= N < PPNSTATE+PPNRULE Reduce by rule N-PPNSTATE. -** -** N == PPNSTATE+PPNRULE A syntax error has occurred. -** -** N == PPNSTATE+PPNRULE+1 The parser accepts its input. -** -** N == PPNSTATE+PPNRULE+2 No such action. Denotes unused -** slots in the pp_action[] table. -** -** The action table is constructed as a single large table named pp_action[]. -** Given state S and lookahead X, the action is computed as -** -** pp_action[ pp_shift_ofst[S] + X ] -** -** If the index value pp_shift_ofst[S]+X is out of range or if the value -** pp_lookahead[pp_shift_ofst[S]+X] is not equal to X or if pp_shift_ofst[S] -** is equal to PP_SHIFT_USE_DFLT, it means that the action is not in the table -** and that pp_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the pp_reduce_ofst[] array is used in place of -** the pp_shift_ofst[] array and PP_REDUCE_USE_DFLT is used in place of -** PP_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** pp_action[] A single table containing all actions. -** pp_lookahead[] A table containing the lookahead for each entry in -** pp_action. Used to detect hash collisions. -** pp_shift_ofst[] For each state, the offset into pp_action for -** shifting terminals. -** pp_reduce_ofst[] For each state, the offset into pp_action for -** shifting non-terminals after a reduce. -** pp_default[] Default action for each state. -*/ -static PPACTIONTYPE pp_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, +static PPACTIONTYPE pp_action[] = { + /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, + /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, + /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, + /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, + /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, + /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, + /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, + /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, + /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, + /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, + /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, + /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, + /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, + /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, + /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, + /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, + /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, + /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, + /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, + /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, + /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, + /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, + /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, + /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, + /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, + /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, + /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, + /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, + /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, + /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, + /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, + /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, + /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, + /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, + /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, + /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, + /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, + /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, + /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, + /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, + /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, + /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, + /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, + /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, + /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, + /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, + /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, + /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, + /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, + /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, + /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, + /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, + /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, + /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, + /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, + /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, + /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, + /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, + /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, + /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, + /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, + /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, + /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, + /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, + /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, + /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, + /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, + /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, + /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, + /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, + /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, + /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, + /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, + /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, + /* 790 */ 118, 231, 243, 296, 116, 14, }; static PPCODETYPE pp_lookahead[] = { /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -124785,5139 +111135,823 @@ static int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql } -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ +/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ +// 1 "scanner.re" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval* yy162; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ +#define PPCTYPE unsigned char +#define PPCURSOR (s->start) +#define PPLIMIT (s->end) +#define PPMARKER q -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ +static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ + char *q = PPCURSOR; + int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} + while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} + +// 45 "scanner.c" + { + PPCTYPE ppch; + unsigned int ppaccept = 0; -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + ppch = *PPCURSOR; + switch (ppch) { + case 0x00: goto pp72; + case '\t': + case '\n': + case '\r': + case ' ': goto pp70; + case '!': goto pp53; + case '"': goto pp32; + case '%': goto pp45; + case '&': goto pp64; + case '\'': goto pp33; + case '(': goto pp49; + case ')': goto pp51; + case '*': goto pp41; + case '+': goto pp37; + case ',': goto pp47; + case '-': goto pp39; + case '.': goto pp11; + case '/': goto pp43; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp2; + case ':': goto pp15; + case '<': goto pp55; + case '=': goto pp59; + case '>': goto pp57; + case '?': goto pp13; + case '@': goto pp61; + case 'A': + case 'a': goto pp4; + case 'B': + case 'b': goto pp5; + case 'C': + case 'c': goto pp6; + case 'D': + case 'd': goto pp7; + case 'E': + case 'e': goto pp8; + case 'F': + case 'f': goto pp9; + case 'G': + case 'g': goto pp25; + case 'H': + case 'h': goto pp26; + case 'I': + case 'i': goto pp21; + case 'J': + case 'j': goto pp29; + case 'K': + case 'M': + case 'P': + case 'Q': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'k': + case 'm': + case 'p': + case 'q': + case 'y': + case 'z': goto pp35; + case 'L': + case 'l': goto pp27; + case 'N': + case 'n': goto pp28; + case 'O': + case 'o': goto pp24; + case 'R': + case 'r': goto pp30; + case 'S': + case 's': goto pp20; + case 'T': + case 't': goto pp31; + case 'U': + case 'u': goto pp18; + case 'V': + case 'v': goto pp22; + case 'W': + case 'w': goto pp23; + case '[': goto pp36; + case '\\': goto pp34; + case '^': goto pp68; + case 'x': goto pp10; + case '{': goto pp17; + case '|': goto pp62; + case '~': goto pp66; + default: goto pp74; + } +pp2: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '.': goto pp340; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp342; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'x': goto pp344; + default: goto pp3; + } +pp3: +// 46 "scanner.re" + { + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; + if (token->len > 2 && !memcmp(token->value, "0x", 2)) { + token->opcode = PHQL_T_HINTEGER; + } else { + int i, alpha = 0; + for (i = 0; i < token->len; i++) { + unsigned char ch = token->value[i]; + if (!((ch >= '0') && (ch <= '9'))) { + alpha = 1; + break; + } + } + if (alpha) { + token->opcode = PHQL_T_IDENTIFIER; + } else { + token->opcode = PHQL_T_INTEGER; + } + } + q = PPCURSOR; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy162)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy162)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - status->ret = yymsp[0].minor.yy162; -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; -} - break; - case 5: -{ - yygotominor.yy162 = phql_ret_select_statement(yymsp[-6].minor.yy162, yymsp[-5].minor.yy162, yymsp[-2].minor.yy162, yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 6: -{ - yygotominor.yy162 = phql_ret_select_clause(yymsp[-4].minor.yy162, yymsp[-3].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - yygotominor.yy162 = phql_ret_distinct_all(1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - yygotominor.yy162 = phql_ret_distinct_all(0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - yygotominor.yy162 = NULL; -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[0].minor.yy162, NULL); -} - break; - case 12: - case 140: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[-1].minor.yy162, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - yygotominor.yy162 = phql_ret_column_item(PHQL_T_EXPR, yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 21: - case 128: -{ - yygotominor.yy162 = phql_ret_zval_list(yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 24: -{ - yygotominor.yy162 = phql_ret_join_item(yymsp[-3].minor.yy162, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 25: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - yygotominor.yy162 = phql_ret_join_type(PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - yygotominor.yy162 = phql_ret_insert_statement(yymsp[-7].minor.yy162, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - yygotominor.yy162 = phql_ret_update_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 48: -{ - yygotominor.yy162 = phql_ret_update_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - yygotominor.yy162 = phql_ret_update_item(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - yygotominor.yy162 = phql_ret_delete_statement(yymsp[-2].minor.yy162, yymsp[-1].minor.yy162, yymsp[0].minor.yy162); -} - break; - case 54: -{ - yygotominor.yy162 = phql_ret_delete_clause(yymsp[0].minor.yy162); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-1].minor.yy162, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[0].minor.yy162, NULL, NULL); -} - break; - case 58: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-6].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-5].minor.yy162, yymsp[-4].minor.yy0, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-3].minor.yy162, yymsp[-2].minor.yy0, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-4].minor.yy162, NULL, yymsp[-1].minor.yy162); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - yygotominor.yy162 = phql_ret_assoc_name(yymsp[-2].minor.yy162, NULL, yymsp[0].minor.yy162); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[0].minor.yy162, 0); -} - break; - case 75: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - yygotominor.yy162 = phql_ret_order_item(yymsp[-1].minor.yy162, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy162 = yymsp[0].minor.yy162; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - yygotominor.yy162 = phql_ret_for_update_clause(); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[0].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - yygotominor.yy162 = phql_ret_limit_clause(yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - yygotominor.yy162 = phql_ret_placeholder_zval(PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MINUS, NULL, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUB, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ADD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MUL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_DIV, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_MOD, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_AND, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_OR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_XOR, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTEQUALS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESS, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATER, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_GREATEREQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LESSEQUAL, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_LIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NLIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ILIKE, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NILIKE, yymsp[-3].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_IN, yymsp[-4].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOTIN, yymsp[-5].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_SUBQUERY, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_EXISTS, NULL, yymsp[-1].minor.yy162); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_AGAINST, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CAST, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CONVERT, yymsp[-3].minor.yy162, phql_ret_raw_qualified_name(yymsp[-1].minor.yy0, NULL)); - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_CASE, yymsp[-2].minor.yy162, yymsp[-1].minor.yy162); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_WHEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ELSE, yymsp[0].minor.yy162, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - yygotominor.yy162 = phql_ret_func_call(yymsp[-4].minor.yy0, yymsp[-1].minor.yy162, yymsp[-2].minor.yy162); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - yygotominor.yy162 = phql_ret_distinct(); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNULL, yymsp[-2].minor.yy162, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ISNOTNULL, yymsp[-3].minor.yy162, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BETWEEN, yymsp[-2].minor.yy162, yymsp[0].minor.yy162); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_BITWISE_NOT, NULL, yymsp[0].minor.yy162); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - yygotominor.yy162 = phql_ret_expr(PHQL_T_ENCLOSED, yymsp[-1].minor.yy162, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - yygotominor.yy162 = phql_ret_literal_zval(PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - yygotominor.yy162 = phql_ret_qualified_name(NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - +// 201 "scanner.c" +pp4: + ppch = *++PPCURSOR; + switch (ppch) { + case 'G': + case 'g': goto pp323; + case 'L': + case 'l': goto pp324; + case 'N': + case 'n': goto pp325; + case 'S': + case 's': goto pp326; + default: goto pp248; } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +pp5: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp314; + case 'Y': + case 'y': goto pp315; + default: goto pp248; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); +pp6: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp296; + case 'O': + case 'o': goto pp297; + case 'R': + case 'r': goto pp298; + default: goto pp248; + } +pp7: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp279; + case 'I': + case 'i': goto pp280; + default: goto pp248; + } +pp8: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp265; + case 'N': + case 'n': goto pp266; + case 'X': goto pp267; + case 'x': goto pp268; + default: goto pp248; + } +pp9: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp249; + case 'O': + case 'o': goto pp250; + case 'R': + case 'r': goto pp251; + case 'U': + case 'u': goto pp252; + default: goto pp248; + } +pp10: + ppch = *++PPCURSOR; + goto pp248; +pp11: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp244; + default: goto pp12; + } +pp12: +// 432 "scanner.re" + { + token->opcode = PHQL_T_DOT; + return 0; + } +// 292 "scanner.c" +pp13: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto pp241; + default: goto pp14; + } +pp14: +// 557 "scanner.re" + { + status = PHQL_SCANNER_RETCODE_ERR; + break; + } +// 314 "scanner.c" +pp15: + ppaccept = 0; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp237; + default: goto pp16; + } +pp16: +// 437 "scanner.re" + { + token->opcode = PHQL_T_COLON; + return 0; + } +// 391 "scanner.c" +pp17: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp233; + default: goto pp14; + } +pp18: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case 'P': + case 'p': goto pp222; + case 'S': + case 's': goto pp223; + default: goto pp101; + } +pp19: +// 380 "scanner.re" + { + token->opcode = PHQL_T_IDENTIFIER; + if ((PPCURSOR - q) > 1) { + if (q[0] == '\\') { + token->value = estrndup(q + 1, PPCURSOR - q - 1); + token->len = PPCURSOR - q - 1; } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; - } - - if (!token_found) { - if (token_name) { - efree(token_name); - } + token->value = estrndup(q, PPCURSOR - q); + token->len = PPCURSOR - q; } + q = PPCURSOR; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ - - -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phql_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phql_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** phql_ARG_SDECL A static variable declaration for the %extra_argument -** phql_ARG_PDECL A parameter declaration for the %extra_argument -** phql_ARG_STORE Code to store %extra_argument into yypParser -** phql_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 134 -#define YYACTIONTYPE unsigned short int -#define phql_TOKENTYPE phql_parser_token* -typedef union { - phql_TOKENTYPE yy0; - zval yy204; - int yy267; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 -#define phql_ARG_SDECL phql_parser_status *status; -#define phql_ARG_PDECL ,phql_parser_status *status -#define phql_ARG_FETCH phql_parser_status *status = yypParser->status -#define phql_ARG_STORE yypParser->status = status -#define YYNSTATE 293 -#define YYNRULE 161 -#define YYERRORSYMBOL 79 -#define YYERRSYMDT yy267 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -static YYACTIONTYPE yy_action[] = { - /* 0 */ 120, 126, 55, 57, 59, 61, 63, 65, 45, 47, - /* 10 */ 67, 72, 49, 51, 53, 41, 39, 43, 37, 34, - /* 20 */ 122, 74, 69, 120, 126, 55, 57, 59, 61, 63, - /* 30 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 40 */ 43, 37, 34, 122, 74, 69, 37, 34, 122, 74, - /* 50 */ 69, 166, 220, 92, 218, 45, 47, 67, 72, 49, - /* 60 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 70 */ 154, 429, 186, 91, 120, 126, 55, 57, 59, 61, - /* 80 */ 63, 65, 45, 47, 67, 72, 49, 51, 53, 41, - /* 90 */ 39, 43, 37, 34, 122, 74, 69, 120, 126, 55, - /* 100 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 110 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 120 */ 19, 20, 21, 22, 23, 227, 32, 33, 67, 72, - /* 130 */ 49, 51, 53, 41, 39, 43, 37, 34, 122, 74, - /* 140 */ 69, 130, 238, 120, 126, 55, 57, 59, 61, 63, - /* 150 */ 65, 45, 47, 67, 72, 49, 51, 53, 41, 39, - /* 160 */ 43, 37, 34, 122, 74, 69, 41, 39, 43, 37, - /* 170 */ 34, 122, 74, 69, 140, 8, 120, 126, 55, 57, - /* 180 */ 59, 61, 63, 65, 45, 47, 67, 72, 49, 51, - /* 190 */ 53, 41, 39, 43, 37, 34, 122, 74, 69, 120, - /* 200 */ 126, 55, 57, 59, 61, 63, 65, 45, 47, 67, - /* 210 */ 72, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 220 */ 74, 69, 120, 126, 55, 57, 59, 61, 63, 65, - /* 230 */ 45, 47, 67, 72, 49, 51, 53, 41, 39, 43, - /* 240 */ 37, 34, 122, 74, 69, 168, 109, 156, 35, 95, - /* 250 */ 99, 169, 171, 26, 76, 151, 188, 81, 159, 160, - /* 260 */ 82, 111, 209, 113, 114, 17, 146, 285, 192, 208, - /* 270 */ 194, 196, 128, 200, 204, 222, 223, 455, 1, 2, - /* 280 */ 3, 4, 5, 6, 199, 173, 284, 197, 174, 175, - /* 290 */ 181, 182, 183, 133, 137, 143, 76, 149, 158, 24, - /* 300 */ 212, 217, 178, 176, 177, 179, 180, 168, 135, 271, - /* 310 */ 35, 249, 6, 169, 171, 287, 276, 110, 290, 173, - /* 320 */ 159, 49, 51, 53, 41, 39, 43, 37, 34, 122, - /* 330 */ 74, 69, 158, 384, 128, 430, 192, 208, 194, 196, - /* 340 */ 80, 200, 204, 292, 210, 122, 74, 69, 84, 84, - /* 350 */ 174, 175, 181, 182, 183, 133, 137, 143, 125, 149, - /* 360 */ 107, 107, 95, 90, 178, 176, 177, 179, 180, 55, - /* 370 */ 57, 59, 61, 63, 65, 45, 47, 67, 72, 49, - /* 380 */ 51, 53, 41, 39, 43, 37, 34, 122, 74, 69, - /* 390 */ 213, 274, 258, 35, 70, 228, 169, 171, 131, 109, - /* 400 */ 245, 265, 6, 214, 259, 230, 279, 286, 282, 234, - /* 410 */ 173, 83, 203, 6, 129, 201, 84, 128, 173, 152, - /* 420 */ 154, 207, 186, 158, 205, 162, 244, 96, 107, 85, - /* 430 */ 219, 158, 173, 174, 175, 181, 182, 183, 133, 137, - /* 440 */ 143, 94, 149, 173, 7, 158, 102, 178, 176, 177, - /* 450 */ 179, 180, 162, 232, 35, 89, 158, 169, 171, 184, - /* 460 */ 76, 112, 113, 114, 159, 211, 215, 79, 94, 78, - /* 470 */ 173, 226, 221, 217, 94, 6, 277, 240, 128, 160, - /* 480 */ 165, 84, 98, 158, 250, 163, 184, 162, 103, 95, - /* 490 */ 104, 173, 94, 107, 174, 175, 181, 182, 183, 133, - /* 500 */ 137, 143, 92, 149, 158, 173, 108, 155, 178, 176, - /* 510 */ 177, 179, 180, 168, 92, 224, 35, 258, 158, 169, - /* 520 */ 171, 184, 100, 27, 258, 173, 159, 166, 216, 257, - /* 530 */ 191, 115, 189, 254, 105, 173, 259, 124, 158, 69, - /* 540 */ 128, 110, 173, 107, 166, 281, 282, 225, 158, 252, - /* 550 */ 260, 31, 253, 10, 251, 158, 174, 175, 181, 182, - /* 560 */ 183, 133, 137, 143, 233, 149, 107, 106, 42, 173, - /* 570 */ 178, 176, 177, 179, 180, 30, 247, 35, 329, 245, - /* 580 */ 169, 171, 158, 147, 31, 229, 173, 159, 123, 328, - /* 590 */ 261, 332, 256, 270, 101, 327, 162, 173, 326, 158, - /* 600 */ 325, 128, 173, 173, 242, 246, 206, 28, 237, 18, - /* 610 */ 158, 50, 255, 202, 173, 158, 158, 174, 175, 181, - /* 620 */ 182, 183, 133, 137, 143, 121, 149, 158, 239, 173, - /* 630 */ 167, 178, 176, 177, 179, 180, 97, 269, 164, 119, - /* 640 */ 148, 263, 158, 173, 324, 264, 173, 71, 15, 132, - /* 650 */ 150, 267, 323, 161, 145, 256, 158, 173, 73, 158, - /* 660 */ 134, 170, 172, 198, 62, 173, 322, 333, 173, 60, - /* 670 */ 158, 262, 173, 66, 93, 266, 173, 195, 158, 173, - /* 680 */ 173, 158, 173, 187, 139, 158, 136, 173, 268, 158, - /* 690 */ 11, 173, 158, 158, 76, 158, 295, 185, 58, 340, - /* 700 */ 158, 173, 173, 56, 158, 272, 236, 36, 321, 54, - /* 710 */ 38, 383, 293, 157, 158, 158, 173, 127, 40, 273, - /* 720 */ 193, 173, 275, 278, 173, 173, 280, 173, 173, 158, - /* 730 */ 190, 173, 68, 52, 158, 173, 173, 158, 158, 138, - /* 740 */ 158, 158, 48, 283, 158, 13, 25, 88, 158, 158, - /* 750 */ 173, 173, 16, 248, 87, 86, 44, 46, 64, 297, - /* 760 */ 173, 294, 141, 158, 158, 296, 142, 288, 153, 289, - /* 770 */ 346, 173, 291, 158, 173, 173, 173, 12, 29, 75, - /* 780 */ 77, 144, 9, 235, 158, 117, 241, 158, 158, 158, - /* 790 */ 118, 231, 243, 296, 116, 14, -}; -static YYCODETYPE yy_lookahead[] = { - /* 0 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - /* 10 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 20 */ 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, - /* 30 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 40 */ 18, 19, 20, 21, 22, 23, 19, 20, 21, 22, - /* 50 */ 23, 25, 30, 25, 32, 9, 10, 11, 12, 13, - /* 60 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 70 */ 71, 45, 73, 45, 1, 2, 3, 4, 5, 6, - /* 80 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 90 */ 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, - /* 100 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 110 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 120 */ 60, 61, 62, 63, 64, 45, 53, 54, 11, 12, - /* 130 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 140 */ 23, 45, 56, 1, 2, 3, 4, 5, 6, 7, - /* 150 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 160 */ 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, - /* 170 */ 20, 21, 22, 23, 32, 88, 1, 2, 3, 4, - /* 180 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 190 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, - /* 200 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - /* 210 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 220 */ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, - /* 230 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 240 */ 19, 20, 21, 22, 23, 17, 31, 72, 20, 119, - /* 250 */ 120, 23, 24, 51, 26, 127, 128, 96, 30, 44, - /* 260 */ 25, 100, 101, 102, 103, 25, 68, 98, 33, 34, - /* 270 */ 35, 36, 44, 38, 39, 28, 29, 80, 81, 82, - /* 280 */ 83, 84, 85, 86, 34, 116, 117, 37, 60, 61, - /* 290 */ 62, 63, 64, 65, 66, 67, 26, 69, 129, 59, - /* 300 */ 97, 98, 74, 75, 76, 77, 78, 17, 82, 112, - /* 310 */ 20, 41, 86, 23, 24, 118, 46, 30, 48, 116, - /* 320 */ 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 330 */ 22, 23, 129, 0, 44, 45, 33, 34, 35, 36, - /* 340 */ 95, 38, 39, 99, 99, 21, 22, 23, 104, 104, - /* 350 */ 60, 61, 62, 63, 64, 65, 66, 67, 74, 69, - /* 360 */ 116, 116, 119, 120, 74, 75, 76, 77, 78, 3, - /* 370 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 380 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 390 */ 17, 58, 98, 20, 11, 12, 23, 24, 82, 31, - /* 400 */ 98, 107, 86, 30, 110, 22, 114, 115, 116, 82, - /* 410 */ 116, 99, 34, 86, 98, 37, 104, 44, 116, 70, - /* 420 */ 71, 34, 73, 129, 37, 98, 124, 30, 116, 32, - /* 430 */ 30, 129, 116, 60, 61, 62, 63, 64, 65, 66, - /* 440 */ 67, 30, 69, 116, 87, 129, 49, 74, 75, 76, - /* 450 */ 77, 78, 98, 126, 20, 44, 129, 23, 24, 132, - /* 460 */ 26, 101, 102, 103, 30, 25, 31, 27, 30, 94, - /* 470 */ 116, 82, 97, 98, 30, 86, 99, 55, 44, 44, - /* 480 */ 126, 104, 44, 129, 42, 131, 132, 98, 44, 119, - /* 490 */ 120, 116, 30, 116, 60, 61, 62, 63, 64, 65, - /* 500 */ 66, 67, 25, 69, 129, 116, 30, 98, 74, 75, - /* 510 */ 76, 77, 78, 17, 25, 126, 20, 98, 129, 23, - /* 520 */ 24, 132, 45, 52, 98, 116, 30, 25, 17, 110, - /* 530 */ 30, 104, 32, 107, 45, 116, 110, 23, 129, 23, - /* 540 */ 44, 30, 116, 116, 25, 115, 116, 45, 129, 43, - /* 550 */ 44, 98, 44, 90, 104, 129, 60, 61, 62, 63, - /* 560 */ 64, 65, 66, 67, 45, 69, 116, 119, 98, 116, - /* 570 */ 74, 75, 76, 77, 78, 122, 50, 20, 30, 98, - /* 580 */ 23, 24, 129, 30, 98, 98, 116, 30, 74, 30, - /* 590 */ 108, 0, 25, 111, 119, 30, 98, 116, 30, 129, - /* 600 */ 30, 44, 116, 116, 123, 124, 34, 121, 122, 125, - /* 610 */ 129, 98, 45, 34, 116, 129, 129, 60, 61, 62, - /* 620 */ 63, 64, 65, 66, 67, 98, 69, 129, 98, 116, - /* 630 */ 132, 74, 75, 76, 77, 78, 49, 30, 45, 98, - /* 640 */ 45, 43, 129, 116, 30, 44, 116, 98, 58, 45, - /* 650 */ 98, 25, 30, 130, 98, 25, 129, 116, 98, 129, - /* 660 */ 44, 98, 98, 34, 98, 116, 30, 0, 116, 98, - /* 670 */ 129, 45, 116, 98, 119, 45, 116, 34, 129, 116, - /* 680 */ 116, 129, 116, 98, 98, 129, 45, 116, 111, 129, - /* 690 */ 91, 116, 129, 129, 26, 129, 0, 28, 98, 0, - /* 700 */ 129, 116, 116, 98, 129, 87, 98, 98, 30, 98, - /* 710 */ 98, 0, 0, 98, 129, 129, 116, 98, 98, 113, - /* 720 */ 34, 116, 125, 47, 116, 116, 25, 116, 116, 129, - /* 730 */ 30, 116, 98, 98, 129, 116, 116, 129, 129, 44, - /* 740 */ 129, 129, 98, 3, 129, 57, 125, 119, 129, 129, - /* 750 */ 116, 116, 125, 98, 49, 30, 98, 98, 98, 0, - /* 760 */ 116, 0, 30, 129, 129, 0, 45, 87, 128, 113, - /* 770 */ 0, 116, 27, 129, 116, 116, 116, 92, 25, 44, - /* 780 */ 93, 44, 89, 45, 129, 106, 52, 129, 129, 129, - /* 790 */ 40, 44, 25, 133, 105, 46, -}; -#define YY_SHIFT_USE_DFLT (-2) -static short yy_shift_ofst[] = { - /* 0 */ 270, 712, 761, 696, 765, 759, 526, 422, 86, 202, - /* 10 */ 590, 688, -2, 749, -2, 60, 240, 60, -2, -2, - /* 20 */ -2, -2, -2, -2, 60, -2, 471, 557, 753, 557, - /* 30 */ -2, 73, -2, -2, 557, 557, 324, 557, 324, 557, - /* 40 */ 27, 557, 27, 557, 27, 557, 117, 557, 117, 557, - /* 50 */ 150, 557, 150, 557, 150, 557, 46, 557, 46, 557, - /* 60 */ 46, 557, 46, 557, 46, 557, 46, 557, 308, 383, - /* 70 */ 557, 516, 557, 308, 735, 228, 247, 373, 440, 476, - /* 80 */ 235, -2, 476, -2, 397, 725, 705, 411, -2, 462, - /* 90 */ 28, -2, 462, -2, -2, -2, 587, 438, 462, 477, - /* 100 */ -2, -2, 444, 462, 489, -2, -2, -2, 368, 287, - /* 110 */ -2, 303, -2, -2, 476, 500, 750, -2, 557, 221, - /* 120 */ 557, 221, 514, -2, 284, -2, 557, 366, 434, 96, - /* 130 */ -2, 604, -2, 616, 668, 641, -2, 695, 557, 142, - /* 140 */ 732, 721, -2, 737, 557, 198, 553, 595, -2, 557, - /* 150 */ -1, 349, -2, -2, 557, 175, 557, 221, -2, 215, - /* 160 */ 669, 290, 221, 593, -2, 26, 496, -2, -2, 557, - /* 170 */ 516, 557, 516, -2, -2, -2, -2, -2, -2, -2, - /* 180 */ -2, -2, -2, -2, -2, -2, 557, 221, -2, 700, - /* 190 */ -2, -2, 686, 678, 643, 636, 250, 629, 622, 614, - /* 200 */ 378, 579, 570, 568, 387, 572, 565, 559, 548, -2, - /* 210 */ -2, 373, -2, -2, 435, 511, -2, 22, 400, -2, - /* 220 */ -2, -2, -2, -2, 502, -2, 80, -2, 557, 516, - /* 230 */ 747, 228, 519, -2, 738, -2, 324, -2, 557, 221, - /* 240 */ 734, 557, 767, 557, -2, 221, -2, 557, 221, 442, - /* 250 */ 476, 506, 508, 557, 567, 591, 557, -2, 221, -2, - /* 260 */ 607, 626, 598, 601, 557, 630, 667, 607, -2, -2, - /* 270 */ -2, 526, 333, 699, 60, 711, 476, 676, 476, 701, - /* 280 */ 476, -2, 740, 557, -2, 221, -2, 526, 333, 770, - /* 290 */ 745, 476, -2, -}; -#define YY_REDUCE_USE_DFLT (-1) -static short yy_reduce_ofst[] = { - /* 0 */ 197, -1, -1, -1, -1, -1, 357, 87, 693, 463, - /* 10 */ 599, 685, -1, -1, -1, 627, -1, 484, -1, -1, - /* 20 */ -1, -1, -1, -1, 621, -1, -1, 486, -1, 453, - /* 30 */ -1, -1, -1, -1, 608, 609, -1, 612, -1, 620, - /* 40 */ -1, 470, -1, 658, -1, 659, -1, 644, -1, 513, - /* 50 */ -1, 635, -1, 611, -1, 605, -1, 600, -1, 571, - /* 60 */ -1, 566, -1, 660, -1, 575, -1, 634, -1, -1, - /* 70 */ 549, -1, 560, -1, -1, 389, 687, 375, -1, 245, - /* 80 */ 161, -1, 312, -1, -1, -1, -1, 628, -1, 243, - /* 90 */ -1, -1, 555, -1, -1, -1, -1, 475, 130, -1, - /* 100 */ -1, -1, 448, 370, -1, -1, -1, -1, -1, -1, - /* 110 */ -1, 360, -1, -1, 427, 689, 679, -1, 541, -1, - /* 120 */ 527, -1, -1, -1, -1, -1, 619, -1, 316, -1, - /* 130 */ -1, -1, -1, -1, 226, -1, -1, -1, 586, -1, - /* 140 */ -1, -1, -1, -1, 556, -1, -1, -1, -1, 552, - /* 150 */ 128, 640, -1, -1, 409, -1, 615, -1, -1, -1, - /* 160 */ 523, 354, -1, -1, -1, -1, 498, -1, -1, 563, - /* 170 */ -1, 564, -1, -1, -1, -1, -1, -1, -1, -1, - /* 180 */ -1, -1, -1, -1, -1, -1, 585, -1, -1, -1, - /* 190 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 200 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* 210 */ -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, - /* 220 */ -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, - /* 230 */ -1, 327, -1, -1, -1, -1, -1, -1, 530, -1, - /* 240 */ -1, 481, -1, 302, -1, -1, -1, 655, -1, -1, - /* 250 */ 450, -1, -1, 426, -1, -1, 419, -1, -1, -1, - /* 260 */ 482, -1, -1, -1, 294, -1, -1, 577, -1, -1, - /* 270 */ -1, 618, 606, -1, 597, -1, 377, -1, 292, -1, - /* 280 */ 430, -1, -1, 169, -1, -1, -1, 680, 656, -1, - /* 290 */ -1, 244, -1, -}; -static YYACTIONTYPE yy_default[] = { - /* 0 */ 454, 454, 454, 454, 454, 454, 362, 371, 376, 364, - /* 10 */ 382, 378, 298, 454, 377, 454, 379, 454, 380, 385, - /* 20 */ 386, 387, 388, 389, 454, 381, 454, 454, 363, 454, - /* 30 */ 365, 367, 368, 369, 454, 454, 390, 454, 392, 454, - /* 40 */ 393, 454, 394, 454, 395, 454, 396, 454, 397, 454, - /* 50 */ 398, 454, 399, 454, 400, 454, 401, 454, 402, 454, - /* 60 */ 403, 454, 404, 454, 405, 454, 406, 454, 407, 454, - /* 70 */ 454, 408, 454, 409, 454, 454, 302, 454, 454, 454, - /* 80 */ 313, 299, 454, 310, 350, 454, 348, 454, 351, 454, - /* 90 */ 454, 352, 454, 357, 359, 358, 349, 454, 454, 454, - /* 100 */ 353, 354, 454, 454, 454, 355, 356, 360, 453, 454, - /* 110 */ 452, 312, 314, 316, 454, 320, 331, 317, 454, 330, - /* 120 */ 454, 417, 454, 435, 454, 436, 454, 437, 454, 454, - /* 130 */ 440, 454, 413, 454, 454, 454, 416, 454, 454, 454, - /* 140 */ 454, 454, 418, 454, 454, 454, 454, 454, 419, 454, - /* 150 */ 454, 454, 420, 421, 454, 454, 454, 423, 425, 453, - /* 160 */ 428, 454, 434, 454, 426, 454, 454, 431, 433, 454, - /* 170 */ 438, 454, 439, 441, 442, 443, 444, 445, 446, 447, - /* 180 */ 448, 449, 450, 451, 432, 427, 454, 424, 422, 454, - /* 190 */ 318, 319, 454, 454, 454, 454, 454, 454, 454, 454, - /* 200 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 315, - /* 210 */ 311, 454, 303, 305, 453, 454, 306, 309, 454, 307, - /* 220 */ 308, 304, 300, 301, 454, 411, 454, 414, 454, 410, - /* 230 */ 454, 454, 454, 412, 454, 415, 391, 366, 454, 375, - /* 240 */ 454, 454, 370, 454, 372, 374, 373, 454, 361, 454, - /* 250 */ 454, 454, 454, 454, 454, 454, 454, 334, 336, 335, - /* 260 */ 454, 454, 454, 454, 454, 454, 454, 454, 337, 339, - /* 270 */ 338, 362, 454, 454, 454, 454, 454, 454, 454, 341, - /* 280 */ 454, 342, 454, 454, 344, 345, 343, 362, 454, 454, - /* 290 */ 454, 454, 347, -}; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - phql_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -static void phql_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { - "$", "AGAINST", "BETWEEN", "EQUALS", - "NOTEQUALS", "LESS", "GREATER", "GREATEREQUAL", - "LESSEQUAL", "AND", "OR", "LIKE", - "ILIKE", "BITWISE_AND", "BITWISE_OR", "BITWISE_XOR", - "DIVIDE", "TIMES", "MOD", "PLUS", - "MINUS", "IS", "IN", "NOT", - "BITWISE_NOT", "COMMA", "SELECT", "FROM", - "DISTINCT", "ALL", "IDENTIFIER", "DOT", - "AS", "INNER", "JOIN", "CROSS", - "LEFT", "OUTER", "RIGHT", "FULL", - "ON", "INSERT", "INTO", "VALUES", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "UPDATE", "SET", - "DELETE", "WITH", "WHERE", "ORDER", - "BY", "ASC", "DESC", "GROUP", - "HAVING", "FOR", "LIMIT", "OFFSET", - "INTEGER", "HINTEGER", "NPLACEHOLDER", "SPLACEHOLDER", - "BPLACEHOLDER", "EXISTS", "CAST", "CONVERT", - "USING", "CASE", "END", "WHEN", - "THEN", "ELSE", "NULL", "STRING", - "DOUBLE", "TRUE", "FALSE", "error", - "program", "query_language", "select_statement", "insert_statement", - "update_statement", "delete_statement", "select_clause", "where_clause", - "group_clause", "having_clause", "order_clause", "select_limit_clause", - "for_update_clause", "distinct_all", "column_list", "associated_name_list", - "join_list_or_null", "column_item", "expr", "associated_name", - "join_list", "join_item", "join_clause", "join_type", - "aliased_or_qualified_name", "join_associated_name", "join_conditions", "values_list", - "field_list", "value_list", "value_item", "field_item", - "update_clause", "limit_clause", "update_item_list", "update_item", - "qualified_name", "new_value", "delete_clause", "with_item", - "with_list", "order_list", "order_item", "group_list", - "group_item", "integer_or_placeholder", "argument_list", "when_clauses", - "when_clause", "function_call", "distinct_or_null", "argument_list_or_null", - "argument_item", -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { - /* 0 */ "program ::= query_language", - /* 1 */ "query_language ::= select_statement", - /* 2 */ "query_language ::= insert_statement", - /* 3 */ "query_language ::= update_statement", - /* 4 */ "query_language ::= delete_statement", - /* 5 */ "select_statement ::= select_clause where_clause group_clause having_clause order_clause select_limit_clause for_update_clause", - /* 6 */ "select_clause ::= SELECT distinct_all column_list FROM associated_name_list join_list_or_null", - /* 7 */ "distinct_all ::= DISTINCT", - /* 8 */ "distinct_all ::= ALL", - /* 9 */ "distinct_all ::=", - /* 10 */ "column_list ::= column_list COMMA column_item", - /* 11 */ "column_list ::= column_item", - /* 12 */ "column_item ::= TIMES", - /* 13 */ "column_item ::= IDENTIFIER DOT TIMES", - /* 14 */ "column_item ::= expr AS IDENTIFIER", - /* 15 */ "column_item ::= expr IDENTIFIER", - /* 16 */ "column_item ::= expr", - /* 17 */ "associated_name_list ::= associated_name_list COMMA associated_name", - /* 18 */ "associated_name_list ::= associated_name", - /* 19 */ "join_list_or_null ::= join_list", - /* 20 */ "join_list_or_null ::=", - /* 21 */ "join_list ::= join_list join_item", - /* 22 */ "join_list ::= join_item", - /* 23 */ "join_item ::= join_clause", - /* 24 */ "join_clause ::= join_type aliased_or_qualified_name join_associated_name join_conditions", - /* 25 */ "join_associated_name ::= AS IDENTIFIER", - /* 26 */ "join_associated_name ::= IDENTIFIER", - /* 27 */ "join_associated_name ::=", - /* 28 */ "join_type ::= INNER JOIN", - /* 29 */ "join_type ::= CROSS JOIN", - /* 30 */ "join_type ::= LEFT OUTER JOIN", - /* 31 */ "join_type ::= LEFT JOIN", - /* 32 */ "join_type ::= RIGHT OUTER JOIN", - /* 33 */ "join_type ::= RIGHT JOIN", - /* 34 */ "join_type ::= FULL OUTER JOIN", - /* 35 */ "join_type ::= FULL JOIN", - /* 36 */ "join_type ::= JOIN", - /* 37 */ "join_conditions ::= ON expr", - /* 38 */ "join_conditions ::=", - /* 39 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 40 */ "insert_statement ::= INSERT INTO aliased_or_qualified_name PARENTHESES_OPEN field_list PARENTHESES_CLOSE VALUES PARENTHESES_OPEN values_list PARENTHESES_CLOSE", - /* 41 */ "values_list ::= values_list COMMA value_item", - /* 42 */ "values_list ::= value_item", - /* 43 */ "value_item ::= expr", - /* 44 */ "field_list ::= field_list COMMA field_item", - /* 45 */ "field_list ::= field_item", - /* 46 */ "field_item ::= IDENTIFIER", - /* 47 */ "update_statement ::= update_clause where_clause limit_clause", - /* 48 */ "update_clause ::= UPDATE associated_name SET update_item_list", - /* 49 */ "update_item_list ::= update_item_list COMMA update_item", - /* 50 */ "update_item_list ::= update_item", - /* 51 */ "update_item ::= qualified_name EQUALS new_value", - /* 52 */ "new_value ::= expr", - /* 53 */ "delete_statement ::= delete_clause where_clause limit_clause", - /* 54 */ "delete_clause ::= DELETE FROM associated_name", - /* 55 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER", - /* 56 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER", - /* 57 */ "associated_name ::= aliased_or_qualified_name", - /* 58 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH with_item", - /* 59 */ "associated_name ::= aliased_or_qualified_name AS IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 60 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 61 */ "associated_name ::= aliased_or_qualified_name IDENTIFIER WITH with_item", - /* 62 */ "associated_name ::= aliased_or_qualified_name WITH PARENTHESES_OPEN with_list PARENTHESES_CLOSE", - /* 63 */ "associated_name ::= aliased_or_qualified_name WITH with_item", - /* 64 */ "with_list ::= with_list COMMA with_item", - /* 65 */ "with_list ::= with_item", - /* 66 */ "with_item ::= IDENTIFIER", - /* 67 */ "aliased_or_qualified_name ::= qualified_name", - /* 68 */ "where_clause ::= WHERE expr", - /* 69 */ "where_clause ::=", - /* 70 */ "order_clause ::= ORDER BY order_list", - /* 71 */ "order_clause ::=", - /* 72 */ "order_list ::= order_list COMMA order_item", - /* 73 */ "order_list ::= order_item", - /* 74 */ "order_item ::= expr", - /* 75 */ "order_item ::= expr ASC", - /* 76 */ "order_item ::= expr DESC", - /* 77 */ "group_clause ::= GROUP BY group_list", - /* 78 */ "group_clause ::=", - /* 79 */ "group_list ::= group_list COMMA group_item", - /* 80 */ "group_list ::= group_item", - /* 81 */ "group_item ::= expr", - /* 82 */ "having_clause ::= HAVING expr", - /* 83 */ "having_clause ::=", - /* 84 */ "for_update_clause ::= FOR UPDATE", - /* 85 */ "for_update_clause ::=", - /* 86 */ "select_limit_clause ::= LIMIT integer_or_placeholder", - /* 87 */ "select_limit_clause ::= LIMIT integer_or_placeholder COMMA integer_or_placeholder", - /* 88 */ "select_limit_clause ::= LIMIT integer_or_placeholder OFFSET integer_or_placeholder", - /* 89 */ "select_limit_clause ::=", - /* 90 */ "limit_clause ::= LIMIT integer_or_placeholder", - /* 91 */ "limit_clause ::=", - /* 92 */ "integer_or_placeholder ::= INTEGER", - /* 93 */ "integer_or_placeholder ::= HINTEGER", - /* 94 */ "integer_or_placeholder ::= NPLACEHOLDER", - /* 95 */ "integer_or_placeholder ::= SPLACEHOLDER", - /* 96 */ "integer_or_placeholder ::= BPLACEHOLDER", - /* 97 */ "expr ::= MINUS expr", - /* 98 */ "expr ::= expr MINUS expr", - /* 99 */ "expr ::= expr PLUS expr", - /* 100 */ "expr ::= expr TIMES expr", - /* 101 */ "expr ::= expr DIVIDE expr", - /* 102 */ "expr ::= expr MOD expr", - /* 103 */ "expr ::= expr AND expr", - /* 104 */ "expr ::= expr OR expr", - /* 105 */ "expr ::= expr BITWISE_AND expr", - /* 106 */ "expr ::= expr BITWISE_OR expr", - /* 107 */ "expr ::= expr BITWISE_XOR expr", - /* 108 */ "expr ::= expr EQUALS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr LESS expr", - /* 111 */ "expr ::= expr GREATER expr", - /* 112 */ "expr ::= expr GREATEREQUAL expr", - /* 113 */ "expr ::= expr LESSEQUAL expr", - /* 114 */ "expr ::= expr LIKE expr", - /* 115 */ "expr ::= expr NOT LIKE expr", - /* 116 */ "expr ::= expr ILIKE expr", - /* 117 */ "expr ::= expr NOT ILIKE expr", - /* 118 */ "expr ::= expr IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 119 */ "expr ::= expr NOT IN PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 120 */ "expr ::= PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 121 */ "expr ::= expr IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 122 */ "expr ::= expr NOT IN PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 123 */ "expr ::= EXISTS PARENTHESES_OPEN select_statement PARENTHESES_CLOSE", - /* 124 */ "expr ::= expr AGAINST expr", - /* 125 */ "expr ::= CAST PARENTHESES_OPEN expr AS IDENTIFIER PARENTHESES_CLOSE", - /* 126 */ "expr ::= CONVERT PARENTHESES_OPEN expr USING IDENTIFIER PARENTHESES_CLOSE", - /* 127 */ "expr ::= CASE expr when_clauses END", - /* 128 */ "when_clauses ::= when_clauses when_clause", - /* 129 */ "when_clauses ::= when_clause", - /* 130 */ "when_clause ::= WHEN expr THEN expr", - /* 131 */ "when_clause ::= ELSE expr", - /* 132 */ "expr ::= function_call", - /* 133 */ "function_call ::= IDENTIFIER PARENTHESES_OPEN distinct_or_null argument_list_or_null PARENTHESES_CLOSE", - /* 134 */ "distinct_or_null ::= DISTINCT", - /* 135 */ "distinct_or_null ::=", - /* 136 */ "argument_list_or_null ::= argument_list", - /* 137 */ "argument_list_or_null ::=", - /* 138 */ "argument_list ::= argument_list COMMA argument_item", - /* 139 */ "argument_list ::= argument_item", - /* 140 */ "argument_item ::= TIMES", - /* 141 */ "argument_item ::= expr", - /* 142 */ "expr ::= expr IS NULL", - /* 143 */ "expr ::= expr IS NOT NULL", - /* 144 */ "expr ::= expr BETWEEN expr", - /* 145 */ "expr ::= NOT expr", - /* 146 */ "expr ::= BITWISE_NOT expr", - /* 147 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 148 */ "expr ::= qualified_name", - /* 149 */ "expr ::= INTEGER", - /* 150 */ "expr ::= HINTEGER", - /* 151 */ "expr ::= STRING", - /* 152 */ "expr ::= DOUBLE", - /* 153 */ "expr ::= NULL", - /* 154 */ "expr ::= TRUE", - /* 155 */ "expr ::= FALSE", - /* 156 */ "expr ::= NPLACEHOLDER", - /* 157 */ "expr ::= SPLACEHOLDER", - /* 158 */ "expr ::= BPLACEHOLDER", - /* 159 */ "qualified_name ::= IDENTIFIER DOT IDENTIFIER", - /* 160 */ "qualified_name ::= IDENTIFIER", -}; -#endif /* NDEBUG */ - -const char *phql_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *phql_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: -{ - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); +// 491 "scanner.c" +pp20: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp214; + default: goto pp101; + } +pp21: + ppch = *++PPCURSOR; + switch (ppch) { + case 'L': + case 'l': goto pp193; + case 'N': + case 'n': goto pp194; + case 'S': + case 's': goto pp196; + default: goto pp101; + } +pp22: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp187; + default: goto pp101; + } +pp23: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp176; + case 'I': + case 'i': goto pp177; + default: goto pp101; + } +pp24: + ppch = *++PPCURSOR; + switch (ppch) { + case 'F': + case 'f': goto pp157; + case 'N': + case 'n': goto pp158; + case 'R': + case 'r': goto pp160; + case 'U': + case 'u': goto pp162; + default: goto pp101; + } +pp25: + ppch = *++PPCURSOR; + switch (ppch) { + case 'R': + case 'r': goto pp152; + default: goto pp101; + } +pp26: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'a': goto pp146; + default: goto pp101; + } +pp27: + ppch = *++PPCURSOR; + switch (ppch) { + case 'E': + case 'e': goto pp134; + case 'I': + case 'i': goto pp135; + default: goto pp101; + } +pp28: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp127; + case 'U': + case 'u': goto pp128; + default: goto pp101; + } +pp29: + ppch = *++PPCURSOR; + switch (ppch) { + case 'O': + case 'o': goto pp123; + default: goto pp101; + } +pp30: + ppch = *++PPCURSOR; + switch (ppch) { + case 'I': + case 'i': goto pp118; + default: goto pp101; + } +pp31: + ppch = *++PPCURSOR; + switch (ppch) { + case 'H': + case 'h': goto pp110; + case 'R': + case 'r': goto pp111; + default: goto pp101; + } +pp32: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp108; +pp33: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + if (ppch <= 0x00) goto pp14; + goto pp103; +pp34: + ppch = *++PPCURSOR; + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp100; + default: goto pp14; + } +pp35: + ppch = *++PPCURSOR; + goto pp101; +pp36: + ppaccept = 1; + ppch = *(PPMARKER = ++PPCURSOR); + switch (ppch) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '\\': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto pp95; + default: goto pp14; + } +pp37: + ++PPCURSOR; +// 407 "scanner.re" + { + token->opcode = PHQL_T_ADD; + return 0; } - efree((yypminor->yy0)); - } -} - break; - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 88: - case 94: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 108: - case 109: - case 111: - case 112: - case 114: - case 115: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - case 87: - case 89: - case 90: - case 91: - case 92: - case 93: - case 105: - case 106: - case 113: - case 130: - case 131: -{ - zephir_safe_zval_ptr_dtor((yypminor->yy204)); -} - break; - case 116: - case 124: - case 126: - case 129: - case 132: -{ - zval_ptr_dtor(&(yypminor->yy204)); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -static void phql_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - phql_ARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 80, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 81, 1 }, - { 82, 7 }, - { 86, 6 }, - { 93, 1 }, - { 93, 1 }, - { 93, 0 }, - { 94, 3 }, - { 94, 1 }, - { 97, 1 }, - { 97, 3 }, - { 97, 3 }, - { 97, 2 }, - { 97, 1 }, - { 95, 3 }, - { 95, 1 }, - { 96, 1 }, - { 96, 0 }, - { 100, 2 }, - { 100, 1 }, - { 101, 1 }, - { 102, 4 }, - { 105, 2 }, - { 105, 1 }, - { 105, 0 }, - { 103, 2 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 3 }, - { 103, 2 }, - { 103, 1 }, - { 106, 2 }, - { 106, 0 }, - { 83, 7 }, - { 83, 10 }, - { 107, 3 }, - { 107, 1 }, - { 110, 1 }, - { 108, 3 }, - { 108, 1 }, - { 111, 1 }, - { 84, 3 }, - { 112, 4 }, - { 114, 3 }, - { 114, 1 }, - { 115, 3 }, - { 117, 1 }, - { 85, 3 }, - { 118, 3 }, - { 99, 3 }, - { 99, 2 }, - { 99, 1 }, - { 99, 5 }, - { 99, 7 }, - { 99, 6 }, - { 99, 4 }, - { 99, 5 }, - { 99, 3 }, - { 120, 3 }, - { 120, 1 }, - { 119, 1 }, - { 104, 1 }, - { 87, 2 }, - { 87, 0 }, - { 90, 3 }, - { 90, 0 }, - { 121, 3 }, - { 121, 1 }, - { 122, 1 }, - { 122, 2 }, - { 122, 2 }, - { 88, 3 }, - { 88, 0 }, - { 123, 3 }, - { 123, 1 }, - { 124, 1 }, - { 89, 2 }, - { 89, 0 }, - { 92, 2 }, - { 92, 0 }, - { 91, 2 }, - { 91, 4 }, - { 91, 4 }, - { 91, 0 }, - { 113, 2 }, - { 113, 0 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 125, 1 }, - { 98, 2 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 4 }, - { 98, 5 }, - { 98, 6 }, - { 98, 3 }, - { 98, 5 }, - { 98, 6 }, - { 98, 4 }, - { 98, 3 }, - { 98, 6 }, - { 98, 6 }, - { 98, 4 }, - { 127, 2 }, - { 127, 1 }, - { 128, 4 }, - { 128, 2 }, - { 98, 1 }, - { 129, 5 }, - { 130, 1 }, - { 130, 0 }, - { 131, 1 }, - { 131, 0 }, - { 126, 3 }, - { 126, 1 }, - { 132, 1 }, - { 132, 1 }, - { 98, 3 }, - { 98, 4 }, - { 98, 3 }, - { 98, 2 }, - { 98, 2 }, - { 98, 3 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 98, 1 }, - { 116, 3 }, - { 116, 1 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - phql_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ - case 0: -{ - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy204, 1, 1); -} - break; - case 1: - case 2: - case 3: - case 4: - case 18: - case 19: - case 22: - case 23: - case 43: - case 50: - case 52: - case 65: - case 67: - case 73: - case 80: - case 81: - case 132: - case 136: - case 141: - case 148: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; -} - break; - case 5: -{ - phql_ret_select_statement(&yygotominor.yy204, &yymsp[-6].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 6: -{ - phql_ret_select_clause(&yygotominor.yy204, &yymsp[-4].minor.yy204, &yymsp[-3].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(26,&yymsp[-5].minor); - yy_destructor(27,&yymsp[-2].minor); -} - break; - case 7: -{ - phql_ret_distinct_all(&yygotominor.yy204, 1); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 8: -{ - phql_ret_distinct_all(&yygotominor.yy204, 0); - yy_destructor(29,&yymsp[0].minor); -} - break; - case 9: - case 20: - case 27: - case 38: - case 69: - case 71: - case 78: - case 83: - case 85: - case 89: - case 91: - case 135: - case 137: -{ - ZVAL_UNDEF(&yygotominor.yy204); -} - break; - case 10: - case 17: - case 41: - case 44: - case 49: - case 64: - case 72: - case 79: - case 138: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 11: - case 42: - case 45: - case 129: - case 139: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); -} - break; - case 12: - case 140: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_STARALL, NULL, NULL, NULL); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 13: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_DOMAINALL, NULL, yymsp[-2].minor.yy0, NULL); - yy_destructor(31,&yymsp[-1].minor); - yy_destructor(17,&yymsp[0].minor); -} - break; - case 14: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-2].minor.yy204, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 15: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[-1].minor.yy204, NULL, yymsp[0].minor.yy0); -} - break; - case 16: -{ - phql_ret_column_item(&yygotominor.yy204, PHQL_T_EXPR, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 21: - case 128: -{ - phql_ret_zval_list(&yygotominor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 24: -{ - phql_ret_join_item(&yygotominor.yy204, &yymsp[-3].minor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 25: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 26: - case 46: - case 66: - case 160: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, NULL, yymsp[0].minor.yy0); -} - break; - case 28: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 29: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_CROSSJOIN); - yy_destructor(35,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 30: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 31: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_LEFTJOIN); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 32: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 33: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_RIGHTJOIN); - yy_destructor(38,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 34: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-2].minor); - yy_destructor(37,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 35: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_FULLJOIN); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 36: -{ - phql_ret_join_type(&yygotominor.yy204, PHQL_T_INNERJOIN); - yy_destructor(34,&yymsp[0].minor); -} - break; - case 37: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(40,&yymsp[-1].minor); -} - break; - case 39: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-6].minor); - yy_destructor(42,&yymsp[-5].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 40: -{ - phql_ret_insert_statement(&yygotominor.yy204, &yymsp[-7].minor.yy204, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(41,&yymsp[-9].minor); - yy_destructor(42,&yymsp[-8].minor); - yy_destructor(44,&yymsp[-6].minor); - yy_destructor(45,&yymsp[-4].minor); - yy_destructor(43,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 47: -{ - phql_ret_update_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 48: -{ - phql_ret_update_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(46,&yymsp[-3].minor); - yy_destructor(47,&yymsp[-1].minor); -} - break; - case 51: -{ - phql_ret_update_item(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 53: -{ - phql_ret_delete_statement(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204, &yymsp[0].minor.yy204); -} - break; - case 54: -{ - phql_ret_delete_clause(&yygotominor.yy204, &yymsp[0].minor.yy204); - yy_destructor(48,&yymsp[-2].minor); - yy_destructor(27,&yymsp[-1].minor); -} - break; - case 55: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, yymsp[0].minor.yy0, NULL); - yy_destructor(32,&yymsp[-1].minor); -} - break; - case 56: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-1].minor.yy204, yymsp[0].minor.yy0, NULL); -} - break; - case 57: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL, NULL); -} - break; - case 58: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 59: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-6].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(32,&yymsp[-5].minor); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 60: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-5].minor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 61: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-3].minor.yy204, yymsp[-2].minor.yy0, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 62: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-4].minor.yy204, NULL, &yymsp[-1].minor.yy204); - yy_destructor(49,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 63: -{ - phql_ret_assoc_name(&yygotominor.yy204, &yymsp[-2].minor.yy204, NULL, &yymsp[0].minor.yy204); - yy_destructor(49,&yymsp[-1].minor); -} - break; - case 68: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(50,&yymsp[-1].minor); -} - break; - case 70: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(51,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 74: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[0].minor.yy204, 0); -} - break; - case 75: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_ASC); - yy_destructor(53,&yymsp[0].minor); -} - break; - case 76: -{ - phql_ret_order_item(&yygotominor.yy204, &yymsp[-1].minor.yy204, PHQL_T_DESC); - yy_destructor(54,&yymsp[0].minor); -} - break; - case 77: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(55,&yymsp[-2].minor); - yy_destructor(52,&yymsp[-1].minor); -} - break; - case 82: -{ - yygotominor.yy204 = yymsp[0].minor.yy204; - yy_destructor(56,&yymsp[-1].minor); -} - break; - case 84: -{ - phql_ret_for_update_clause(&yygotominor.yy204); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); -} - break; - case 86: - case 90: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, NULL); - yy_destructor(58,&yymsp[-1].minor); -} - break; - case 87: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[0].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(25,&yymsp[-1].minor); -} - break; - case 88: -{ - phql_ret_limit_clause(&yygotominor.yy204, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(58,&yymsp[-3].minor); - yy_destructor(59,&yymsp[-1].minor); -} - break; - case 92: - case 149: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_INTEGER, yymsp[0].minor.yy0); -} - break; - case 93: - case 150: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_HINTEGER, yymsp[0].minor.yy0); -} - break; - case 94: - case 156: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_NPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 95: - case 157: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_SPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 96: - case 158: -{ - phql_ret_placeholder_zval(&yygotominor.yy204, PHQL_T_BPLACEHOLDER, yymsp[0].minor.yy0); -} - break; - case 97: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MINUS, NULL, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 98: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUB, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(20,&yymsp[-1].minor); -} - break; - case 99: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ADD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(19,&yymsp[-1].minor); -} - break; - case 100: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MUL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(17,&yymsp[-1].minor); -} - break; - case 101: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_DIV, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(16,&yymsp[-1].minor); -} - break; - case 102: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_MOD, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(18,&yymsp[-1].minor); -} - break; - case 103: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(9,&yymsp[-1].minor); -} - break; - case 104: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(10,&yymsp[-1].minor); -} - break; - case 105: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_AND, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(13,&yymsp[-1].minor); -} - break; - case 106: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_OR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(14,&yymsp[-1].minor); -} - break; - case 107: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_XOR, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(15,&yymsp[-1].minor); -} - break; - case 108: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(3,&yymsp[-1].minor); -} - break; - case 109: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTEQUALS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(4,&yymsp[-1].minor); -} - break; - case 110: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESS, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(5,&yymsp[-1].minor); -} - break; - case 111: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATER, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(6,&yymsp[-1].minor); -} - break; - case 112: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_GREATEREQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(7,&yymsp[-1].minor); -} - break; - case 113: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LESSEQUAL, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(8,&yymsp[-1].minor); -} - break; - case 114: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_LIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 115: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NLIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(11,&yymsp[-1].minor); -} - break; - case 116: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ILIKE, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 117: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NILIKE, &yymsp[-3].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-2].minor); - yy_destructor(12,&yymsp[-1].minor); -} - break; - case 118: - case 121: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_IN, &yymsp[-4].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 119: - case 122: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOTIN, &yymsp[-5].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(23,&yymsp[-4].minor); - yy_destructor(22,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 120: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_SUBQUERY, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 123: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_EXISTS, NULL, &yymsp[-1].minor.yy204); - yy_destructor(65,&yymsp[-3].minor); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 124: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_AGAINST, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(1,&yymsp[-1].minor); -} - break; - case 125: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CAST, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(66,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 126: -{ - { - zval qualified; - phql_ret_raw_qualified_name(&qualified, yymsp[-1].minor.yy0, NULL); - phql_ret_expr(&yygotominor.yy204, PHQL_T_CONVERT, &yymsp[-3].minor.yy204, &qualified); - } - yy_destructor(67,&yymsp[-5].minor); - yy_destructor(44,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 127: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_CASE, &yymsp[-2].minor.yy204, &yymsp[-1].minor.yy204); - yy_destructor(69,&yymsp[-3].minor); - yy_destructor(70,&yymsp[0].minor); -} - break; - case 130: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_WHEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(71,&yymsp[-3].minor); - yy_destructor(72,&yymsp[-1].minor); -} - break; - case 131: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ELSE, &yymsp[0].minor.yy204, NULL); - yy_destructor(73,&yymsp[-1].minor); -} - break; - case 133: -{ - phql_ret_func_call(&yygotominor.yy204, yymsp[-4].minor.yy0, &yymsp[-1].minor.yy204, &yymsp[-2].minor.yy204); - yy_destructor(44,&yymsp[-3].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 134: -{ - phql_ret_distinct(&yygotominor.yy204); - yy_destructor(28,&yymsp[0].minor); -} - break; - case 142: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNULL, &yymsp[-2].minor.yy204, NULL); - yy_destructor(21,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 143: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ISNOTNULL, &yymsp[-3].minor.yy204, NULL); - yy_destructor(21,&yymsp[-2].minor); - yy_destructor(23,&yymsp[-1].minor); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 144: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BETWEEN, &yymsp[-2].minor.yy204, &yymsp[0].minor.yy204); - yy_destructor(2,&yymsp[-1].minor); -} - break; - case 145: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(23,&yymsp[-1].minor); -} - break; - case 146: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_BITWISE_NOT, NULL, &yymsp[0].minor.yy204); - yy_destructor(24,&yymsp[-1].minor); -} - break; - case 147: -{ - phql_ret_expr(&yygotominor.yy204, PHQL_T_ENCLOSED, &yymsp[-1].minor.yy204, NULL); - yy_destructor(44,&yymsp[-2].minor); - yy_destructor(45,&yymsp[0].minor); -} - break; - case 151: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_STRING, yymsp[0].minor.yy0); -} - break; - case 152: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_DOUBLE, yymsp[0].minor.yy0); -} - break; - case 153: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_NULL, NULL); - yy_destructor(74,&yymsp[0].minor); -} - break; - case 154: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_TRUE, NULL); - yy_destructor(77,&yymsp[0].minor); -} - break; - case 155: -{ - phql_ret_literal_zval(&yygotominor.yy204, PHQL_T_FALSE, NULL); - yy_destructor(78,&yymsp[0].minor); -} - break; - case 159: -{ - phql_ret_qualified_name(&yygotominor.yy204, NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); - yy_destructor(31,&yymsp[-1].minor); -} - break; - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - phql_ARG_FETCH; -#define TOKEN (yyminor.yy0) - - if (status->scanner_state->start_length) { - { - - char *token_name = NULL; - int token_found = 0; - unsigned int token_length; - const phql_token_names *tokens = phql_tokens; - int active_token = status->scanner_state->active_token; - int near_length = status->scanner_state->start_length; - - if (active_token) { - - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_length = tokens->length; - token_found = 1; - break; - } - ++tokens; - } while (tokens[0].code != 0); - - } - - if (!token_name) { - token_length = strlen("UNKNOWN"); - token_name = estrndup("UNKNOWN", token_length); - token_found = 0; +// 732 "scanner.c" +pp39: + ++PPCURSOR; +// 412 "scanner.re" + { + token->opcode = PHQL_T_SUB; + return 0; + } +// 740 "scanner.c" +pp41: + ++PPCURSOR; +// 417 "scanner.re" + { + token->opcode = PHQL_T_MUL; + return 0; + } +// 748 "scanner.c" +pp43: + ++PPCURSOR; +// 422 "scanner.re" + { + token->opcode = PHQL_T_DIV; + return 0; + } +// 756 "scanner.c" +pp45: + ++PPCURSOR; +// 427 "scanner.re" + { + token->opcode = PHQL_T_MOD; + return 0; + } +// 764 "scanner.c" +pp47: + ++PPCURSOR; +// 442 "scanner.re" + { + token->opcode = PHQL_T_COMMA; + return 0; + } +// 772 "scanner.c" +pp49: + ++PPCURSOR; +// 447 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_OPEN; + return 0; + } +// 780 "scanner.c" +pp51: + ++PPCURSOR; +// 452 "scanner.re" + { + token->opcode = PHQL_T_PARENTHESES_CLOSE; + return 0; + } +// 788 "scanner.c" +pp53: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '!': goto pp91; + case '=': goto pp93; + default: goto pp54; } - - status->syntax_error_len = 96 + status->token->len + token_length + near_length + status->phql_length;; - status->syntax_error = emalloc(sizeof(char) * status->syntax_error_len); - - if (near_length > 0) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), near to '%s', when parsing: %s (%d)", token_name, status->token->value, status->scanner_state->start, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, near to '%s', when parsing: %s (%d)", token_name, status->scanner_state->start, status->phql, status->phql_length); - } - } else { - if (active_token != PHQL_T_IGNORE) { - if (status->token->value) { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s(%s), at the end of query, when parsing: %s (%d)", token_name, status->token->value, status->phql, status->phql_length); - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected token %s, at the end of query, when parsing: %s (%d)", token_name, status->phql, status->phql_length); - } - } else { - snprintf(status->syntax_error, status->syntax_error_len, "Syntax error, unexpected EOF, at the end of query"); - } - status->syntax_error[status->syntax_error_len - 1] = '\0'; +pp54: +// 522 "scanner.re" + { + token->opcode = PHQL_T_NOT; + return 0; + } +// 802 "scanner.c" +pp55: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp87; + case '>': goto pp89; + default: goto pp56; } - - if (!token_found) { - if (token_name) { - efree(token_name); - } +pp56: +// 477 "scanner.re" + { + token->opcode = PHQL_T_LESS; + return 0; + } +// 816 "scanner.c" +pp57: + ++PPCURSOR; + switch ((ppch = *PPCURSOR)) { + case '=': goto pp85; + default: goto pp58; } +pp58: +// 482 "scanner.re" + { + token->opcode = PHQL_T_GREATER; + return 0; } - } else { - status->syntax_error_len = strlen("Syntax error, unexpected EOF"); - status->syntax_error = estrndup("Syntax error, unexpected EOF", status->syntax_error_len); - } - - status->status = PHQL_PARSING_FAILED; - - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - phql_ARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phql_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phql_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phql_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phql_TOKENTYPE yyminor /* The value for the token */ - phql_ARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - phql_ARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -/* Generated by re2c 0.14.3 on Wed Jul 27 23:59:57 2016 */ -// 1 "scanner.re" - - -#ifdef HAVE_CONFIG_H -#endif - - - -#define PPCTYPE unsigned char -#define PPCURSOR (s->start) -#define PPLIMIT (s->end) -#define PPMARKER q - -static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { - - char *q = PPCURSOR; - int status = PHQL_SCANNER_RETCODE_IMPOSSIBLE; - - while (PHQL_SCANNER_RETCODE_IMPOSSIBLE == status) { - - -// 45 "scanner.c" - { - PPCTYPE ppch; - unsigned int ppaccept = 0; - - ppch = *PPCURSOR; - switch (ppch) { - case 0x00: goto pp72; - case '\t': - case '\n': - case '\r': - case ' ': goto pp70; - case '!': goto pp53; - case '"': goto pp32; - case '%': goto pp45; - case '&': goto pp64; - case '\'': goto pp33; - case '(': goto pp49; - case ')': goto pp51; - case '*': goto pp41; - case '+': goto pp37; - case ',': goto pp47; - case '-': goto pp39; - case '.': goto pp11; - case '/': goto pp43; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp2; - case ':': goto pp15; - case '<': goto pp55; - case '=': goto pp59; - case '>': goto pp57; - case '?': goto pp13; - case '@': goto pp61; - case 'A': - case 'a': goto pp4; - case 'B': - case 'b': goto pp5; - case 'C': - case 'c': goto pp6; - case 'D': - case 'd': goto pp7; - case 'E': - case 'e': goto pp8; - case 'F': - case 'f': goto pp9; - case 'G': - case 'g': goto pp25; - case 'H': - case 'h': goto pp26; - case 'I': - case 'i': goto pp21; - case 'J': - case 'j': goto pp29; - case 'K': - case 'M': - case 'P': - case 'Q': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'k': - case 'm': - case 'p': - case 'q': - case 'y': - case 'z': goto pp35; - case 'L': - case 'l': goto pp27; - case 'N': - case 'n': goto pp28; - case 'O': - case 'o': goto pp24; - case 'R': - case 'r': goto pp30; - case 'S': - case 's': goto pp20; - case 'T': - case 't': goto pp31; - case 'U': - case 'u': goto pp18; - case 'V': - case 'v': goto pp22; - case 'W': - case 'w': goto pp23; - case '[': goto pp36; - case '\\': goto pp34; - case '^': goto pp68; - case 'x': goto pp10; - case '{': goto pp17; - case '|': goto pp62; - case '~': goto pp66; - default: goto pp74; - } -pp2: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '.': goto pp340; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp342; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'x': goto pp344; - default: goto pp3; - } -pp3: -// 46 "scanner.re" - { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - if (token->len > 2 && !memcmp(token->value, "0x", 2)) { - token->opcode = PHQL_T_HINTEGER; - } else { - int i, alpha = 0; - for (i = 0; i < token->len; i++) { - unsigned char ch = token->value[i]; - if (!((ch >= '0') && (ch <= '9'))) { - alpha = 1; - break; - } - } - if (alpha) { - token->opcode = PHQL_T_IDENTIFIER; - } else { - token->opcode = PHQL_T_INTEGER; - } - } - q = PPCURSOR; - return 0; - } -// 201 "scanner.c" -pp4: - ppch = *++PPCURSOR; - switch (ppch) { - case 'G': - case 'g': goto pp323; - case 'L': - case 'l': goto pp324; - case 'N': - case 'n': goto pp325; - case 'S': - case 's': goto pp326; - default: goto pp248; - } -pp5: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp314; - case 'Y': - case 'y': goto pp315; - default: goto pp248; - } -pp6: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp296; - case 'O': - case 'o': goto pp297; - case 'R': - case 'r': goto pp298; - default: goto pp248; - } -pp7: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp279; - case 'I': - case 'i': goto pp280; - default: goto pp248; - } -pp8: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp265; - case 'N': - case 'n': goto pp266; - case 'X': goto pp267; - case 'x': goto pp268; - default: goto pp248; - } -pp9: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp249; - case 'O': - case 'o': goto pp250; - case 'R': - case 'r': goto pp251; - case 'U': - case 'u': goto pp252; - default: goto pp248; - } -pp10: - ppch = *++PPCURSOR; - goto pp248; -pp11: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp244; - default: goto pp12; - } -pp12: -// 432 "scanner.re" - { - token->opcode = PHQL_T_DOT; - return 0; - } -// 292 "scanner.c" -pp13: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto pp241; - default: goto pp14; - } -pp14: -// 557 "scanner.re" - { - status = PHQL_SCANNER_RETCODE_ERR; - break; - } -// 314 "scanner.c" -pp15: - ppaccept = 0; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp237; - default: goto pp16; - } -pp16: -// 437 "scanner.re" - { - token->opcode = PHQL_T_COLON; - return 0; - } -// 391 "scanner.c" -pp17: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case ':': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp233; - default: goto pp14; - } -pp18: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case 'P': - case 'p': goto pp222; - case 'S': - case 's': goto pp223; - default: goto pp101; - } -pp19: -// 380 "scanner.re" - { - token->opcode = PHQL_T_IDENTIFIER; - if ((PPCURSOR - q) > 1) { - if (q[0] == '\\') { - token->value = estrndup(q + 1, PPCURSOR - q - 1); - token->len = PPCURSOR - q - 1; - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - } else { - token->value = estrndup(q, PPCURSOR - q); - token->len = PPCURSOR - q; - } - q = PPCURSOR; - return 0; - } -// 491 "scanner.c" -pp20: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp214; - default: goto pp101; - } -pp21: - ppch = *++PPCURSOR; - switch (ppch) { - case 'L': - case 'l': goto pp193; - case 'N': - case 'n': goto pp194; - case 'S': - case 's': goto pp196; - default: goto pp101; - } -pp22: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp187; - default: goto pp101; - } -pp23: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp176; - case 'I': - case 'i': goto pp177; - default: goto pp101; - } -pp24: - ppch = *++PPCURSOR; - switch (ppch) { - case 'F': - case 'f': goto pp157; - case 'N': - case 'n': goto pp158; - case 'R': - case 'r': goto pp160; - case 'U': - case 'u': goto pp162; - default: goto pp101; - } -pp25: - ppch = *++PPCURSOR; - switch (ppch) { - case 'R': - case 'r': goto pp152; - default: goto pp101; - } -pp26: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'a': goto pp146; - default: goto pp101; - } -pp27: - ppch = *++PPCURSOR; - switch (ppch) { - case 'E': - case 'e': goto pp134; - case 'I': - case 'i': goto pp135; - default: goto pp101; - } -pp28: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp127; - case 'U': - case 'u': goto pp128; - default: goto pp101; - } -pp29: - ppch = *++PPCURSOR; - switch (ppch) { - case 'O': - case 'o': goto pp123; - default: goto pp101; - } -pp30: - ppch = *++PPCURSOR; - switch (ppch) { - case 'I': - case 'i': goto pp118; - default: goto pp101; - } -pp31: - ppch = *++PPCURSOR; - switch (ppch) { - case 'H': - case 'h': goto pp110; - case 'R': - case 'r': goto pp111; - default: goto pp101; - } -pp32: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp108; -pp33: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - if (ppch <= 0x00) goto pp14; - goto pp103; -pp34: - ppch = *++PPCURSOR; - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp100; - default: goto pp14; - } -pp35: - ppch = *++PPCURSOR; - goto pp101; -pp36: - ppaccept = 1; - ppch = *(PPMARKER = ++PPCURSOR); - switch (ppch) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '\\': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto pp95; - default: goto pp14; - } -pp37: - ++PPCURSOR; -// 407 "scanner.re" - { - token->opcode = PHQL_T_ADD; - return 0; - } -// 732 "scanner.c" -pp39: - ++PPCURSOR; -// 412 "scanner.re" - { - token->opcode = PHQL_T_SUB; - return 0; - } -// 740 "scanner.c" -pp41: - ++PPCURSOR; -// 417 "scanner.re" - { - token->opcode = PHQL_T_MUL; - return 0; - } -// 748 "scanner.c" -pp43: - ++PPCURSOR; -// 422 "scanner.re" - { - token->opcode = PHQL_T_DIV; - return 0; - } -// 756 "scanner.c" -pp45: - ++PPCURSOR; -// 427 "scanner.re" - { - token->opcode = PHQL_T_MOD; - return 0; - } -// 764 "scanner.c" -pp47: - ++PPCURSOR; -// 442 "scanner.re" - { - token->opcode = PHQL_T_COMMA; - return 0; - } -// 772 "scanner.c" -pp49: - ++PPCURSOR; -// 447 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_OPEN; - return 0; - } -// 780 "scanner.c" -pp51: - ++PPCURSOR; -// 452 "scanner.re" - { - token->opcode = PHQL_T_PARENTHESES_CLOSE; - return 0; - } -// 788 "scanner.c" -pp53: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '!': goto pp91; - case '=': goto pp93; - default: goto pp54; - } -pp54: -// 522 "scanner.re" - { - token->opcode = PHQL_T_NOT; - return 0; - } -// 802 "scanner.c" -pp55: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp87; - case '>': goto pp89; - default: goto pp56; - } -pp56: -// 477 "scanner.re" - { - token->opcode = PHQL_T_LESS; - return 0; - } -// 816 "scanner.c" -pp57: - ++PPCURSOR; - switch ((ppch = *PPCURSOR)) { - case '=': goto pp85; - default: goto pp58; - } -pp58: -// 482 "scanner.re" - { - token->opcode = PHQL_T_GREATER; - return 0; - } -// 829 "scanner.c" -pp59: - ++PPCURSOR; -// 487 "scanner.re" - { - token->opcode = PHQL_T_EQUALS; - return 0; - } -// 837 "scanner.c" -pp61: - ppch = *++PPCURSOR; +// 829 "scanner.c" +pp59: + ++PPCURSOR; +// 487 "scanner.re" + { + token->opcode = PHQL_T_EQUALS; + return 0; + } +// 837 "scanner.c" +pp61: + ppch = *++PPCURSOR; switch (ppch) { case '>': goto pp81; case '@': goto pp83; @@ -135362,21643 +117396,9483 @@ static int phql_get_token(phql_scanner_state *s, phql_scanner_token *token) { case 'x': goto pp344; default: goto pp3; } - } -// 562 "scanner.re" - - } - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { - - zval *success_param = NULL, *model = NULL; - zend_bool success; - - zephir_fetch_params(0, 1, 1, &success_param, &model); - - success = zephir_get_boolval(success_param); - if (!model) { - model = ZEPHIR_GLOBAL(global_null); - } - - - if (success) { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { - - - - RETURN_MEMBER(this_ptr, "_model"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { - - zval *model = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(model); - zephir_read_property_this(&model, this_ptr, SL("_model"), PH_NOISY_CC); - if (Z_TYPE_P(model) != IS_OBJECT) { - array_init(return_value); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(model, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { - - - - RETURN_MEMBER(this_ptr, "_success"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnTypes, *result = NULL, *cache = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); - - if (!result) { - result = ZEPHIR_GLOBAL(global_null); - } - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { - - zend_class_entry *_13$$15; - HashTable *_3, *_6$$11; - HashPosition _2, _5$$11; - zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; - zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; - int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); - RETURN_CCTOR(row); - } - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_INIT_NVAR(activeRow); - object_init_ex(activeRow, phalcon_mvc_model_row_ce); - if (zephir_has_constructor(activeRow TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); - zephir_check_call_status(); - } - break; - } - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - ZEPHIR_INIT_NVAR(activeRow); - array_init(activeRow); - break; - } - ZEPHIR_INIT_NVAR(activeRow); - object_init(activeRow); - break; - } while(0); - - dirtyState = 0; - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); - zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HMKEY(alias, _3, _2); - ZEPHIR_GET_HVALUE(column, _4); - if (Z_TYPE_P(column) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); - return; - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); - if (ZEPHIR_IS_STRING(type, "object")) { - ZEPHIR_OBS_NVAR(source); - zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); - ZEPHIR_OBS_NVAR(attributes); - zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); - ZEPHIR_OBS_NVAR(columnMap); - zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); - ZEPHIR_INIT_NVAR(rowModel); - array_init(rowModel); - zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); - for ( - ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) - ) { - ZEPHIR_GET_HVALUE(attribute, _7$$11); - ZEPHIR_OBS_NVAR(columnValue); - ZEPHIR_INIT_LNVAR(_8$$12); - ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); - zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); - zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); - } - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - ZEPHIR_OBS_NVAR(keepSnapshots); - if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(keepSnapshots); - ZVAL_BOOL(keepSnapshots, 0); - } - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_NVAR(_9$$15); - zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); - if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { - zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); - ZEPHIR_INIT_NVAR(modelName); - zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_12$$15); - ZVAL_LONG(_12$$15, dirtyState); - _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); - zephir_check_call_status(); - } else { - zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_16$$18); - ZVAL_LONG(_16$$18, dirtyState); - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - ZEPHIR_OBS_NVAR(attribute); - zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(sqlAlias); - if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { - ZEPHIR_OBS_NVAR(value); - zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(value); - zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); - } - if (zephir_array_isset_string(column, SS("balias"))) { - ZEPHIR_CPY_WRT(attribute, alias); - } else { - ZEPHIR_SINIT_NVAR(_18$$24); - ZVAL_STRING(&_18$$24, "_", 0); - ZEPHIR_SINIT_NVAR(_19$$24); - ZVAL_STRING(&_19$$24, "", 0); - ZEPHIR_INIT_NVAR(attribute); - zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); - } - } - if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { - do { - if (ZEPHIR_IS_LONG(hydrateMode, 1)) { - zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); - break; - } - zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); - break; - } while(0); - - } - } - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { - - zval *records = NULL, *current = NULL, *_0 = NULL; - zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(records); - array_init(records); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0))) { - break; - } - ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 373); - zephir_check_call_status(); - zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); - zephir_check_call_status(); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { - - zval *_0; - zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(cache); - zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnTypes); - zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 4, 0 TSRMLS_CC); - zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_CCTOR(serialized); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - if (1) { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_2); - ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); - zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); - - if (!cache) { - cache = ZEPHIR_GLOBAL(global_null); - } - if (!keepSnapshots) { - keepSnapshots = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 372, result, cache); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { - - zend_class_entry *_5$$6; - zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; - zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(activeRow); - zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); - if (Z_TYPE_P(activeRow) != IS_NULL) { - RETURN_CCTOR(activeRow); - } - ZEPHIR_OBS_VAR(row); - zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(row) != IS_ARRAY) { - if (0) { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(hydrateMode); - zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - do { - if (ZEPHIR_IS_LONG(hydrateMode, 0)) { - if (ZEPHIR_GLOBAL(orm).late_state_binding) { - ZEPHIR_OBS_VAR(_0$$6); - zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); - if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { - _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(modelName); - zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(modelName); - ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); - } - _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_4$$6); - ZVAL_LONG(_4$$6, 0); - _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); - zephir_check_call_status(); - } else { - _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); - _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_9$$9); - ZVAL_LONG(_9$$9, 0); - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 374, _7$$9, row, columnMap, _9$$9, _8$$9); - zephir_check_call_status(); - } - break; - } - ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 375, row, columnMap, hydrateMode); - zephir_check_call_status(); - break; - } while(0); - - zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); - RETURN_CCTOR(activeRow); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { - - HashTable *_2$$7, *_5$$8; - HashPosition _1$$7, _4$$8; - zephir_fcall_cache_entry *_9 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; - zend_bool renameColumns; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &renameColumns_param); - - if (!renameColumns_param) { - renameColumns = 1; - } else { - renameColumns = zephir_get_boolval(renameColumns_param); - } - - - ZEPHIR_OBS_VAR(records); - zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); - if (Z_TYPE_P(records) != IS_ARRAY) { - ZEPHIR_OBS_VAR(result); - zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); - if (Z_TYPE_P(_0$$3) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); - } - if (renameColumns) { - ZEPHIR_OBS_VAR(columnMap); - zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); - if (Z_TYPE_P(columnMap) != IS_ARRAY) { - RETURN_CCTOR(records); - } - ZEPHIR_INIT_VAR(renamedRecords); - array_init(renamedRecords); - if (Z_TYPE_P(records) == IS_ARRAY) { - zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); - for ( - ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) - ) { - ZEPHIR_GET_HVALUE(record, _3$$7); - ZEPHIR_INIT_NVAR(renamed); - array_init(renamed); - zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); - for ( - ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS - ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) - ) { - ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); - ZEPHIR_GET_HVALUE(value, _6$$8); - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(renamedKey) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(renamedKey); - if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_10$$12); - object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_11$$12); - ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); - } - zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); - } - } - RETURN_CCTOR(renamedRecords); - } - RETURN_CCTOR(records); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { - - zval *_1 = NULL, *_2 = NULL, *_3; - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 6, 0 TSRMLS_CC); - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(_3); - ZVAL_BOOL(_3, 0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); - zephir_check_call_status(); - zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); - zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; - zval *data = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - - if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(data, data_param); - } else { - ZEPHIR_INIT_VAR(data); - ZVAL_EMPTY_STRING(data); - } - - - ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); - zephir_check_call_status(); - if (Z_TYPE_P(resultset) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); - return; - } - zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); - zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); - zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_3); - ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); - zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); - zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); - zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); - zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); - zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, *record = NULL; - zval *message = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &record); - - if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(message_param) == IS_STRING)) { - zephir_get_strval(message, message_param); - } else { - ZEPHIR_INIT_VAR(message); - ZVAL_EMPTY_STRING(message); - } - if (!record) { - record = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { - - zval *record = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(record); - zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); - if (Z_TYPE_P(record) != IS_NULL) { - ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { - - - - RETURN_MEMBER(this_ptr, "_record"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); - zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *dependencyInjector = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &dependencyInjector); - - if (!dependencyInjector) { - ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(dependencyInjector); - } - - - if (!(zephir_is_true(dependencyInjector))) { - ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); - return; - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { - - zval *service_param = NULL; - zval *service = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &service_param); - - if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(service_param) == IS_STRING)) { - zephir_get_strval(service, service_param); - } else { - ZEPHIR_INIT_VAR(service); - ZVAL_EMPTY_STRING(service); - } - - - zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { - - - - RETURN_MEMBER(this_ptr, "_service"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { - - zval *rollbackPendent_param = NULL; - zend_bool rollbackPendent; - - zephir_fetch_params(0, 1, 0, &rollbackPendent_param); - - rollbackPendent = zephir_get_boolval(rollbackPendent_param); - - - if (rollbackPendent) { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { - - - - RETURN_MEMBER(this_ptr, "_rollbackPendent"); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { - - zval *_0; - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { - - zval *_2$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); - if (zephir_is_true(_1$$3)) { - ZEPHIR_INIT_VAR(_2$$4); - zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$4, this_ptr); - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "rollbackPendent", 1); - zephir_array_fast_append(_2$$4, _3$$4); - ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 378, _2$$4); - zephir_check_call_status(); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(_4); - if (autoBegin) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { - - HashTable *_2$$5; - HashPosition _1$$5; - int ZEPHIR_LAST_CALL_STATUS; - zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; - zend_bool autoBegin; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &autoBegin_param); - - if (!autoBegin_param) { - autoBegin = 1; - } else { - autoBegin = zephir_get_boolval(autoBegin_param); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); - if (zephir_is_true(_0)) { - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(transaction, _3$$5); - if (Z_TYPE_P(transaction) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_BOOL(_4$$7, 0); - ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); - zephir_check_call_status(); - RETURN_CCTOR(transaction); - } - } - } - } - ZEPHIR_INIT_NVAR(transaction); - object_init_ex(transaction, phalcon_mvc_model_transaction_ce); - _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_6); - if (autoBegin) { - ZVAL_BOOL(_6, 1); - } else { - ZVAL_BOOL(_6, 0); - } - ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 379, dependencyInjector, _6, _5); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 380, this_ptr); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); - RETURN_CCTOR(transaction); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { - - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { - - HashTable *_1$$3; - HashPosition _0$$3; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &collect); - - if (!collect) { - collect = ZEPHIR_GLOBAL(global_true); - } - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (Z_TYPE_P(transactions) == IS_ARRAY) { - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(transaction, _2$$3); - ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(_3$$4)) { - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); - zephir_check_call_status(); - } - if (zephir_is_true(collect)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); - zephir_check_call_status(); - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *transaction; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { - - HashTable *_1$$3; - HashPosition _0$$3; - zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &transaction); - - - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(newTransactions); - array_init(newTransactions); - zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); - if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { - zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); - } else { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - } - zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { - - HashTable *_2$$3; - HashPosition _1$$3; - zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(transactions); - zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); - if (zephir_fast_count_int(transactions TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_0$$3); - zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); - for ( - ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) - ) { - ZEPHIR_GET_HVALUE(_0$$3, _3$$3); - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); - } - zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 274); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { - - zval *_5$$7; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if (zephir_fast_in_array(value, domain TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_4$$7); - ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_4$$7); - zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_4$$7); - ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); - zephir_check_temp_parameter(_4$$7); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { - - zval *_8$$9; - zend_bool _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(domain) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(strict); - ZVAL_BOOL(strict, 0); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_4)) { - if (Z_TYPE_P(strict) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); - return; - } - ZEPHIR_INIT_VAR(_5$$7); - ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); - zephir_check_temp_parameter(_5$$7); - zephir_check_call_status(); - } - ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 381, value, domain, strict); - zephir_check_call_status(); - if (!(zephir_is_true(_6))) { - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); - } - ZEPHIR_INIT_VAR(_8$$9); - zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_7$$9); - zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); - zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_7$$9); - ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); - - zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { - - zval *_6, *_12$$5; - zend_bool _5; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_1); - ZVAL_LONG(_1, (1048576 | 2097152)); - ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_2)) { - ZEPHIR_INIT_VAR(allowPrivate); - ZVAL_LONG(allowPrivate, 0); - } else { - ZEPHIR_INIT_NVAR(allowPrivate); - ZVAL_LONG(allowPrivate, 8388608); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (zephir_is_true(_3)) { - ZEPHIR_INIT_VAR(allowReserved); - ZVAL_LONG(allowReserved, 0); - } else { - ZEPHIR_INIT_NVAR(allowReserved); - ZVAL_LONG(allowReserved, 4194304); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_NVAR(_1); - ZVAL_BOOL(_1, 0); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _5 = zephir_is_true(_4); - if (_5) { - _5 = ZEPHIR_IS_EMPTY(value); - } - if (_5) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_VAR(options); - zephir_create_array(options, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_6); - zephir_create_array(_6, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_VAR(_7); - zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); - ZEPHIR_INIT_VAR(_8); - zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); - zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); - ZEPHIR_SINIT_NVAR(_7); - ZVAL_LONG(&_7, 275); - ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); - zephir_check_call_status(); - if (!(zephir_is_true(_9))) { - ZEPHIR_INIT_VAR(_10$$5); - ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_INIT_VAR(_11$$5); - ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_temp_parameter(_11$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_12$$5); - zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$5); - ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); - zephir_check_temp_parameter(_10$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { - - zval *_4$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - if (!(zephir_is_numeric(value))) { - ZEPHIR_INIT_VAR(_3$$5); - ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field :field must be numeric", 1); - } - ZEPHIR_INIT_VAR(_4$$5); - zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$5); - ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); - zephir_check_temp_parameter(_3$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { - - zval *_4$$4; - zend_bool _1, _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - _1 = Z_TYPE_P(value) == IS_NULL; - if (!(_1)) { - _2 = Z_TYPE_P(value) == IS_STRING; - if (_2) { - _2 = !(zephir_fast_strlen_ev(value)); - } - _1 = _2; - } - if (_1) { - ZEPHIR_INIT_VAR(_3$$4); - ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "':field' is required", 1); - } - ZEPHIR_INIT_VAR(_4$$4); - zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_3$$4); - ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); - zephir_check_temp_parameter(_3$$4); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { - - zval *_6$$8; - zend_bool failed = 0, _3; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (!(zephir_is_true(_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - failed = 0; - ZEPHIR_INIT_VAR(matches); - ZVAL_NULL(matches); - ZEPHIR_INIT_NVAR(_0); - zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); - if (zephir_is_true(_0)) { - zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); - failed = !ZEPHIR_IS_EQUAL(_4$$6, value); - } else { - failed = 1; - } - if (failed == 1) { - ZEPHIR_INIT_VAR(_5$$8); - ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); - } - ZEPHIR_INIT_VAR(_6$$8); - zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$8); - ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); - zephir_check_temp_parameter(_5$$8); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { - - zval *_6$$9, *_11$$12; - zend_bool _1, _3; - zephir_fcall_cache_entry *_8 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); - return; - } - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _1 = !zephir_is_true(isSetMin); - if (_1) { - _1 = !zephir_is_true(isSetMax); - } - if (_1) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _3 = zephir_is_true(_2); - if (_3) { - _3 = ZEPHIR_IS_EMPTY(value); - } - if (_3) { - RETURN_MM_BOOL(1); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 382, value); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(length); - ZVAL_LONG(length, zephir_fast_strlen_ev(value)); - } - if (zephir_is_true(isSetMax)) { - ZEPHIR_INIT_VAR(_4$$8); - ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); - zephir_check_temp_parameter(_4$$8); - zephir_check_call_status(); - if (ZEPHIR_GT(length, maximum)) { - ZEPHIR_INIT_VAR(_5$$9); - ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); - } - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$9); - ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); - zephir_check_temp_parameter(_5$$9); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - if (zephir_is_true(isSetMin)) { - ZEPHIR_INIT_VAR(_9$$11); - ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); - zephir_check_temp_parameter(_9$$11); - zephir_check_call_status(); - if (ZEPHIR_LT(length, minimum)) { - ZEPHIR_INIT_VAR(_10$$12); - ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); - } - ZEPHIR_INIT_VAR(_11$$12); - zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_10$$12); - ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); - zephir_check_temp_parameter(_10$$12); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { - - HashTable *_2$$5, *_22$$16; - HashPosition _1$$5, _21$$16; - zend_class_entry *_33; - zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; - int ZEPHIR_LAST_CALL_STATUS, number = 0; - zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(bindTypes); - array_init(bindTypes); - ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); - zephir_check_call_status(); - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_INIT_VAR(conditions); - array_init(conditions); - ZEPHIR_INIT_VAR(bindParams); - array_init(bindParams); - number = 0; - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HVALUE(composeField, _3$$5); - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_4$$8); - object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_5$$8); - ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, composeField); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_7$$10); - object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); - zephir_check_call_status(); - zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_SINIT_NVAR(_9$$6); - ZVAL_LONG(&_9$$6, number); - ZEPHIR_INIT_LNVAR(_10$$6); - ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); - zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); - ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); - number++; - } - } else { - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(columnField); - if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_13$$13); - object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_14$$13); - ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(columnField, field); - } - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_15$$15); - object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(_16$$15); - ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(_17$$11); - ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); - zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); - ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); - number++; - } - ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(_19, 2)) { - if (ZEPHIR_GLOBAL(orm).column_renaming) { - ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(columnMap); - ZVAL_NULL(columnMap); - } - ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); - zephir_check_call_status(); - zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) - ) { - ZEPHIR_GET_HVALUE(primaryField, _23$$16); - ZEPHIR_OBS_NVAR(bindType); - if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_24$$20); - object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_25$$20); - ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); - zephir_check_call_status(); - zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(attributeField); - if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(_26$$22); - object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_LNVAR(_27$$22); - ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); - zephir_check_call_status(); - zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } else { - ZEPHIR_CPY_WRT(attributeField, primaryField); - } - ZEPHIR_SINIT_NVAR(_28$$19); - ZVAL_LONG(&_28$$19, number); - ZEPHIR_INIT_LNVAR(_29$$19); - ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); - zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); - ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); - zephir_check_call_status(); - zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); - zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); - number++; - } - } - ZEPHIR_INIT_VAR(params); - array_init(params); - zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_0); - zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); - zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); - zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(className); - zephir_get_class(className, record, 0 TSRMLS_CC); - _33 = zephir_fetch_class(className TSRMLS_CC); - ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); - zephir_check_call_status(); - if (!ZEPHIR_IS_LONG(_32, 0)) { - ZEPHIR_INIT_VAR(_34$$24); - ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(replacePairs); - if (Z_TYPE_P(field) == IS_ARRAY) { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_35$$25); - zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); - } - } else { - zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); - zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); - } - } - ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_34$$24); - ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); - zephir_check_temp_parameter(_34$$24); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { - - zval *_6$$5; - zend_bool _2; - int ZEPHIR_LAST_CALL_STATUS; - zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &record); - - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - if (Z_TYPE_P(field) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); - return; - } - ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_0); - ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - _2 = zephir_is_true(_1); - if (_2) { - _2 = ZEPHIR_IS_EMPTY(value); - } - if (_2) { - RETURN_MM_BOOL(1); - } - ZEPHIR_SINIT_VAR(_3); - ZVAL_LONG(&_3, 273); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); - zephir_check_call_status(); - if (!(zephir_is_true(_4))) { - ZEPHIR_INIT_VAR(_5$$5); - ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(message)) { - ZEPHIR_INIT_NVAR(message); - ZVAL_STRING(message, ":field does not have a valid url format", 1); - } - ZEPHIR_INIT_VAR(_6$$5); - zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); - zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(_5$$5); - ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); - zephir_check_temp_parameter(_5$$5); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - RETURN_MM_BOOL(1); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { - - zval *_0; - zval *handler_param = NULL, *prefix_param = NULL; - zval *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { - - zval *_0; - zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; - zval *module = NULL, *handler = NULL, *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - if (!prefix_param) { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } else { - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - } - - - ZEPHIR_INIT_VAR(_0); - zephir_create_array(_0, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_0, prefix); - zephir_array_fast_append(_0, handler); - zephir_array_fast_append(_0, module); - zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { - - zend_bool _5$$6; - HashTable *_3, *_9$$14, *_13$$16, *_17$$18; - HashPosition _2, _8$$14, _12$$16, _16$$18; - zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; - zval *uri = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &uri_param); - - if (!uri_param) { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } else { - if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { - zephir_get_strval(uri, uri_param); - } else { - ZEPHIR_INIT_VAR(uri); - ZVAL_EMPTY_STRING(uri); - } - } - - - if (!(!(!uri) && Z_STRLEN_P(uri))) { - ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(realUri, uri); - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _0); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); - return; - } - ZEPHIR_INIT_VAR(_1); - ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); - zephir_check_temp_parameter(_1); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(handlers); - zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(controllerSuffix); - zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); - zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); - for ( - ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS - ; zephir_hash_move_forward_ex(_3, &_2) - ) { - ZEPHIR_GET_HVALUE(scope, _4); - if (Z_TYPE_P(scope) != IS_ARRAY) { - continue; - } - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); - _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); - if (_5$$6) { - _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); - } - if (_5$$6) { - continue; - } - ZEPHIR_OBS_NVAR(handler); - zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); - if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { - ZEPHIR_INIT_NVAR(controllerName); - zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(namespaceName); - zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(controllerName, handler); - ZEPHIR_OBS_NVAR(namespaceName); - zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); - } - zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); - ZEPHIR_INIT_NVAR(sufixed); - ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); - if (Z_TYPE_P(namespaceName) != IS_NULL) { - ZEPHIR_INIT_LNVAR(_6$$11); - ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); - ZEPHIR_CPY_WRT(sufixed, _6$$11); - } - ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); - zephir_check_call_status(); - if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { - continue; - } - ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(annotations) == IS_ARRAY) { - zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); - for ( - ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS - ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) - ) { - ZEPHIR_GET_HVALUE(annotation, _10$$14); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); - zephir_check_call_status(); - } - } - } - ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(lowerControllerName); - zephir_uncamelize(lowerControllerName, controllerName, NULL ); - zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); - for ( - ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS - ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) - ) { - ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); - ZEPHIR_GET_HVALUE(collection, _14$$16); - if (Z_TYPE_P(collection) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); - for ( - ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS - ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) - ) { - ZEPHIR_GET_HVALUE(annotation, _18$$18); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); - zephir_check_call_status(); - } - } - } - } - } - ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 383, realUri); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; - zval *handler = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &handler_param, &annotation); - - if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { - zephir_get_strval(handler, handler_param); - } else { - ZEPHIR_INIT_VAR(handler); - ZVAL_EMPTY_STRING(handler); - } - - - ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { - ZEPHIR_INIT_VAR(_2$$3); - ZVAL_LONG(_2$$3, 0); - ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { - - HashTable *_7$$22, *_11$$24; - HashPosition _6$$22, _10$$24; - zend_bool isRoute = 0, _14$$9, _5$$20; - zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; - zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); - - if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(module_param) == IS_STRING)) { - zephir_get_strval(module, module_param); - } else { - ZEPHIR_INIT_VAR(module); - ZVAL_EMPTY_STRING(module); - } - if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { - zephir_get_strval(namespaceName, namespaceName_param); - } else { - ZEPHIR_INIT_VAR(namespaceName); - ZVAL_EMPTY_STRING(namespaceName); - } - if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { - zephir_get_strval(controller, controller_param); - } else { - ZEPHIR_INIT_VAR(controller); - ZVAL_EMPTY_STRING(controller); - } - if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(action_param) == IS_STRING)) { - zephir_get_strval(action, action_param); - } else { - ZEPHIR_INIT_VAR(action); - ZVAL_EMPTY_STRING(action); - } - - - isRoute = 0; - ZEPHIR_INIT_VAR(methods); - ZVAL_NULL(methods); - ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); - zephir_check_call_status(); - do { - if (ZEPHIR_IS_STRING(name, "Route")) { - isRoute = 1; - break; - } - if (ZEPHIR_IS_STRING(name, "Get")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "GET", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Post")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "POST", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Put")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "PUT", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Delete")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "DELETE", 1); - break; - } - if (ZEPHIR_IS_STRING(name, "Options")) { - isRoute = 1; - ZEPHIR_INIT_NVAR(methods); - ZVAL_STRING(methods, "OPTIONS", 1); - break; - } - } while(0); - - if (isRoute == 1) { - ZEPHIR_INIT_VAR(_0$$9); - _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); - ZEPHIR_SINIT_VAR(_2$$9); - ZVAL_STRING(&_2$$9, "", 0); - zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); - ZEPHIR_INIT_VAR(actionName); - zephir_fast_strtolower(actionName, _0$$9); - ZEPHIR_OBS_VAR(routePrefix); - zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_3$$9); - ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(paths) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(paths); - array_init(paths); - } - if (!(ZEPHIR_IS_EMPTY(module))) { - zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); - } - if (!(ZEPHIR_IS_EMPTY(namespaceName))) { - zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_LONG(_3$$9, 0); - ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(value) != IS_NULL) { - if (!ZEPHIR_IS_STRING(value, "/")) { - ZEPHIR_INIT_VAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, value); - } else { - if (Z_TYPE_P(routePrefix) != IS_NULL) { - ZEPHIR_CPY_WRT(uri, routePrefix); - } else { - ZEPHIR_CPY_WRT(uri, value); - } - } - } else { - ZEPHIR_INIT_NVAR(uri); - ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); - } - ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); - zephir_check_call_status(); - if (Z_TYPE_P(methods) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(_4$$20); - ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); - zephir_check_temp_parameter(_4$$20); - zephir_check_call_status(); - _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; - if (!(_5$$20)) { - _5$$20 = Z_TYPE_P(methods) == IS_STRING; - } - if (_5$$20) { - ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); - for ( - ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS - ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) - ) { - ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); - ZEPHIR_GET_HVALUE(convert, _8$$22); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(converts) == IS_ARRAY) { - zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); - for ( - ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS - ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) - ) { - ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); - ZEPHIR_GET_HVALUE(convert, _12$$24); - ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; - if (!(_14$$9)) { - _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; - } - if (_14$$9) { - ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(_3$$9); - ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); - zephir_check_temp_parameter(_3$$9); - zephir_check_call_status(); - if (Z_TYPE_P(routeName) == IS_STRING) { - ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); - zephir_check_call_status(); - } - RETURN_MM_BOOL(1); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { - - zval *controllerSuffix_param = NULL; - zval *controllerSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &controllerSuffix_param); - - if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { - zephir_get_strval(controllerSuffix, controllerSuffix_param); - } else { - ZEPHIR_INIT_VAR(controllerSuffix); - ZVAL_EMPTY_STRING(controllerSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { - - zval *actionSuffix_param = NULL; - zval *actionSuffix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &actionSuffix_param); - - if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { - zephir_get_strval(actionSuffix, actionSuffix_param); - } else { - ZEPHIR_INIT_VAR(actionSuffix); - ZVAL_EMPTY_STRING(actionSuffix); - } - - - zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { - - - - RETURN_MEMBER(this_ptr, "_handlers"); - -} - -zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { - - zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; - - ZEPHIR_MM_GROW(); - - { - zval *this_ptr = NULL; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); - if (Z_TYPE_P(_0) == IS_NULL) { - ZEPHIR_INIT_VAR(_1$$3); - array_init(_1$$3); - zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); - } - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); - if (Z_TYPE_P(_2) == IS_NULL) { - ZEPHIR_INIT_VAR(_3$$4); - array_init(_3$$4); - zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); - } - _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); - if (Z_TYPE_P(_4) == IS_NULL) { - ZEPHIR_INIT_VAR(_5$$5); - array_init(_5$$5); - zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJVAL_P(this_ptr); - } - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *paths = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - _0 = Z_TYPE_P(paths) == IS_ARRAY; - if (!(_0)) { - _0 = Z_TYPE_P(paths) == IS_STRING; - } - if (_0) { - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - } - if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - zephir_get_strval(hostname, hostname_param); - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - zephir_get_strval(prefix, prefix_param); - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { - - - - RETURN_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { - - zval *beforeMatch; - - zephir_fetch_params(0, 1, 0, &beforeMatch); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { - - zval *paths; - - zephir_fetch_params(0, 1, 0, &paths); - - - - zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { - - - - RETURN_MEMBER(this_ptr, "_routes"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_INIT_VAR(_0); - ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); - zephir_check_temp_parameter(_0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - - zval *_0; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(_0); - array_init(_0); - zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - - int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(defaultPaths); - zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); - if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(processedPaths, paths); - } - if (Z_TYPE_P(processedPaths) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedPaths); - zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); - } - } else { - ZEPHIR_CPY_WRT(mergedPaths, paths); - } - ZEPHIR_INIT_VAR(route); - object_init_ex(route, phalcon_mvc_router_route_ce); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_2); - ZEPHIR_CONCAT_VV(_2, _1, pattern); - ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 384, this_ptr); - zephir_check_call_status(); - RETURN_CCTOR(route); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); - - zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - if (!httpMethods) { - httpMethods = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - ZEPHIR_OBS_VAR(uniqueId); - zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); - if (Z_TYPE_P(uniqueId) == IS_NULL) { - ZEPHIR_INIT_NVAR(uniqueId); - ZVAL_LONG(uniqueId, 0); - } - ZEPHIR_CPY_WRT(routeId, uniqueId); - zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { - - zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { - ZEPHIR_INIT_VAR(idPattern); - ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); - if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { - ZEPHIR_INIT_VAR(_0$$4); - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_STRING(&_1$$4, "/:module", 0); - zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _0$$4); - } - if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { - ZEPHIR_INIT_VAR(_2$$5); - ZEPHIR_SINIT_VAR(_3$$5); - ZVAL_STRING(&_3$$5, "/:controller", 0); - zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _2$$5); - } - if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_SINIT_VAR(_5$$6); - ZVAL_STRING(&_5$$6, "/:namespace", 0); - zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _4$$6); - } - if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_SINIT_VAR(_7$$7); - ZVAL_STRING(&_7$$7, "/:action", 0); - zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); - zephir_get_strval(pattern, _6$$7); - } - if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { - ZEPHIR_INIT_VAR(_8$$8); - ZEPHIR_SINIT_VAR(_9$$8); - ZVAL_STRING(&_9$$8, "/:params", 0); - ZEPHIR_SINIT_VAR(_10$$8); - ZVAL_STRING(&_10$$8, "(/.*)*", 0); - zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); - zephir_get_strval(pattern, _8$$8); - } - if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_SINIT_VAR(_12$$9); - ZVAL_STRING(&_12$$9, "/:int", 0); - ZEPHIR_SINIT_VAR(_13$$9); - ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); - zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); - zephir_get_strval(pattern, _11$$9); - } - } - if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { - ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); - RETURN_MM(); - } - RETURN_CTOR(pattern); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { - - long _0, _5$$11, _26$$19; - zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; - int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; - char ch = 0, prevCh; - zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; - zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - - - prevCh = '\0'; - bracketCount = 0; - parenthesesCount = 0; - foundPattern = 0; - intermediate = 0; - numberMatches = 0; - if (zephir_fast_strlen_ev(pattern) <= 0) { - RETURN_MM_BOOL(0); - } - ZEPHIR_INIT_VAR(matches); - array_init(matches); - ZEPHIR_INIT_VAR(route); - ZVAL_EMPTY_STRING(route); - for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { - cursor = _0; - ch = ZEPHIR_STRING_OFFSET(pattern, _0); - if (parenthesesCount == 0) { - if (ch == '{') { - if (bracketCount == 0) { - marker = (cursor + 1); - intermediate = 0; - notValid = 0; - } - bracketCount++; - } else { - if (ch == '}') { - bracketCount--; - if (intermediate > 0) { - if (bracketCount == 0) { - numberMatches++; - ZEPHIR_INIT_NVAR(variable); - ZVAL_EMPTY_STRING(variable); - ZEPHIR_INIT_NVAR(regexp); - ZVAL_EMPTY_STRING(regexp); - ZEPHIR_SINIT_NVAR(_1$$11); - ZVAL_LONG(&_1$$11, marker); - ZEPHIR_SINIT_NVAR(_2$$11); - ZVAL_LONG(&_2$$11, (cursor - marker)); - ZEPHIR_INIT_NVAR(_3$$11); - zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); - zephir_get_strval(_4$$11, _3$$11); - ZEPHIR_CPY_WRT(item, _4$$11); - for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { - cursorVar = _5$$11; - ch = ZEPHIR_STRING_OFFSET(item, _5$$11); - if (ch == '\0') { - break; - } - _6$$12 = cursorVar == 0; - if (_6$$12) { - _7$$12 = ch >= 'a'; - if (_7$$12) { - _7$$12 = ch <= 'z'; - } - _8$$12 = _7$$12; - if (!(_8$$12)) { - _9$$12 = ch >= 'A'; - if (_9$$12) { - _9$$12 = ch <= 'Z'; - } - _8$$12 = _9$$12; - } - _6$$12 = !(_8$$12); - } - if (_6$$12) { - notValid = 1; - break; - } - _10$$12 = ch >= 'a'; - if (_10$$12) { - _10$$12 = ch <= 'z'; - } - _11$$12 = _10$$12; - if (!(_11$$12)) { - _12$$12 = ch >= 'A'; - if (_12$$12) { - _12$$12 = ch <= 'Z'; - } - _11$$12 = _12$$12; - } - _13$$12 = _11$$12; - if (!(_13$$12)) { - _14$$12 = ch >= '0'; - if (_14$$12) { - _14$$12 = ch <= '9'; - } - _13$$12 = _14$$12; - } - _15$$12 = _13$$12; - if (!(_15$$12)) { - _15$$12 = ch == '-'; - } - _16$$12 = _15$$12; - if (!(_16$$12)) { - _16$$12 = ch == '_'; - } - _17$$12 = _16$$12; - if (!(_17$$12)) { - _17$$12 = ch == ':'; - } - if (_17$$12) { - if (ch == ':') { - ZEPHIR_SINIT_NVAR(_18$$16); - ZVAL_LONG(&_18$$16, 0); - ZEPHIR_SINIT_NVAR(_19$$16); - ZVAL_LONG(&_19$$16, cursorVar); - ZEPHIR_INIT_NVAR(_20$$16); - zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); - zephir_get_strval(_21$$16, _20$$16); - ZEPHIR_CPY_WRT(variable, _21$$16); - ZEPHIR_SINIT_NVAR(_22$$16); - ZVAL_LONG(&_22$$16, (cursorVar + 1)); - ZEPHIR_INIT_NVAR(_23$$16); - zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_get_strval(_24$$16, _23$$16); - ZEPHIR_CPY_WRT(regexp, _24$$16); - break; - } - } else { - notValid = 1; - break; - } - } - if (!(notValid)) { - tmp = numberMatches; - _25$$18 = zephir_is_true(variable); - if (_25$$18) { - _25$$18 = zephir_is_true(regexp); - } - if (_25$$18) { - foundPattern = 0; - for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { - ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); - if (ch == '\0') { - break; - } - if (!(foundPattern)) { - if (ch == '(') { - foundPattern = 1; - } - } else { - if (ch == ')') { - foundPattern = 2; - break; - } - } - } - if (foundPattern != 2) { - ZEPHIR_INIT_LNVAR(_27$$26); - ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); - zephir_concat_self(&route, _27$$26 TSRMLS_CC); - } else { - zephir_concat_self(&route, regexp TSRMLS_CC); - } - ZEPHIR_INIT_NVAR(_28$$19); - ZVAL_LONG(_28$$19, tmp); - zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); - ZEPHIR_INIT_NVAR(_29$$28); - ZVAL_LONG(_29$$28, tmp); - zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_LNVAR(_30$$29); - ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); - zephir_concat_self(&route, _30$$29 TSRMLS_CC); - } - continue; - } - } - } - } - } - if (bracketCount == 0) { - if (ch == '(') { - parenthesesCount++; - } else { - if (ch == ')') { - parenthesesCount--; - if (parenthesesCount == 0) { - numberMatches++; - } - } - } - } - if (bracketCount > 0) { - intermediate++; - } else { - _31$$36 = parenthesesCount == 0; - if (_31$$36) { - _31$$36 = prevCh != '\\'; - } - if (_31$$36) { - _32$$37 = ch == '.'; - if (!(_32$$37)) { - _32$$37 = ch == '+'; - } - _33$$37 = _32$$37; - if (!(_33$$37)) { - _33$$37 = ch == '|'; - } - _34$$37 = _33$$37; - if (!(_34$$37)) { - _34$$37 = ch == '#'; - } - if (_34$$37) { - zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); - } - } - zephir_concat_self_char(&route, ch TSRMLS_CC); - prevCh = ch; - } - } - zephir_create_array(return_value, 2, 0 TSRMLS_CC); - zephir_array_fast_append(return_value, route); - zephir_array_fast_append(return_value, matches); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; - zval *pattern = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - - if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(pattern); - ZVAL_EMPTY_STRING(pattern); - } - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); - zephir_check_call_status(); - if (!(zephir_start_with_str(pattern, SL("#")))) { - if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { - ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(pcrePattern); - zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); - ZEPHIR_INIT_VAR(_0$$4); - zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); - zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); - ZEPHIR_CPY_WRT(routePaths, _0$$4); - } else { - ZEPHIR_CPY_WRT(pcrePattern, pattern); - } - ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(compiledPattern, pattern); - } - zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { - - int _0$$4; - zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &paths); - - if (!paths) { - paths = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(paths) != IS_NULL) { - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_INIT_VAR(moduleName); - ZVAL_NULL(moduleName); - ZEPHIR_INIT_VAR(controllerName); - ZVAL_NULL(controllerName); - ZEPHIR_INIT_VAR(actionName); - ZVAL_NULL(actionName); - ZEPHIR_INIT_VAR(parts); - zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); - do { - _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); - if (_0$$4 == 3) { - ZEPHIR_OBS_NVAR(moduleName); - zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); - break; - } - if (_0$$4 == 2) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); - ZEPHIR_OBS_NVAR(actionName); - zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); - break; - } - if (_0$$4 == 1) { - ZEPHIR_OBS_NVAR(controllerName); - zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); - break; - } - } while(0); - - ZEPHIR_INIT_VAR(routePaths); - array_init(routePaths); - if (Z_TYPE_P(moduleName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(controllerName) != IS_NULL) { - if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { - ZEPHIR_INIT_VAR(realClassName); - zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(namespaceName); - zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); - if (zephir_is_true(namespaceName)) { - zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(realClassName, controllerName); - } - ZEPHIR_INIT_VAR(_1$$9); - zephir_uncamelize(_1$$9, realClassName, NULL ); - zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(actionName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(routePaths, paths); - } - } else { - ZEPHIR_INIT_NVAR(routePaths); - array_init(routePaths); - } - if (Z_TYPE_P(routePaths) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); - return; - } - RETURN_CCTOR(routePaths); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { - - - - RETURN_MEMBER(this_ptr, "_name"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { - - zval *name_param = NULL; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - zephir_get_strval(name, name_param); - - - zephir_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { - - - - RETURN_MEMBER(this_ptr, "_beforeMatch"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { - - zval *callback; - - zephir_fetch_params(0, 1, 0, &callback); - - - - zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { - - - - RETURN_MEMBER(this_ptr, "_match"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { - - - - RETURN_MEMBER(this_ptr, "_id"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { - - - - RETURN_MEMBER(this_ptr, "_pattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { - - - - RETURN_MEMBER(this_ptr, "_compiledPattern"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { - - - - RETURN_MEMBER(this_ptr, "_paths"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { - - HashTable *_2; - HashPosition _1; - zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(reversed); - array_init(reversed); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); - zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HMKEY(path, _2, _1); - ZEPHIR_GET_HVALUE(position, _3); - zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); - } - RETURN_CCTOR(reversed); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { - - zval *httpMethods; - - zephir_fetch_params(0, 1, 0, &httpMethods); - - - - zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { - - - - RETURN_MEMBER(this_ptr, "_methods"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { - - zval *hostname_param = NULL; - zval *hostname = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &hostname_param); - - if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { - zephir_get_strval(hostname, hostname_param); - } else { - ZEPHIR_INIT_VAR(hostname); - ZVAL_EMPTY_STRING(hostname); - } - - - zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { - - - - RETURN_MEMBER(this_ptr, "_hostname"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { - - zval *group; - - zephir_fetch_params(0, 1, 0, &group); - - - - zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { - - - - RETURN_MEMBER(this_ptr, "_group"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { - - zval *name_param = NULL, *converter; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &converter); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { - - - - RETURN_MEMBER(this_ptr, "_converters"); - -} - -static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { - - - - zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - - -#ifdef HAVE_CONFIG_H -#endif - - - -#if PHP_VERSION_ID < 70000 -#else -#endif - - -static void phalcon_get_uri(zval *return_value, zval *path) -{ - int i, found = 0, mark = 0; - char *cursor, *str, ch; - - if (Z_TYPE_P(path) != IS_STRING) { - RETURN_EMPTY_STRING(); - } - - if (Z_STRLEN_P(path) > 0) { - cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; - for (i = Z_STRLEN_P(path); i > 0; i--) { - ch = *cursor; - if (ch == '/' || ch == '\\') { - found++; - if (found == 1) { - mark = i - 1; - } else { - str = emalloc(mark - i + 1); - memcpy(str, Z_STRVAL_P(path) + i, mark - i); - str[mark - i] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, str, mark - i, 0); -#else - ZVAL_STRINGL(return_value, str, mark - i); -#endif - return; - } - } - cursor--; - } - } - - RETURN_EMPTY_STRING(); -} - -zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) -{ - unsigned int length = 0, variable_length, ch, j; - char *item = NULL, *cursor_var, *variable = NULL; - int not_valid = 0; -#if PHP_VERSION_ID < 70000 - int result = FAILURE; - zval **zv, **tmp; -#else - zval *zv, *tmp; -#endif - - if (named) { - length = cursor - marker - 1; - item = estrndup(marker + 1, length); - cursor_var = item; - marker = item; - for (j = 0; j < length; j++) { - ch = *cursor_var; - if (ch == '\0') { - not_valid = 1; - break; - } - if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ - not_valid = 1; - break; - } - if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { - if (ch == ':') { - variable_length = cursor_var - marker; - variable = estrndup(marker, variable_length); - break; - } - } else { - not_valid = 1; - break; - } - cursor_var++; - } - } - - if (!not_valid) { - - if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { - if (named) { - if (variable) { - efree(item); - item = variable; - length = variable_length; - } -#if PHP_VERSION_ID < 70000 - if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { - efree(item); - (*position)++; - return *zv; - } - } -#else - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { - if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { - efree(item); - (*position)++; - return zv; - } - } -#endif - } else { -#if PHP_VERSION_ID < 70000 - if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { - if (Z_TYPE_PP(zv) == IS_STRING) { - if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { - if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { - (*position)++; - return *tmp; - } - } - } - } -#else - if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { - if (Z_TYPE_P(zv) == IS_STRING) { - if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { - if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { - (*position)++; - return tmp; - } - } - } - } -#endif - } - } - - (*position)++; - } - - if (item) { - efree(item); - } - - return NULL; -} - -static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) -{ - - char *cursor, *marker = NULL; - unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; - unsigned char ch; - smart_str route_str = {0}; - ulong position = 1; - int i; - zval *replace, replace_copy; - int use_copy, looking_placeholder = 0; - - if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { - ZVAL_NULL(return_value); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); - return; - } - - if (Z_STRLEN_P(pattern) <= 0) { - ZVAL_FALSE(return_value); - return; - } - - cursor = Z_STRVAL_P(pattern); - if (*cursor == '/') { - ++cursor; - i = 1; - } - else { - i = 0; - } - - if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { -#if PHP_VERSION_ID < 70000 - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); -#else - ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); -#endif - return; - } - - for (; i < Z_STRLEN_P(pattern); ++i) { - - ch = *cursor; - if (ch == '\0') { - break; - } - - if (parentheses_count == 0 && !looking_placeholder) { - if (ch == '{') { - if (bracket_count == 0) { - marker = cursor; - intermediate = 0; - } - bracket_count++; - } else { - if (ch == '}') { - bracket_count--; - if (intermediate > 0) { - if (bracket_count == 0) { - replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && !looking_placeholder) { - if (ch == '(') { - if (parentheses_count == 0) { - marker = cursor; - intermediate = 0; - } - parentheses_count++; - } else { - if (ch == ')') { - parentheses_count--; - if (intermediate > 0) { - if (parentheses_count == 0) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - cursor++; - continue; - } - } - } - } - } - - if (bracket_count == 0 && parentheses_count == 0) { - if (looking_placeholder) { - if (intermediate > 0) { - if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { - replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); - if (replace) { - use_copy = 0; - if (Z_TYPE_P(replace) != IS_STRING) { -#if PHP_VERSION_ID < 70000 - zend_make_printable_zval(replace, &replace_copy, &use_copy); -#else - use_copy = zend_make_printable_zval(replace, &replace_copy); -#endif - if (use_copy) { - replace = &replace_copy; - } - } - smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); - if (use_copy) { - zval_dtor(&replace_copy); - } - } - looking_placeholder = 0; - continue; - } - } - } else { - if (ch == ':') { - looking_placeholder = 1; - marker = cursor; - intermediate = 0; - } - } - } - - if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { - intermediate++; - } else { - smart_str_appendc(&route_str, ch); - } - - cursor++; - } - smart_str_0(&route_str); - -#if PHP_VERSION_ID < 70000 - if (route_str.len) { - RETURN_STRINGL(route_str.c, route_str.len, 0); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#else - if (route_str.s) { - RETURN_STR(route_str.s); - } else { - smart_str_free(&route_str); - RETURN_EMPTY_STRING(); - } -#endif -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { - - zval *view, *dependencyInjector = NULL; - - zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); - - if (!dependencyInjector) { - dependencyInjector = ZEPHIR_GLOBAL(global_null); - } - - - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { - - zval *_0; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *_0; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { - - - - RETURN_MEMBER(this_ptr, "_view"); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); - - return SUCCESS; - -} - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); - -ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { - - - - RETURN_MEMBER(this_ptr, "_registeredEngines"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &options_param); - - if (!options_param) { - ZEPHIR_INIT_VAR(options); - array_init(options); - } else { - zephir_get_arrval(options, options_param); - } - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { - - zval *viewsDir_param = NULL; - zval *viewsDir = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewsDir_param); - - if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { - zephir_get_strval(viewsDir, viewsDir_param); - } else { - ZEPHIR_INIT_VAR(viewsDir); - ZVAL_EMPTY_STRING(viewsDir); - } - - - zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { - - - - RETURN_MEMBER(this_ptr, "_viewsDir"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { - - zval *engines_param = NULL; - zval *engines = NULL; - - zephir_fetch_params(0, 1, 0, &engines_param); - - engines = engines_param; - - - zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { - - HashTable *_2$$5; - HashPosition _1$$5; - zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_INIT_NVAR(engines); - array_init(engines); - ZEPHIR_OBS_VAR(registeredEngines); - zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); - if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 386, this_ptr, dependencyInjector); - zephir_check_call_status(); - zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); - } else { - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); - return; - } - ZEPHIR_INIT_VAR(arguments); - zephir_create_array(arguments, 2, 0 TSRMLS_CC); - zephir_array_fast_append(arguments, this_ptr); - zephir_array_fast_append(arguments, dependencyInjector); - zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); - for ( - ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) - ) { - ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); - ZEPHIR_GET_HVALUE(engineService, _3$$5); - if (Z_TYPE_P(engineService) == IS_OBJECT) { - if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_NVAR(engineObject); - ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(engineObject, engineService); - } - } else { - if (Z_TYPE_P(engineService) == IS_STRING) { - ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_5$$13); - object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_LNVAR(_6$$13); - ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); - ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); - } - } - zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); - } else { - ZEPHIR_OBS_NVAR(engines); - zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); - } - RETURN_CCTOR(engines); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { - - HashTable *_4; - HashPosition _3; - zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; - zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - - - ZEPHIR_OBS_VAR(eventsManager); - zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_1$$4); - ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { - RETURN_MM_NULL(); - } - } - notExists = 1; - mustClean = 1; - _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(viewsDirPath); - ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); - ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); - for ( - ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS - ; zephir_hash_move_forward_ex(_4, &_3) - ) { - ZEPHIR_GET_HMKEY(extension, _4, _3); - ZEPHIR_GET_HVALUE(engine, _5); - ZEPHIR_INIT_LNVAR(_6$$6); - ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); - if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); - } else { - _7$$8 = zephir_is_true(extension); - if (_7$$8) { - ZEPHIR_SINIT_NVAR(_8$$8); - ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); - ZEPHIR_INIT_NVAR(_9$$8); - zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); - _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); - } - _10$$8 = _7$$8; - if (_10$$8) { - _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); - } - if (_10$$8) { - ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); - } else { - ZEPHIR_INIT_NVAR(viewEnginePath); - ZVAL_STRING(viewEnginePath, "", 1); - } - } - if (zephir_is_true(viewEnginePath)) { - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_12$$12); - ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); - zephir_check_temp_parameter(_12$$12); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { - continue; - } - } - ZEPHIR_INIT_NVAR(_14$$11); - if (mustClean) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); - zephir_check_call_status(); - notExists = 0; - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(_15$$14); - ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); - zephir_check_temp_parameter(_15$$14); - zephir_check_call_status(); - } - break; - } - } - if (notExists == 1) { - ZEPHIR_INIT_VAR(_17$$15); - object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_18$$15); - ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); - ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(_19$$16); - ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); - zephir_check_temp_parameter(_19$$16); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { - - zend_bool _3$$12; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &path_param, ¶ms); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { - ZEPHIR_INIT_VAR(key); - ZVAL_NULL(key); - ZEPHIR_INIT_VAR(lifetime); - ZVAL_NULL(lifetime); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(key); - zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); - } - if (Z_TYPE_P(key) == IS_NULL) { - ZEPHIR_INIT_NVAR(key); - zephir_md5(key, path); - } - ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); - zephir_check_call_status(); - if (Z_TYPE_P(content) != IS_NULL) { - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_CCTOR(content); - } - } - } - ZEPHIR_INIT_VAR(_1); - zephir_create_symbol_table(TSRMLS_C); - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(params) == IS_ARRAY) { - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - } else { - ZEPHIR_CPY_WRT(mergedParams, viewParams); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, path, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(cache) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_2$$12); - if (_3$$12) { - ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); - zephir_check_call_status(); - _3$$12 = zephir_is_true(_4$$12); - } - if (_3$$12) { - ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - RETURN_MM_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; - zval *partialPath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); - - if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { - zephir_get_strval(partialPath, partialPath_param); - } else { - ZEPHIR_INIT_VAR(partialPath); - ZVAL_EMPTY_STRING(partialPath); - } - if (!params) { - params = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - ZEPHIR_OBS_VAR(viewParams); - zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (Z_TYPE_P(viewParams) == IS_ARRAY) { - ZEPHIR_INIT_VAR(mergedParams); - zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_INIT_VAR(_0$$3); - zephir_create_symbol_table(TSRMLS_C); - - } else { - ZEPHIR_CPY_WRT(mergedParams, params); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 406, partialPath, mergedParams); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); - } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); - zephir_check_call_status(); - _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); - zend_print_zval(_1, 0); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - - zephir_get_arrval(options, options_param); - - - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { - - - - RETURN_MEMBER(this_ptr, "_cacheOptions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { - - zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); - return; - } - ZEPHIR_INIT_VAR(cacheService); - ZVAL_STRING(cacheService, "viewCache", 1); - ZEPHIR_OBS_VAR(cacheOptions); - zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); - if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { - if (zephir_array_isset_string(cacheOptions, SS("service"))) { - ZEPHIR_OBS_NVAR(cacheService); - zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); - } - } - ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(viewCache, _0); - if (Z_TYPE_P(viewCache) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); - return; - } - RETURN_CCTOR(viewCache); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { - - zend_bool _1; - zval *_0, *_2, *_3$$3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = zephir_is_true(_0); - if (_1) { - ZEPHIR_OBS_VAR(_2); - zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); - _1 = Z_TYPE_P(_2) != IS_OBJECT; - } - if (_1) { - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); - } - RETURN_MM_MEMBER(this_ptr, "_cache"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { - - zval *options = NULL; - - zephir_fetch_params(0, 0, 1, &options); - - if (!options) { - options = ZEPHIR_GLOBAL(global_true); - } - - - if (Z_TYPE_P(options) == IS_ARRAY) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); - } else { - if (zephir_is_true(options)) { - if (1) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } else { - if (0) { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - } - } - RETURN_THISW(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { - - zend_bool merge, _0; - zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; - zval *params = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); - - params = params_param; - if (!merge_param) { - merge = 1; - } else { - merge = zephir_get_boolval(merge_param); - } - - - _0 = merge; - if (_0) { - ZEPHIR_OBS_VAR(_1); - zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); - _0 = Z_TYPE_P(_1) == IS_ARRAY; - } - if (_0) { - ZEPHIR_INIT_VAR(_2$$3); - _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); - } - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { - - - - RETURN_MEMBER(this_ptr, "_viewParams"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { - - zval *content_param = NULL; - zval *content = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &content_param); - - if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(content_param) == IS_STRING)) { - zephir_get_strval(content, content_param); - } else { - ZEPHIR_INIT_VAR(content); - ZVAL_EMPTY_STRING(content); - } - - - zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { - - - - RETURN_MEMBER(this_ptr, "_content"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { - - - - RETURN_MEMBER(this_ptr, "_activeRenderPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { - - zval *key_param = NULL, *value; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { - - zval *key_param = NULL, *value = NULL, *_0; - zval *key = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(key, key_param); - } else { - ZEPHIR_INIT_VAR(key); - ZVAL_EMPTY_STRING(key); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean == 1) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean == 1) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { - - zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(compiler); - zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); - if (Z_TYPE_P(compiler) != IS_OBJECT) { - ZEPHIR_INIT_NVAR(compiler); - object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); - _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 389, _0$$3); - zephir_check_call_status(); - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); - if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 390, dependencyInjector); - zephir_check_call_status(); - } - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 391, options); - zephir_check_call_status(); - } - zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); - } - RETURN_CCTOR(compiler); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool mustClean; - zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!mustClean_param) { - mustClean = 0; - } else { - mustClean = zephir_get_boolval(mustClean_param); - } - - - if (mustClean) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 388); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(params) == IS_ARRAY) { - zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); - ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CPY_WRT(_3$$5, value); - if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { - return; - } - } - } - if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { - RETURN_MM_NULL(); - } - if (mustClean) { - _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); - ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { - - zend_bool _0; - int ZEPHIR_LAST_CALL_STATUS; - zval *item; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); - - - - _0 = Z_TYPE_P(item) == IS_OBJECT; - if (!(_0)) { - _0 = Z_TYPE_P(item) == IS_ARRAY; - } - if (_0) { - RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); - } - if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 382, item); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_MM_LONG(zephir_fast_strlen_ev(item)); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &needle, &haystack); - - - - if (Z_TYPE_P(haystack) == IS_ARRAY) { - RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); - } - if (Z_TYPE_P(haystack) == IS_STRING) { - if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 392, haystack, needle); - zephir_check_call_status(); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); - } - ZEPHIR_INIT_VAR(_1$$4); - zephir_fast_strpos(_1$$4, haystack, needle, 0 ); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { - - zend_bool _0, _1; - int ZEPHIR_LAST_CALL_STATUS; - zval *text_param = NULL, *from_param = NULL, *to_param = NULL; - zval *text = NULL, *from = NULL, *to = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); - - zephir_get_strval(text, text_param); - if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(from_param) == IS_STRING)) { - zephir_get_strval(from, from_param); - } else { - ZEPHIR_INIT_VAR(from); - ZVAL_EMPTY_STRING(from); - } - if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(to_param) == IS_STRING)) { - zephir_get_strval(to, to_param); - } else { - ZEPHIR_INIT_VAR(to); - ZVAL_EMPTY_STRING(to); - } - - - _0 = ZEPHIR_IS_STRING(from, "latin1"); - if (!(_0)) { - _0 = ZEPHIR_IS_STRING(to, "utf8"); - } - if (_0) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 393, text); - zephir_check_call_status(); - RETURN_MM(); - } - _1 = ZEPHIR_IS_STRING(to, "latin1"); - if (!(_1)) { - _1 = ZEPHIR_IS_STRING(from, "utf8"); - } - if (_1) { - ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 394, text); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 395, from, to, text); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { - - zend_bool _1$$5; - zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; - int start, ZEPHIR_LAST_CALL_STATUS, position = 0; - zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &value, &start_param, &end); - - if (!start_param) { - start = 0; - } else { - start = zephir_get_intval(start_param); - } - if (!end) { - ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); - } else { - ZEPHIR_SEPARATE_PARAM(end); - } - - - if (Z_TYPE_P(value) == IS_OBJECT) { - if (Z_TYPE_P(end) == IS_NULL) { - ZEPHIR_INIT_NVAR(end); - ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); - } - position = 0; - ZEPHIR_INIT_VAR(slice); - array_init(slice); - ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(_0$$3))) { - break; - } - _1$$5 = position >= start; - if (_1$$5) { - _1$$5 = ZEPHIR_GE_LONG(end, position); - } - if (_1$$5) { - ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); - zephir_check_call_status(); - zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); - } - ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); - zephir_check_call_status(); - position++; - } - RETURN_CCTOR(slice); - } - ZEPHIR_INIT_VAR(length); - if (Z_TYPE_P(end) != IS_NULL) { - ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); - } else { - ZVAL_NULL(length); - } - if (Z_TYPE_P(value) == IS_ARRAY) { - ZEPHIR_SINIT_VAR(_5$$9); - ZVAL_LONG(&_5$$9, start); - ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 396, value, &_5$$9, length); - zephir_check_call_status(); - RETURN_MM(); - } - if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_6$$11); - ZVAL_LONG(&_6$$11, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_6$$11, length); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_8$$10); - ZVAL_LONG(&_8$$10, start); - ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 397, value, &_8$$10); - zephir_check_call_status(); - RETURN_MM(); - } - if (Z_TYPE_P(length) != IS_NULL) { - ZEPHIR_SINIT_VAR(_9$$12); - ZVAL_LONG(&_9$$12, start); - zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); - RETURN_MM(); - } - ZEPHIR_SINIT_VAR(_10); - ZVAL_LONG(&_10, start); - zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *value_param = NULL; - zval *value = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value_param); - - zephir_get_arrval(value, value_param); - - - ZEPHIR_MAKE_REF(value); - ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 398, value); - ZEPHIR_UNREF(value); - zephir_check_call_status(); - RETURN_CTOR(value); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *arguments = NULL; - zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; - zval *name = NULL, *_2$$3; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments_param) { - ZEPHIR_INIT_VAR(arguments); - array_init(arguments); - } else { - zephir_get_arrval(arguments, arguments_param); - } - - - ZEPHIR_OBS_VAR(macro); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { - ZEPHIR_INIT_VAR(_1$$3); - object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); - ZEPHIR_INIT_VAR(_2$$3); - ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 399, macro, arguments); - zephir_check_call_status(); - RETURN_MM(); - -} - - - - - -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; - -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); -} - -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} - -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ - - phvolt_parser_token *pToken; - - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; - - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - - token->value = NULL; - token->len = 0; -} - -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ - - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); - - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; - - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} - -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ - - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; - -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); - } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); - } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); - } - - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); -} - -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif - - ZVAL_NULL(result); - -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif - - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; - } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; - } - - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; - } - - return 1; -} - -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { - - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; - - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } - - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; - } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; - } - - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; - - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; - - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; - - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; - - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); - } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; - } - } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); - } else { - efree(token.value); - } - break; - - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; - - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; - - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; - - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; - - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; - - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; - - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; - - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; - - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; - - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; - - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; - - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; - - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; - - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; - - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; - - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; - - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; - - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; - - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; - } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; - } - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } - - state->end = state->start; - } - - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); -#endif - efree(parser_status->syntax_error); - } - } - - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - - efree(parser_status); - efree(state); - - return status; -} - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { - - zval *view = NULL; - - zephir_fetch_params(0, 0, 1, &view); - - if (!view) { - view = ZEPHIR_GLOBAL(global_null); - } - - - if (Z_TYPE_P(view) == IS_OBJECT) { - zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); - } - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { - - zval *dependencyInjector; - - zephir_fetch_params(0, 1, 0, &dependencyInjector); - - - - zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { - - - - RETURN_MEMBER(this_ptr, "_dependencyInjector"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { - - zval *options_param = NULL; - zval *options = NULL; - - zephir_fetch_params(0, 1, 0, &options_param); - - options = options_param; - - - zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { - - zval *option_param = NULL, *value; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &option_param, &value); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { - - zval *option_param = NULL, *value = NULL, *_0; - zval *option = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &option_param); - - if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(option_param) == IS_STRING)) { - zephir_get_strval(option, option_param); - } else { - ZEPHIR_INIT_VAR(option); - ZVAL_EMPTY_STRING(option); - } - - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { - RETURN_CTOR(value); - } - RETURN_MM_NULL(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { - - - - RETURN_MEMBER(this_ptr, "_options"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { - - zval *_3$$6 = NULL, *_4$$7 = NULL; - HashTable *_1$$3; - HashPosition _0$$3; - int ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &arguments); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - if (!arguments) { - arguments = ZEPHIR_GLOBAL(global_null); - } - - - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); - for ( - ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) - ) { - ZEPHIR_GET_HVALUE(extension, _2$$3); - if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { - if (Z_TYPE_P(arguments) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_3$$6); - zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$6, extension); - zephir_array_fast_append(_3$$6, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(_4$$7); - zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_4$$7, extension); - zephir_array_fast_append(_4$$7, name); - ZEPHIR_INIT_NVAR(status); - ZEPHIR_CALL_USER_FUNC(status, _4$$7); - zephir_check_call_status(); - } - if (Z_TYPE_P(status) == IS_STRING) { - RETURN_CCTOR(status); - } - } - } - } - ZEPHIR_MM_RESTORE(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *extension; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &extension); - - - - if (Z_TYPE_P(extension) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); - return; - } - if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); - zephir_check_call_status(); - } - zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { - - - - RETURN_MEMBER(this_ptr, "_extensions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { - - - - RETURN_MEMBER(this_ptr, "_functions"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { - - zval *name_param = NULL, *definition; - zval *name = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - - if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(name, name_param); - } else { - ZEPHIR_INIT_VAR(name); - ZVAL_EMPTY_STRING(name); - } - - - zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { - - - - RETURN_MEMBER(this_ptr, "_filters"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { - - zval *prefix_param = NULL; - zval *prefix = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &prefix_param); - - if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(prefix); - ZVAL_EMPTY_STRING(prefix); - } - - - zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); - RETURN_THIS(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { - - zval *_7$$5; - zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; - int ZEPHIR_LAST_CALL_STATUS; - - ZEPHIR_MM_GROW(); - - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - if (!(zephir_is_true(_0))) { - ZEPHIR_INIT_VAR(_1$$3); - _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); - zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(_3); - zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_3) == IS_OBJECT) { - ZEPHIR_OBS_VAR(_4$$4); - zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_5$$5); - _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(_7$$5); - zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_7$$5, this_ptr); - ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); - } - } - ZEPHIR_OBS_VAR(_8); - zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); - if (Z_TYPE_P(_8) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); - return; - } - RETURN_MM_MEMBER(this_ptr, "_prefix"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { - - zend_bool _3$$5, _8$$8; - zephir_fcall_cache_entry *_7 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; - zval *expr = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - ZEPHIR_OBS_VAR(left); - zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); - zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 265)) { - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); - if (ZEPHIR_IS_STRING(variable, "loop")) { - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); - zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); - } else { - ZEPHIR_OBS_VAR(dependencyInjector); - zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; - if (_3$$5) { - ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); - zephir_check_call_status(); - _3$$5 = zephir_is_true(_4$$5); - } - if (_3$$5) { - ZEPHIR_INIT_VAR(_5$$6); - ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); - zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_6$$7); - ZEPHIR_CONCAT_SV(_6$$7, "$", variable); - zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); - } - } - } else { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(leftType); - zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); - _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); - if (_8$$8) { - _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); - } - if (_8$$8) { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } else { - zephir_concat_self(&exprCode, leftCode TSRMLS_CC); - } - } - zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); - ZEPHIR_OBS_VAR(right); - zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); - zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_9, 265)) { - zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); - zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); - } else { - ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); - } - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { - - zend_bool _8$$5; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; - zval *expr = NULL, *_1$$6, *_3$$12; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(arguments); - ZVAL_STRING(arguments, "", 1); - } - ZEPHIR_OBS_VAR(nameExpr); - zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - ZEPHIR_OBS_VAR(nameType); - zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); - if (ZEPHIR_IS_LONG(nameType, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_1$$6); - zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_1$$6, name); - zephir_array_fast_append(_1$$6, arguments); - zephir_array_fast_append(_1$$6, funcArguments); - ZEPHIR_INIT_VAR(_2$$6); - ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _2$$6, _1$$6); - zephir_check_temp_parameter(_2$$6); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(functions); - zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); - if (Z_TYPE_P(functions) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_3$$12); - zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_3$$12, arguments); - zephir_array_fast_append(_3$$12, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_4$$9); - object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); - zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$9); - ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); - ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); - if (!(_8$$5)) { - _8$$5 = ZEPHIR_IS_STRING(name, "content"); - } - if (_8$$5) { - RETURN_MM_STRING("$this->getContent()", 1); - } - if (ZEPHIR_IS_STRING(name, "partial")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "super")) { - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { - ZEPHIR_OBS_VAR(currentBlock); - zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(block); - if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { - ZEPHIR_OBS_VAR(exprLevel); - zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 402, block); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, code); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, code TSRMLS_CC); - } - } else { - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - ZEPHIR_CPY_WRT(escapedCode, block); - } else { - ZEPHIR_INIT_NVAR(escapedCode); - zephir_addslashes(escapedCode, block TSRMLS_CC); - } - } - if (ZEPHIR_IS_LONG(exprLevel, 1)) { - RETURN_CCTOR(escapedCode); - } - ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); - RETURN_MM(); - } - } - RETURN_MM_STRING("''", 1); - } - ZEPHIR_INIT_VAR(_9$$5); - zephir_camelize(_9$$5, name, NULL ); - ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(className); - ZVAL_STRING(className, "Phalcon\\Tag", 1); - if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { - ZEPHIR_OBS_VAR(arrayHelpers); - zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); - if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(arrayHelpers); - zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); - zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); - } - if (zephir_array_isset(arrayHelpers, name)) { - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "static_url")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "date")) { - ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "time")) { - RETURN_MM_STRING("time()", 1); - } - if (ZEPHIR_IS_STRING(name, "dump")) { - ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "version")) { - RETURN_MM_STRING("Phalcon\\Version::get()", 1); - } - if (ZEPHIR_IS_STRING(name, "version_id")) { - RETURN_MM_STRING("Phalcon\\Version::getId()", 1); - } - if (ZEPHIR_IS_STRING(name, "constant")) { - ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 400, nameExpr); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { - - zephir_fcall_cache_entry *_2 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; - zval *test = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &test_param, &left_param); - - test = test_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); - if (ZEPHIR_IS_STRING(name, "empty")) { - ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "even")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "odd")) { - ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "numeric")) { - ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "scalar")) { - ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "iterable")) { - ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); - RETURN_MM(); - } - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_OBS_VAR(testName); - zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { - if (ZEPHIR_IS_STRING(name, "divisibleby")) { - zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 400, _1$$12); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sameas")) { - zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 400, _4$$13); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "type")) { - zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 400, _6$$14); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); - RETURN_MM(); - } - } - } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 400, test); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { - - zend_bool _13, _14, _15; - int ZEPHIR_LAST_CALL_STATUS; - zval *left = NULL; - zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; - zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &filter_param, &left_param); - - filter = filter_param; - zephir_get_strval(left, left_param); - - - ZEPHIR_INIT_VAR(code); - ZVAL_NULL(code); - ZEPHIR_OBS_VAR(type); - zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); - if (ZEPHIR_IS_LONG(type, 265)) { - ZEPHIR_OBS_VAR(name); - zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); - } else { - if (!ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_INIT_VAR(_0$$5); - object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); - ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_VAR(functionName); - zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); - ZEPHIR_OBS_NVAR(name); - zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(funcArguments); - ZVAL_NULL(funcArguments); - ZEPHIR_INIT_VAR(arguments); - ZVAL_NULL(arguments); - ZEPHIR_OBS_NVAR(funcArguments); - if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { - if (!ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_OBS_VAR(file); - zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_OBS_VAR(line); - zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); - ZEPHIR_INIT_VAR(_4$$7); - zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$7); - zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); - add_assoc_long_ex(_5$$7, SS("type"), 364); - zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); - ZEPHIR_MAKE_REF(funcArguments); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, funcArguments, _4$$7); - ZEPHIR_UNREF(funcArguments); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 400, funcArguments); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(arguments, left); - } - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_VAR(_6$$9); - zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_6$$9, name); - zephir_array_fast_append(_6$$9, arguments); - zephir_array_fast_append(_6$$9, funcArguments); - ZEPHIR_INIT_VAR(_7$$9); - ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 401, _7$$9, _6$$9); - zephir_check_temp_parameter(_7$$9); - zephir_check_call_status(); - if (Z_TYPE_P(code) == IS_STRING) { - RETURN_CCTOR(code); - } - } - ZEPHIR_OBS_VAR(filters); - zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); - if (Z_TYPE_P(filters) == IS_ARRAY) { - ZEPHIR_OBS_VAR(definition); - if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { - if (Z_TYPE_P(definition) == IS_STRING) { - ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(definition) == IS_OBJECT) { - if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_8$$15); - zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); - zephir_array_fast_append(_8$$15, arguments); - zephir_array_fast_append(_8$$15, funcArguments); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); - zephir_check_call_status(); - RETURN_MM(); - } - } - ZEPHIR_INIT_VAR(_9$$12); - object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); - zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$12); - ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); - ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - if (ZEPHIR_IS_STRING(name, "length")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); - RETURN_MM(); - } - _13 = ZEPHIR_IS_STRING(name, "e"); - if (!(_13)) { - _13 = ZEPHIR_IS_STRING(name, "escape"); - } - if (_13) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_css")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_js")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "escape_attr")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "trim")) { - ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "left_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "right_trim")) { - ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "striptags")) { - ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "url_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slashes")) { - ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "stripslashes")) { - ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "nl2br")) { - ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "keys")) { - ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "join")) { - ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); - RETURN_MM(); - } - _14 = ZEPHIR_IS_STRING(name, "lower"); - if (!(_14)) { - _14 = ZEPHIR_IS_STRING(name, "lowercase"); - } - if (_14) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); - RETURN_MM(); - } - _15 = ZEPHIR_IS_STRING(name, "upper"); - if (!(_15)) { - _15 = ZEPHIR_IS_STRING(name, "uppercase"); - } - if (_15) { - ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "capitalize")) { - ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "sort")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_encode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "json_decode")) { - ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "format")) { - ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "abs")) { - ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "slice")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "default")) { - ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(name, "convert_encoding")) { - ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_16); - object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_INIT_VAR(_19); - ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); - ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); - zephir_check_call_status(); - zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { - - HashTable *_4$$6; - HashPosition _3$$6; - zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; - zval *expr = NULL, *_0$$4 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); - - expr = expr_param; - - - ZEPHIR_INIT_VAR(exprCode); - ZVAL_NULL(exprCode); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - while (1) { - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_0$$4); - zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_0$$4, expr); - ZEPHIR_INIT_NVAR(_1$$4); - ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 401, _1$$4, _0$$4); - zephir_check_temp_parameter(_1$$4); - zephir_check_call_status(); - if (Z_TYPE_P(exprCode) == IS_STRING) { - break; - } - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { - ZEPHIR_INIT_NVAR(items); - array_init(items); - zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); - for ( - ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) - ) { - ZEPHIR_GET_HVALUE(singleExpr, _5$$6); - zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 400, _6$$7); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(name); - if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_LNVAR(_8$$8); - ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); - zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); - } else { - zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); - } - } - ZEPHIR_INIT_NVAR(exprCode); - zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, '.')) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(left); - if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 400, left); - zephir_check_call_status(); - } - if (ZEPHIR_IS_LONG(type, 311)) { - zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 124)) { - zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 404, _12$$13, leftCode); - zephir_check_call_status(); - break; - } - ZEPHIR_OBS_NVAR(right); - if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 400, right); - zephir_check_call_status(); - } - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_NULL(exprCode); - do { - if (ZEPHIR_IS_LONG(type, '!')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '*')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '+')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '-')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '/')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 37)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, '<')) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 61)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 62)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 126)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 278)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 360)) { - ZEPHIR_INIT_NVAR(exprCode); - if (zephir_array_isset_string(expr, SS("left"))) { - ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); - } else { - ZVAL_STRING(exprCode, "[]", 1); - } - break; - } - if (ZEPHIR_IS_LONG(type, 258)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 259)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 260)) { - ZEPHIR_INIT_NVAR(_14$$31); - zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); - ZEPHIR_SINIT_NVAR(_16$$31); - ZVAL_STRING(&_16$$31, "'", 0); - ZEPHIR_SINIT_NVAR(_17$$31); - ZVAL_STRING(&_17$$31, "\\'", 0); - zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); - break; - } - if (ZEPHIR_IS_LONG(type, 261)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "null", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 262)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "false", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 263)) { - ZEPHIR_INIT_NVAR(exprCode); - ZVAL_STRING(exprCode, "true", 1); - break; - } - if (ZEPHIR_IS_LONG(type, 265)) { - zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); - break; - } - if (ZEPHIR_IS_LONG(type, 266)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 267)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 270)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 271)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 272)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 273)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 274)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 275)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 276)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 350)) { - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(type, 356)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 361)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); - break; - } - if (ZEPHIR_IS_LONG(type, 365)) { - ZEPHIR_OBS_NVAR(start); - if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 400, start); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(startCode); - ZVAL_STRING(startCode, "null", 1); - } - ZEPHIR_OBS_NVAR(end); - if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 400, end); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(endCode); - ZVAL_STRING(endCode, "null", 1); - } - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 362)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 363)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 392)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 386)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 393)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 387)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 394)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 388)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); - break; - } - if (ZEPHIR_IS_LONG(type, 395)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 389)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 396)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 390)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 397)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 391)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); - break; - } - if (ZEPHIR_IS_LONG(type, 309)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 367)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 366)) { - zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 400, _21$$69); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); - break; - } - if (ZEPHIR_IS_LONG(type, 368)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 369)) { - ZEPHIR_INIT_NVAR(exprCode); - ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); - break; - } - if (ZEPHIR_IS_LONG(type, 364)) { - ZEPHIR_OBS_NVAR(exprCode); - zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); - break; - } - ZEPHIR_INIT_NVAR(_22$$73); - object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_25$$73); - ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); - ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); - zephir_check_call_status(); - zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - break; - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); - RETURN_CCTOR(exprCode); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { - - HashTable *_1$$4; - HashPosition _0$$4; - zend_bool isStatementList = 0; - int ZEPHIR_LAST_CALL_STATUS; - zval *statements, *statement = NULL, **_2$$4; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statements); - - - - if (Z_TYPE_P(statements) != IS_ARRAY) { - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - } - isStatementList = 1; - if (!(zephir_array_isset_string(statements, SS("type")))) { - zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(statement, _2$$4); - if (Z_TYPE_P(statement) != IS_ARRAY) { - isStatementList = 0; - break; - } - } - } - if (isStatementList == 1) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 405, statements); - zephir_check_call_status(); - RETURN_MM(); - } - RETVAL_ZVAL(statements, 1, 0); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { - - HashTable *_2$$4; - HashPosition _1$$4; - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_array_isset_string(statement, SS("expr")))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "", 1); - ZEPHIR_INIT_VAR(forElse); - ZVAL_NULL(forElse); - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(level); - zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(prefixLevel); - ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); - ZEPHIR_OBS_VAR(expr); - zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(blockStatements); - zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); - ZEPHIR_INIT_NVAR(forElse); - ZVAL_BOOL(forElse, 0); - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); - for ( - ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) - ) { - ZEPHIR_GET_HVALUE(bstatement, _3$$4); - if (Z_TYPE_P(bstatement) != IS_ARRAY) { - break; - } - ZEPHIR_OBS_NVAR(type); - if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_INIT_LNVAR(_4$$8); - ZEPHIR_CONCAT_SVS(_4$$8, ""); - zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); - ZEPHIR_CPY_WRT(forElse, prefixLevel); - zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); - break; - } - } - } - ZEPHIR_INIT_VAR(_5); - if (extendsMode) { - ZVAL_BOOL(_5, 1); - } else { - ZVAL_BOOL(_5, 0); - } - ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 405, blockStatements, _5); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(loopContext); - zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_6$$9); - ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); - zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_10$$9); - ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); - zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_11$$9); - ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); - zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12$$9); - ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); - zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_13$$9); - ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); - zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(_14$$9); - ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); - zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); - ZEPHIR_INIT_VAR(iterator); - ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); - } else { - ZEPHIR_CPY_WRT(iterator, exprCode); - } - ZEPHIR_OBS_VAR(variable); - zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); - ZEPHIR_OBS_VAR(key); - if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_15$$11); - ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); - zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_16$$12); - ZEPHIR_CONCAT_SVSVS(_16$$12, ""); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); - } - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_19$$15); - ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); - zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_20$$15); - ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); - zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_21$$15); - ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_22$$15); - ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); - zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_23$$15); - ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - ZEPHIR_INIT_VAR(_24$$15); - ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); - zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - ZEPHIR_INIT_VAR(_25$$16); - ZEPHIR_CONCAT_SVS(_25$$16, ""); - zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); - } - zephir_concat_self(&compilation, code TSRMLS_CC); - if (zephir_array_isset_string(statement, SS("if_expr"))) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - if (Z_TYPE_P(forElse) == IS_STRING) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } else { - if (zephir_array_isset(loopContext, level)) { - ZEPHIR_INIT_VAR(_26$$20); - ZEPHIR_CONCAT_SVS(_26$$20, ""); - zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); - } else { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { - - zval *level = NULL, *prefix = NULL, *_0, *_1$$3; - - - level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); - if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { - _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); - if (zephir_array_isset(_1$$3, level)) { - ZEPHIR_CONCAT_SVSVS(return_value, ""); - return; - } - ZEPHIR_CONCAT_SVS(return_value, ""); - return; - } - RETURN_STRING("", 1); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { - - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); - ZEPHIR_INIT_VAR(_3); - if (extendsMode) { - ZVAL_BOOL(_3, 1); - } else { - ZVAL_BOOL(_3, 0); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 405, _2, _3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVSV(compilation, "", _1); - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_6$$4); - if (extendsMode) { - ZVAL_BOOL(_6$$4, 1); - } else { - ZVAL_BOOL(_6$$4, 0); - } - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 405, blockStatements, _6$$4); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_7$$4); - ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); - zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); - } - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { - - zephir_fcall_cache_entry *_0 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); - - statement = statement_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 400, expr); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(compilation); - ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); - ZEPHIR_OBS_VAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); - zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); - zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_3$$4, 265)) { - zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); - ZEPHIR_INIT_VAR(_5$$5); - ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); - zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); - ZEPHIR_INIT_VAR(_7$$6); - ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); - zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); - } - } else { - ZEPHIR_INIT_VAR(_8$$7); - ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); - zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_9); - ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); - zephir_concat_self(&compilation, _9 TSRMLS_CC); - zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); - ZEPHIR_INIT_VAR(_12); - if (extendsMode) { - ZVAL_BOOL(_12, 1); - } else { - ZVAL_BOOL(_12, 0); - } - ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 405, _11, _12); - zephir_check_call_status(); - zephir_concat_self(&compilation, _10 TSRMLS_CC); - ZEPHIR_OBS_NVAR(lifetime); - if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { - zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_13$$8, 265)) { - zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); - ZEPHIR_INIT_VAR(_15$$9); - ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); - zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); - ZEPHIR_INIT_VAR(_17$$10); - ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); - zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); - } - ZEPHIR_INIT_VAR(_18$$8); - ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_19$$11); - ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); - zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { - - HashTable *_1; - HashPosition _0; - zephir_fcall_cache_entry *_4 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(assignments); - if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); - return; - } - ZEPHIR_INIT_VAR(compilation); - ZVAL_STRING(compilation, "") TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *_0 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(autoescape); - if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); - return; - } - ZEPHIR_OBS_VAR(oldAutoescape); - zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 405, _0, _1); - zephir_check_call_status(); - zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(expr); - if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); - return; - } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 400, expr); - zephir_check_call_status(); - zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 350)) { - zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); - zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_1$$4, 265)) { - zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); - if (ZEPHIR_IS_STRING(_2$$5, "super")) { - RETURN_CCTOR(exprCode); - } - } - } - _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); - if (zephir_is_true(_3)) { - ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, ""); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - - zephir_fcall_cache_entry *_3 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - - statement = statement_param; - - - ZEPHIR_OBS_VAR(pathExpr); - if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); - return; - } - zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); - if (ZEPHIR_IS_LONG(_0, 260)) { - if (!(zephir_array_isset_string(statement, SS("params")))) { - ZEPHIR_OBS_VAR(path); - zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_INIT_VAR(_1$$5); - ZVAL_BOOL(_1$$5, 0); - ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(compilation); - zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); - } - RETURN_CCTOR(compilation); - } - } - ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 400, pathExpr); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(params); - if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { - ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 400, params); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { - - HashTable *_6$$6; - HashPosition _5$$6; - zephir_fcall_cache_entry *_13 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; - zval *statement = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - ZEPHIR_OBS_VAR(name); - if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); - return; - } - _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); - if (zephir_array_isset(_0, name)) { - ZEPHIR_INIT_VAR(_1$$4); - object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_2$$4); - ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); - ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); - ZEPHIR_INIT_VAR(macroName); - ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); - ZEPHIR_INIT_VAR(code); - ZVAL_STRING(code, ""); - zephir_concat_self(&code, _3$$5 TSRMLS_CC); - } else { - ZEPHIR_INIT_VAR(_4$$6); - ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); - zephir_concat_self(&code, _4$$6 TSRMLS_CC); - zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); - for ( - ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS - ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) - ) { - ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); - ZEPHIR_GET_HVALUE(parameter, _7$$6); - ZEPHIR_OBS_NVAR(variableName); - zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_8$$7); - ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); - zephir_concat_self(&code, _8$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_9$$7); - ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); - zephir_concat_self(&code, _9$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_10$$7); - ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); - zephir_concat_self(&code, _10$$7 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_11$$7); - ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); - zephir_concat_self(&code, _11$$7 TSRMLS_CC); - zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); - ZEPHIR_OBS_NVAR(defaultValue); - if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 400, defaultValue); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_14$$8); - ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); - zephir_concat_self(&code, _14$$8 TSRMLS_CC); - } else { - ZEPHIR_INIT_LNVAR(_15$$9); - ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); - zephir_concat_self(&code, _15$$9 TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); - } - zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); - } - ZEPHIR_OBS_VAR(blockStatements); - if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_17$$10); - if (extendsMode) { - ZVAL_BOOL(_17$$10, 1); - } else { - ZVAL_BOOL(_17$$10, 0); - } - ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 405, blockStatements, _17$$10); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(_18$$10); - ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); - zephir_concat_self(&code, _19 TSRMLS_CC); - RETURN_CCTOR(code); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - - zend_bool extendsMode; - zval *statement_param = NULL, *extendsMode_param = NULL; - zval *statement = NULL; - - zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - - statement = statement_param; - extendsMode = zephir_get_boolval(extendsMode_param); - - - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { - - HashTable *_2; - HashPosition _1; - zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode, _0; - zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; - zval *statements = NULL, *_9$$8 = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - - statements = statements_param; - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (!(zephir_fast_count_int(statements TSRMLS_CC))) { - RETURN_MM_STRING("", 1); - } - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - _0 = zephir_is_true(extended); - if (!(_0)) { - _0 = extendsMode; - } - ZEPHIR_INIT_VAR(blockMode); - ZVAL_BOOL(blockMode, _0); - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(extensions); - zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); - zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); - for ( - ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS - ; zephir_hash_move_forward_ex(_2, &_1) - ) { - ZEPHIR_GET_HVALUE(statement, _3); - if (Z_TYPE_P(statement) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); - return; - } - if (!(zephir_array_isset_string(statement, SS("type")))) { - ZEPHIR_INIT_NVAR(_4$$7); - object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_7$$7); - ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); - ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); - zephir_check_call_status(); - zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (Z_TYPE_P(extensions) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_9$$8); - zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); - zephir_array_fast_append(_9$$8, statement); - ZEPHIR_INIT_NVAR(_10$$8); - ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 401, _10$$8, _9$$8); - zephir_check_temp_parameter(_10$$8); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_STRING) { - zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); - continue; - } - } - ZEPHIR_OBS_NVAR(type); - zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); - do { - if (ZEPHIR_IS_LONG(type, 357)) { - zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); - zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 300)) { - ZEPHIR_INIT_NVAR(_14$$11); - if (extendsMode) { - ZVAL_BOOL(_14$$11, 1); - } else { - ZVAL_BOOL(_14$$11, 0); - } - ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); - zephir_check_call_status(); - zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 302)) { - ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 304)) { - ZEPHIR_INIT_NVAR(_19$$13); - if (extendsMode) { - ZVAL_BOOL(_19$$13, 1); - } else { - ZVAL_BOOL(_19$$13, 0); - } - ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); - zephir_check_call_status(); - zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 306)) { - ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 359)) { - ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 307)) { - ZEPHIR_OBS_NVAR(blockName); - zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blockStatements); - zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); - ZEPHIR_OBS_NVAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - if (zephir_is_true(blockMode)) { - if (Z_TYPE_P(blocks) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(blocks); - array_init(blocks); - } - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); - ZEPHIR_INIT_NVAR(compilation); - ZVAL_NULL(compilation); - } - zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); - zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); - } else { - if (Z_TYPE_P(blockStatements) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(_26$$21); - if (extendsMode) { - ZVAL_BOOL(_26$$21, 1); - } else { - ZVAL_BOOL(_26$$21, 0); - } - ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 405, blockStatements, _26$$21); - zephir_check_call_status(); - zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); - } - } - break; - } - if (ZEPHIR_IS_LONG(type, 310)) { - ZEPHIR_OBS_NVAR(path); - zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); - zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(extended); - ZVAL_BOOL(extended, 1); - ZEPHIR_INIT_NVAR(subCompiler); - if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); - zephir_check_call_status(); - if (Z_TYPE_P(tempCompilation) == IS_NULL) { - ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(tempCompilation); - zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); - } - if (1) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); - ZEPHIR_CPY_WRT(blockMode, extended); - break; - } - if (ZEPHIR_IS_LONG(type, 313)) { - ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 314)) { - ZEPHIR_INIT_NVAR(_34$$25); - if (extendsMode) { - ZVAL_BOOL(_34$$25, 1); - } else { - ZVAL_BOOL(_34$$25, 0); - } - ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); - zephir_check_call_status(); - zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 316)) { - ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 327)) { - ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); - zephir_check_call_status(); - zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 317)) { - ZEPHIR_INIT_NVAR(_41$$28); - if (extendsMode) { - ZVAL_BOOL(_41$$28, 1); - } else { - ZVAL_BOOL(_41$$28, 0); - } - ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); - zephir_check_call_status(); - zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 319)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 320)) { - zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 321)) { - ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); - zephir_check_call_status(); - zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 322)) { - ZEPHIR_INIT_NVAR(_46$$32); - if (extendsMode) { - ZVAL_BOOL(_46$$32, 1); - } else { - ZVAL_BOOL(_46$$32, 0); - } - ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); - zephir_check_call_status(); - zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 325)) { - ZEPHIR_INIT_NVAR(_49$$33); - if (extendsMode) { - ZVAL_BOOL(_49$$33, 1); - } else { - ZVAL_BOOL(_49$$33, 0); - } - ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); - zephir_check_call_status(); - zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); - break; - } - if (ZEPHIR_IS_LONG(type, 358)) { - break; - } - ZEPHIR_INIT_NVAR(_51$$35); - object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); - zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_54$$35); - ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); - ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); - zephir_check_call_status(); - zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - - } - if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { - level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); - if (ZEPHIR_IS_LONG(level, 1)) { - if (Z_TYPE_P(compilation) != IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); - } - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - - HashTable *_3$$7; - HashPosition _2$$7; - zephir_fcall_cache_entry *_1 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_OBS_VAR(currentPath); - zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - ZEPHIR_OBS_VAR(autoescape); - if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { - if (Z_TYPE_P(autoescape) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); - return; - } - zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); - } - } - ZEPHIR_INIT_VAR(intermediate); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(intermediate) != IS_ARRAY) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); - return; - } - ZEPHIR_INIT_VAR(_0); - if (extendsMode) { - ZVAL_BOOL(_0, 1); - } else { - ZVAL_BOOL(_0, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 405, intermediate, _0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(extended); - zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); - if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { - ZEPHIR_INIT_VAR(finalCompilation); - if (extendsMode == 1) { - array_init(finalCompilation); - } else { - ZVAL_NULL(finalCompilation); - } - ZEPHIR_OBS_VAR(blocks); - zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(extendedBlocks); - zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); - zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); - for ( - ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS - ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) - ) { - ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); - ZEPHIR_GET_HVALUE(block, _4$$7); - if (Z_TYPE_P(name) == IS_STRING) { - if (zephir_array_isset(blocks, name)) { - ZEPHIR_OBS_NVAR(localBlock); - zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); - zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, localBlock); - zephir_check_call_status(); - } else { - if (Z_TYPE_P(block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 405, block); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(blockCompilation, block); - } - } - if (extendsMode == 1) { - zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); - } else { - zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); - } - } else { - if (extendsMode == 1) { - zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); - } else { - zephir_concat_self(&finalCompilation, block TSRMLS_CC); - } - } - } - RETURN_CCTOR(finalCompilation); - } - if (extendsMode == 1) { - RETURN_MM_MEMBER(this_ptr, "_blocks"); - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_STRING(_0, "eval code", 1); - zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(_1); - if (extendsMode) { - ZVAL_BOOL(_1, 1); - } else { - ZVAL_BOOL(_1, 0); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; - zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(path_param) == IS_STRING)) { - zephir_get_strval(path, path_param); - } else { - ZEPHIR_INIT_VAR(path); - ZVAL_EMPTY_STRING(path); - } - if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { - zephir_get_strval(compiledPath, compiledPath_param); - } else { - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_EMPTY_STRING(compiledPath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (ZEPHIR_IS_EQUAL(path, compiledPath)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); - return; - } - if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_0$$4); - object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_1$$4); - ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(viewCode); - zephir_file_get_contents(viewCode, path TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { - ZEPHIR_INIT_VAR(_2$$5); - object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_3$$5); - ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); - ZEPHIR_INIT_VAR(_4); - if (extendsMode) { - ZVAL_BOOL(_4, 1); - } else { - ZVAL_BOOL(_4, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); - zephir_check_call_status(); - if (Z_TYPE_P(compilation) == IS_ARRAY) { - ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(finalCompilation, compilation); - } - ZEPHIR_INIT_VAR(_5); - zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); - return; - } - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - - zval *_2$$23; - zephir_fcall_cache_entry *_5 = NULL; - int ZEPHIR_LAST_CALL_STATUS; - zend_bool extendsMode; - zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; - zval *templatePath = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - - if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { - zephir_get_strval(templatePath, templatePath_param); - } else { - ZEPHIR_INIT_VAR(templatePath); - ZVAL_EMPTY_STRING(templatePath); - } - if (!extendsMode_param) { - extendsMode = 0; - } else { - extendsMode = zephir_get_boolval(extendsMode_param); - } - - - if (0) { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - if (0) { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); - } else { - zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); - } - zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(_0, 0); - zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); - ZEPHIR_INIT_VAR(stat); - ZVAL_BOOL(stat, 1); - ZEPHIR_INIT_VAR(compileAlways); - ZVAL_BOOL(compileAlways, 0); - ZEPHIR_INIT_VAR(compiledPath); - ZVAL_STRING(compiledPath, "", 1); - ZEPHIR_INIT_VAR(prefix); - ZVAL_NULL(prefix); - ZEPHIR_INIT_VAR(compiledSeparator); - ZVAL_STRING(compiledSeparator, "%%", 1); - ZEPHIR_INIT_VAR(compiledExtension); - ZVAL_STRING(compiledExtension, ".php", 1); - ZEPHIR_INIT_VAR(compilation); - ZVAL_NULL(compilation); - ZEPHIR_OBS_VAR(options); - zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (zephir_array_isset_string(options, SS("compileAlways"))) { - ZEPHIR_OBS_NVAR(compileAlways); - zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); - if (Z_TYPE_P(compileAlways) != IS_BOOL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); - return; - } - } - if (zephir_array_isset_string(options, SS("prefix"))) { - ZEPHIR_OBS_NVAR(prefix); - zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); - if (Z_TYPE_P(prefix) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledPath"))) { - ZEPHIR_OBS_NVAR(compiledPath); - zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); - if (Z_TYPE_P(compiledPath) != IS_STRING) { - if (Z_TYPE_P(compiledPath) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); - return; - } - } - } - if (zephir_array_isset_string(options, SS("compiledSeparator"))) { - ZEPHIR_OBS_NVAR(compiledSeparator); - zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); - if (Z_TYPE_P(compiledSeparator) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); - return; - } - } - if (zephir_array_isset_string(options, SS("compiledExtension"))) { - ZEPHIR_OBS_NVAR(compiledExtension); - zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); - if (Z_TYPE_P(compiledExtension) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); - return; - } - } - if (zephir_array_isset_string(options, SS("stat"))) { - ZEPHIR_OBS_NVAR(stat); - zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); - } - } - if (Z_TYPE_P(compiledPath) == IS_STRING) { - if (!(ZEPHIR_IS_EMPTY(compiledPath))) { - ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(templateSepPath); - zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); - } else { - ZEPHIR_CPY_WRT(templateSepPath, templatePath); - } - ZEPHIR_INIT_VAR(compiledTemplatePath); - if (extendsMode == 1) { - ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); - } else { - ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); - } - } else { - if (Z_TYPE_P(compiledPath) == IS_OBJECT) { - if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_2$$23); - zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); - zephir_array_fast_append(_2$$23, templatePath); - zephir_array_fast_append(_2$$23, options); - ZEPHIR_INIT_VAR(_3$$23); - ZVAL_BOOL(_3$$23, extendsMode); - zephir_array_fast_append(_2$$23, _3$$23); - ZEPHIR_INIT_NVAR(compiledTemplatePath); - ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); - zephir_check_call_status(); - if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); - return; - } - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); - return; - } - } - } - ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); - if (zephir_is_true(compileAlways)) { - ZEPHIR_INIT_VAR(_4$$26); - if (extendsMode) { - ZVAL_BOOL(_4$$26, 1); - } else { - ZVAL_BOOL(_4$$26, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); - zephir_check_call_status(); - } else { - if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { - if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { - ZEPHIR_INIT_VAR(_6$$29); - if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { - ZEPHIR_INIT_VAR(_7$$30); - if (extendsMode) { - ZVAL_BOOL(_7$$30, 1); - } else { - ZVAL_BOOL(_7$$30, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); - zephir_check_call_status(); - } else { - if (extendsMode == 1) { - ZEPHIR_INIT_VAR(blocksCode); - zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); - if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { - ZEPHIR_INIT_VAR(_8$$33); - object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_9$$33); - ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); - zephir_check_call_status(); - zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - if (zephir_is_true(blocksCode)) { - ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(compilation); - array_init(compilation); - } - } - } - } else { - ZEPHIR_INIT_VAR(_10$$36); - if (extendsMode) { - ZVAL_BOOL(_10$$36, 1); - } else { - ZVAL_BOOL(_10$$36, 0); - } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); - zephir_check_call_status(); - } - } else { - if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { - ZEPHIR_INIT_VAR(_11$$38); - object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); - ZEPHIR_INIT_VAR(_12$$38); - ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); - zephir_check_call_status(); - zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - } - } - } - zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); - RETURN_CCTOR(compilation); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_currentPath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - - - - RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - - int ZEPHIR_LAST_CALL_STATUS; - zval *viewCode_param = NULL, *currentPath = NULL; - zval *viewCode = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &viewCode_param); - - if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { - zephir_get_strval(viewCode, viewCode_param); - } else { - ZEPHIR_INIT_VAR(viewCode); - ZVAL_EMPTY_STRING(viewCode); - } - - - ZEPHIR_INIT_VAR(currentPath); - ZVAL_STRING(currentPath, "eval code", 1); - ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); - -} - -static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - - HashTable *_1$$4; - HashPosition _0$$4; - int ZEPHIR_LAST_CALL_STATUS; - zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; - zval *path = NULL; - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &path_param); - - zephir_get_strval(path, path_param); - - - ZEPHIR_OBS_VAR(view); - zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); - if (Z_TYPE_P(view) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { - zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); - for ( - ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS - ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) - ) { - ZEPHIR_GET_HVALUE(viewsDir, _2$$4); - ZEPHIR_INIT_LNVAR(_3$$5); - ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); - if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } - } - ZEPHIR_CONCAT_VV(return_value, viewsDir, path); - RETURN_MM(); - } else { - ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); - RETURN_MM(); - } - } - RETURN_CTOR(path); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); - - return SUCCESS; - -} - - - - -#ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) -# define __WIN32__ -# endif -#endif - -/* #define PRIVATE static */ -#define PRIVATE - -#ifdef TEST -#define MAXRHS 5 /* Set low to exercise exception code */ -#else -#define MAXRHS 1000 -#endif - -char *msort(); -void *malloc(); - -/******** From the file "action.h" *************************************/ -struct action *Action_new(); -struct action *Action_sort(); - -/********* From the file "assert.h" ************************************/ -void myassert(); -#ifndef NDEBUG -# define assert(X) if(!(X))myassert(__FILE__,__LINE__) -#else -# define assert(X) -#endif - -/********** From the file "build.h" ************************************/ -void FindRulePrecedences(); -void FindFirstSets(); -void FindStates(); -void FindLinks(); -void FindFollowSets(); -void FindActions(); - -/********* From the file "configlist.h" *********************************/ -void Configlist_init(/* void */); -struct config *Configlist_add(/* struct rule *, int */); -struct config *Configlist_addbasis(/* struct rule *, int */); -void Configlist_closure(/* void */); -void Configlist_sort(/* void */); -void Configlist_sortbasis(/* void */); -struct config *Configlist_return(/* void */); -struct config *Configlist_basis(/* void */); -void Configlist_eat(/* struct config * */); -void Configlist_reset(/* void */); - -/********* From the file "error.h" ***************************************/ -void ErrorMsg(const char *, int,const char *, ...); - -/****** From the file "option.h" ******************************************/ -struct s_options { - enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, - OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; - char *label; - char *arg; - char *message; -}; -int OptInit(/* char**,struct s_options*,FILE* */); -int OptNArgs(/* void */); -char *OptArg(/* int */); -void OptErr(/* int */); -void OptPrint(/* void */); - -/******** From the file "parse.h" *****************************************/ -void Parse(/* struct lemon *lemp */); - -/********* From the file "plink.h" ***************************************/ -struct plink *Plink_new(/* void */); -void Plink_add(/* struct plink **, struct config * */); -void Plink_copy(/* struct plink **, struct plink * */); -void Plink_delete(/* struct plink * */); - -/********** From the file "report.h" *************************************/ -void Reprint(/* struct lemon * */); -void ReportOutput(/* struct lemon * */); -void ReportTable(/* struct lemon * */); -void ReportHeader(/* struct lemon * */); -void CompressTables(/* struct lemon * */); - -/********** From the file "set.h" ****************************************/ -void SetSize(/* int N */); /* All sets will be of size N */ -char *SetNew(/* void */); /* A new set for element 0..N */ -void SetFree(/* char* */); /* Deallocate a set */ - -int SetAdd(/* char*,int */); /* Add element to a set */ -int SetUnion(/* char *A,char *B */); /* A <- A U B, thru element N */ - -#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ - -/********** From the file "struct.h" *************************************/ - -typedef enum {B_FALSE=0, B_TRUE} Boolean; - -/* Symbols (terminals and nonterminals) of the grammar are stored -** in the following: */ -struct symbol { - char *name; /* Name of the symbol */ - int index; /* Index number for this symbol */ - enum { - TERMINAL, - NONTERMINAL - } type; /* Symbols are all either TERMINALS or NTs */ - struct rule *rule; /* Linked list of rules of this (if an NT) */ - struct symbol *fallback; /* fallback token in case this token doesn't parse */ - int prec; /* Precedence if defined (-1 otherwise) */ - enum e_assoc { - LEFT, - RIGHT, - NONE, - UNK - } assoc; /* Associativity if predecence is defined */ - char *firstset; /* First-set for all rules of this symbol */ - Boolean lambda; /* True if NT and can generate an empty string */ - char *destructor; /* Code which executes whenever this symbol is - ** popped from the stack during error processing */ - int destructorln; /* Line number of destructor code */ - char *datatype; /* The data type of information held by this - ** object. Only used if type==NONTERMINAL */ - int dtnum; /* The data type number. In the parser, the value - ** stack is a union. The .yy%d element of this - ** union is the correct data type for this object */ -}; - -/* Each production rule in the grammar is stored in the following -** structure. */ -struct rule { - struct symbol *lhs; /* Left-hand side of the rule */ - char *lhsalias; /* Alias for the LHS (NULL if none) */ - int ruleline; /* Line number for the rule */ - int nrhs; /* Number of RHS symbols */ - struct symbol **rhs; /* The RHS symbols */ - char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ - int line; /* Line number at which code begins */ - char *code; /* The code executed when this rule is reduced */ - struct symbol *precsym; /* Precedence symbol for this rule */ - int index; /* An index number for this rule */ - Boolean canReduce; /* True if this rule is ever reduced */ - struct rule *nextlhs; /* Next rule with the same LHS */ - struct rule *next; /* Next rule in the global list */ -}; - -/* A configuration is a production rule of the grammar together with -** a mark (dot) showing how much of that rule has been processed so far. -** Configurations also contain a follow-set which is a list of terminal -** symbols which are allowed to immediately follow the end of the rule. -** Every configuration is recorded as an instance of the following: */ -struct config { - struct rule *rp; /* The rule upon which the configuration is based */ - int dot; /* The parse point */ - char *fws; /* Follow-set for this configuration only */ - struct plink *fplp; /* Follow-set forward propagation links */ - struct plink *bplp; /* Follow-set backwards propagation links */ - struct state *stp; /* Pointer to state which contains this */ - enum { - COMPLETE, /* The status is used during followset and */ - INCOMPLETE /* shift computations */ - } status; - struct config *next; /* Next configuration in the state */ - struct config *bp; /* The next basis configuration */ -}; - -/* Every shift or reduce operation is stored as one of the following */ -struct action { - struct symbol *sp; /* The look-ahead symbol */ - enum e_action { - SHIFT, - ACCEPT, - REDUCE, - ERROR, - CONFLICT, /* Was a reduce, but part of a conflict */ - SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ - RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ - NOT_USED /* Deleted by compression */ - } type; - union { - struct state *stp; /* The new state, if a shift */ - struct rule *rp; /* The rule, if a reduce */ - } x; - struct action *next; /* Next action for this state */ - struct action *collide; /* Next action with the same hash */ -}; - -/* Each state of the generated parser's finite state machine -** is encoded as an instance of the following structure. */ -struct state { - struct config *bp; /* The basis configurations for this state */ - struct config *cfp; /* All configurations in this set */ - int index; /* Sequencial number for this state */ - struct action *ap; /* Array of actions for this state */ - int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ - int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ - int iDflt; /* Default action */ -}; -#define NO_OFFSET (-2147483647) - -/* A followset propagation link indicates that the contents of one -** configuration followset should be propagated to another whenever -** the first changes. */ -struct plink { - struct config *cfp; /* The configuration to which linked */ - struct plink *next; /* The next propagate link */ -}; - -/* The state vector for the entire parser generator is recorded as -** follows. (LEMON uses no global variables and makes little use of -** static variables. Fields in the following structure can be thought -** of as begin global variables in the program.) */ -struct lemon { - struct state **sorted; /* Table of states sorted by state number */ - struct rule *rule; /* List of all rules */ - int nstate; /* Number of states */ - int nrule; /* Number of rules */ - int nsymbol; /* Number of terminal and nonterminal symbols */ - int nterminal; /* Number of terminal symbols */ - struct symbol **symbols; /* Sorted array of pointers to symbols */ - int errorcnt; /* Number of errors */ - struct symbol *errsym; /* The error symbol */ - char *name; /* Name of the generated parser */ - char *arg; /* Declaration of the 3th argument to parser */ - char *tokentype; /* Type of terminal symbols in the parser stack */ - char *vartype; /* The default type of non-terminal symbols */ - char *start; /* Name of the start symbol for the grammar */ - char *stacksize; /* Size of the parser stack */ - char *include; /* Code to put at the start of the C file */ - int includeln; /* Line number for start of include code */ - char *error; /* Code to execute when an error is seen */ - int errorln; /* Line number for start of error code */ - char *overflow; /* Code to execute on a stack overflow */ - int overflowln; /* Line number for start of overflow code */ - char *failure; /* Code to execute on parser failure */ - int failureln; /* Line number for start of failure code */ - char *accept; /* Code to execute when the parser excepts */ - int acceptln; /* Line number for the start of accept code */ - char *extracode; /* Code appended to the generated file */ - int extracodeln; /* Line number for the start of the extra code */ - char *tokendest; /* Code to execute to destroy token data */ - int tokendestln; /* Line number for token destroyer code */ - char *vardest; /* Code for the default non-terminal destructor */ - int vardestln; /* Line number for default non-term destructor code*/ - char *filename; /* Name of the input file */ - char *outname; /* Name of the current output file */ - char *tokenprefix; /* A prefix added to token names in the .h file */ - int nconflict; /* Number of parsing conflicts */ - int tablesize; /* Size of the parse tables */ - int basisflag; /* Print only basis configurations */ - int has_fallback; /* True if any %fallback is seen in the grammer */ - char *argv0; /* Name of the program */ -}; - -#define MemoryCheck(X) if((X)==0){ \ - extern void memory_error(); \ - memory_error(); \ -} - -/**************** From the file "table.h" *********************************/ - -/* Routines for handling a strings */ - -char *Strsafe(); - -void Strsafe_init(/* void */); -int Strsafe_insert(/* char * */); -char *Strsafe_find(/* char * */); - -/* Routines for handling symbols of the grammar */ - -struct symbol *Symbol_new(); -int Symbolcmpp(/* struct symbol **, struct symbol ** */); -void Symbol_init(/* void */); -int Symbol_insert(/* struct symbol *, char * */); -struct symbol *Symbol_find(/* char * */); -struct symbol *Symbol_Nth(/* int */); -int Symbol_count(/* */); -struct symbol **Symbol_arrayof(/* */); - -/* Routines to manage the state table */ - -int Configcmp(/* struct config *, struct config * */); -struct state *State_new(); -void State_init(/* void */); -int State_insert(/* struct state *, struct config * */); -struct state *State_find(/* struct config * */); -struct state **State_arrayof(/* */); - -/* Routines used for efficiency in Configlist_add */ - -void Configtable_init(/* void */); -int Configtable_insert(/* struct config * */); -struct config *Configtable_find(/* struct config * */); -void Configtable_clear(/* int(*)(struct config *) */); -/****************** From the file "action.c" *******************************/ - -/* Allocate a new parser action */ -struct action *Action_new(){ - static struct action *freelist = 0; - struct action *new; - - if( freelist==0 ){ - int i; - int amt = 100; - freelist = (struct action *)malloc( sizeof(struct action)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new parser action."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Compare two actions */ -static int actioncmp(ap1,ap2) -struct action *ap1; -struct action *ap2; -{ - int rc; - rc = ap1->sp->index - ap2->sp->index; - if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; - if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); - rc = ap1->x.rp->index - ap2->x.rp->index; - } - return rc; -} - -/* Sort parser actions */ -struct action *Action_sort(ap) -struct action *ap; -{ - ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp); - return ap; -} - -void Action_add(app,type,sp,arg) -struct action **app; -enum e_action type; -struct symbol *sp; -char *arg; -{ - struct action *new; - new = Action_new(); - new->next = *app; - *app = new; - new->type = type; - new->sp = sp; - if( type==SHIFT ){ - new->x.stp = (struct state *)arg; - }else{ - new->x.rp = (struct rule *)arg; - } -} -/********************** New code to implement the "acttab" module ***********/ - -typedef struct acttab acttab; -struct acttab { - int nAction; /* Number of used slots in aAction[] */ - int nActionAlloc; /* Slots allocated for aAction[] */ - struct { - int lookahead; /* Value of the lookahead token */ - int action; /* Action to take on the given lookahead */ - } *aAction, /* The yy_action[] table under construction */ - *aLookahead; /* A single new transaction set */ - int mnLookahead; /* Minimum aLookahead[].lookahead */ - int mnAction; /* Action associated with mnLookahead */ - int mxLookahead; /* Maximum aLookahead[].lookahead */ - int nLookahead; /* Used slots in aLookahead[] */ - int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ -}; - -/* Return the number of entries in the yy_action table */ -#define acttab_size(X) ((X)->nAction) - -/* The value for the N-th entry in yy_action */ -#define acttab_yyaction(X,N) ((X)->aAction[N].action) - -/* The value for the N-th entry in yy_lookahead */ -#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) - -/* Free all memory associated with the given acttab */ -void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); - free( p ); -} - -/* Allocate a new acttab structure */ -acttab *acttab_alloc(void){ - acttab *p = malloc( sizeof(*p) ); - if( p==0 ){ - fprintf(stderr,"Unable to allocate memory for a new acttab."); - exit(1); - } - memset(p, 0, sizeof(*p)); - return p; -} - -/* Add a new action to the current transaction set -*/ -void acttab_action(acttab *p, int lookahead, int action){ - if( p->nLookahead>=p->nLookaheadAlloc ){ - p->nLookaheadAlloc += 25; - p->aLookahead = realloc( p->aLookahead, - sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); - if( p->aLookahead==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - } - if( p->nLookahead==0 ){ - p->mxLookahead = lookahead; - p->mnLookahead = lookahead; - p->mnAction = action; - }else{ - if( p->mxLookaheadmxLookahead = lookahead; - if( p->mnLookahead>lookahead ){ - p->mnLookahead = lookahead; - p->mnAction = action; - } - } - p->aLookahead[p->nLookahead].lookahead = lookahead; - p->aLookahead[p->nLookahead].action = action; - p->nLookahead++; -} - -int acttab_insert(acttab *p){ - int i, j, k, n; - assert( p->nLookahead>0 ); - - /* Make sure we have enough space to hold the expanded action table - ** in the worst case. The worst case occurs if the transaction set - ** must be appended to the current action table - */ - n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ - int oldAlloc = p->nActionAlloc; - p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; - p->aAction = realloc( p->aAction, - sizeof(p->aAction[0])*p->nActionAlloc); - if( p->aAction==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=oldAlloc; inActionAlloc; i++){ - p->aAction[i].lookahead = -1; - p->aAction[i].action = -1; - } - } - - /* Scan the existing action table looking for an offset where we can - ** insert the current transaction set. Fall out of the loop when that - ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. - ** - ** i is the index in p->aAction[] where p->mnLookahead is inserted. - */ - for(i=0; inAction+p->mnLookahead; i++){ - if( p->aAction[i].lookahead<0 ){ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 ) break; - if( p->aAction[k].lookahead>=0 ) break; - } - if( jnLookahead ) continue; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; - } - if( j==p->nAction ){ - break; /* Fits in empty slots */ - } - }else if( p->aAction[i].lookahead==p->mnLookahead ){ - if( p->aAction[i].action!=p->mnAction ) continue; - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - if( k<0 || k>=p->nAction ) break; - if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; - if( p->aLookahead[j].action!=p->aAction[k].action ) break; - } - if( jnLookahead ) continue; - n = 0; - for(j=0; jnAction; j++){ - if( p->aAction[j].lookahead<0 ) continue; - if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; - } - if( n==p->nLookahead ){ - break; /* Same as a prior transaction set */ - } - } - } - /* Insert transaction set at index i. */ - for(j=0; jnLookahead; j++){ - k = p->aLookahead[j].lookahead - p->mnLookahead + i; - p->aAction[k] = p->aLookahead[j]; - if( k>=p->nAction ) p->nAction = k+1; - } - p->nLookahead = 0; - - /* Return the offset that is added to the lookahead in order to get the - ** index into yy_action of the action */ - return i - p->mnLookahead; -} - -/********************** From the file "assert.c" ****************************/ -void myassert(file,line) -char *file; -int line; -{ - fprintf(stderr,"Assertion failed on line %d of file \"%s\"\n",line,file); - exit(1); -} -/********************** From the file "build.c" *****************************/ - -/* Find a precedence symbol of every rule in the grammar. -** -** Those rules which have a precedence symbol coded in the input -** grammar using the "[symbol]" construct will already have the -** rp->precsym field filled. Other rules take as their precedence -** symbol the first RHS symbol with a defined precedence. If there -** are not RHS symbols with a defined precedence, the precedence -** symbol field is left blank. -*/ -void FindRulePrecedences(xp) -struct lemon *xp; -{ - struct rule *rp; - for(rp=xp->rule; rp; rp=rp->next){ - if( rp->precsym==0 ){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->prec>=0 ){ - rp->precsym = rp->rhs[i]; - break; - } - } - } - } - return; -} - -/* Find all nonterminals which will generate the empty string. -** Then go back and compute the first sets of every nonterminal. -** The first set is the set of all terminal symbols which can begin -** a string generated by that nonterminal. -*/ -void FindFirstSets(lemp) -struct lemon *lemp; -{ - int i; - struct rule *rp; - int progress; - - for(i=0; insymbol; i++){ - lemp->symbols[i]->lambda = B_FALSE; - } - for(i=lemp->nterminal; insymbol; i++){ - lemp->symbols[i]->firstset = SetNew(); - } - - /* First compute all lambdas */ - do{ - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->lhs->lambda ) continue; - for(i=0; inrhs; i++){ - if( rp->rhs[i]->lambda==B_FALSE ) break; - } - if( i==rp->nrhs ){ - rp->lhs->lambda = B_TRUE; - progress = 1; - } - } - }while( progress ); - - /* Now compute all first sets */ - do{ - struct symbol *s1, *s2; - progress = 0; - for(rp=lemp->rule; rp; rp=rp->next){ - s1 = rp->lhs; - for(i=0; inrhs; i++){ - s2 = rp->rhs[i]; - if( s2->type==TERMINAL ){ - progress += SetAdd(s1->firstset,s2->index); - break; - }else if( s1==s2 ){ - if( s1->lambda==B_FALSE ) break; - }else{ - progress += SetUnion(s1->firstset,s2->firstset); - if( s2->lambda==B_FALSE ) break; - } - } - } - }while( progress ); - return; -} - -/* Compute all LR(0) states for the grammar. Links -** are added to between some states so that the LR(1) follow sets -** can be computed later. -*/ -PRIVATE struct state *getstate(/* struct lemon * */); /* forward reference */ -void FindStates(lemp) -struct lemon *lemp; -{ - struct symbol *sp; - struct rule *rp; - - Configlist_init(); - - /* Find the start symbol */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ){ - ErrorMsg(lemp->filename,0, -"The specified start symbol \"%s\" is not \ -in a nonterminal of the grammar. \"%s\" will be used as the start \ -symbol instead.",lemp->start,lemp->rule->lhs->name); - lemp->errorcnt++; - sp = lemp->rule->lhs; - } - }else{ - sp = lemp->rule->lhs; - } - - /* Make sure the start symbol doesn't occur on the right-hand side of - ** any rule. Report an error if it does. (YACC would generate a new - ** start symbol in this case.) */ - for(rp=lemp->rule; rp; rp=rp->next){ - int i; - for(i=0; inrhs; i++){ - if( rp->rhs[i]==sp ){ - ErrorMsg(lemp->filename,0, -"The start symbol \"%s\" occurs on the \ -right-hand side of a rule. This will result in a parser which \ -does not work properly.",sp->name); - lemp->errorcnt++; - } - } - } - - /* The basis configuration set for the first state - ** is all rules which have the start symbol as their - ** left-hand side */ - for(rp=sp->rule; rp; rp=rp->nextlhs){ - struct config *newcfp; - newcfp = Configlist_addbasis(rp,0); - SetAdd(newcfp->fws,0); - } - - /* Compute the first state. All other states will be - ** computed automatically during the computation of the first one. - ** The returned pointer to the first state is not used. */ - (void)getstate(lemp); - return; -} - -/* Return a pointer to a state which is described by the configuration -** list which has been built from calls to Configlist_add. -*/ -PRIVATE void buildshifts(/* struct lemon *, struct state * */); /* Forwd ref */ -PRIVATE struct state *getstate(lemp) -struct lemon *lemp; -{ - struct config *cfp, *bp; - struct state *stp; - - /* Extract the sorted basis of the new state. The basis was constructed - ** by prior calls to "Configlist_addbasis()". */ - Configlist_sortbasis(); - bp = Configlist_basis(); - - /* Get a state with the same basis */ - stp = State_find(bp); - if( stp ){ - /* A state with the same basis already exists! Copy all the follow-set - ** propagation links from the state under construction into the - ** preexisting state, then return a pointer to the preexisting state */ - struct config *x, *y; - for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ - Plink_copy(&y->bplp,x->bplp); - Plink_delete(x->fplp); - x->fplp = x->bplp = 0; - } - cfp = Configlist_return(); - Configlist_eat(cfp); - }else{ - /* This really is a new state. Construct all the details */ - Configlist_closure(lemp); /* Compute the configuration closure */ - Configlist_sort(); /* Sort the configuration closure */ - cfp = Configlist_return(); /* Get a pointer to the config list */ - stp = State_new(); /* A new state structure */ - MemoryCheck(stp); - stp->bp = bp; /* Remember the configuration basis */ - stp->cfp = cfp; /* Remember the configuration closure */ - stp->index = lemp->nstate++; /* Every state gets a sequence number */ - stp->ap = 0; /* No actions, yet. */ - State_insert(stp,stp->bp); /* Add to the state table */ - buildshifts(lemp,stp); /* Recursively compute successor states */ - } - return stp; -} - -/* Construct all successor states to the given state. A "successor" -** state is any state which can be reached by a shift action. -*/ -PRIVATE void buildshifts(lemp,stp) -struct lemon *lemp; -struct state *stp; /* The state from which successors are computed */ -{ - struct config *cfp; /* For looping thru the config closure of "stp" */ - struct config *bcfp; /* For the inner loop on config closure of "stp" */ - struct config *new; /* */ - struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ - struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ - struct state *newstp; /* A pointer to a successor state */ - - /* Each configuration becomes complete after it contibutes to a successor - ** state. Initially, all configurations are incomplete */ - for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; - - /* Loop through all configurations of the state "stp" */ - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ - if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ - Configlist_reset(); /* Reset the new config set */ - sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ - - /* For every configuration in the state "stp" which has the symbol "sp" - ** following its dot, add the same configuration to the basis set under - ** construction but with the dot shifted one symbol to the right. */ - for(bcfp=cfp; bcfp; bcfp=bcfp->next){ - if( bcfp->status==COMPLETE ) continue; /* Already used */ - if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ - bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ - if( bsp!=sp ) continue; /* Must be same as for "cfp" */ - bcfp->status = COMPLETE; /* Mark this config as used */ - new = Configlist_addbasis(bcfp->rp,bcfp->dot+1); - Plink_add(&new->bplp,bcfp); - } - - /* Get a pointer to the state described by the basis configuration set - ** constructed in the preceding loop */ - newstp = getstate(lemp); - - /* The state "newstp" is reached from the state "stp" by a shift action - ** on the symbol "sp" */ - Action_add(&stp->ap,SHIFT,sp,(char *)newstp); - } -} - -void FindLinks(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp, *other; - struct state *stp; - struct plink *plp; - - /* Housekeeping detail: - ** Add to every propagate link a pointer back to the state to - ** which the link is attached. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - cfp->stp = stp; - } - } - - /* Convert all backlinks into forward links. Only the forward - ** links are used in the follow-set computation. */ - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ - for(plp=cfp->bplp; plp; plp=plp->next){ - other = plp->cfp; - Plink_add(&other->fplp,cfp); - } - } - } -} - -/* Compute all followsets. -** -** A followset is the set of all symbols which can come immediately -** after a configuration. -*/ -void FindFollowSets(lemp) -struct lemon *lemp; -{ - int i; - struct config *cfp; - struct plink *plp; - int progress; - int change; - - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - cfp->status = INCOMPLETE; - } - } - - do{ - progress = 0; - for(i=0; instate; i++){ - for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ - if( cfp->status==COMPLETE ) continue; - for(plp=cfp->fplp; plp; plp=plp->next){ - change = SetUnion(plp->cfp->fws,cfp->fws); - if( change ){ - plp->cfp->status = INCOMPLETE; - progress = 1; - } - } - cfp->status = COMPLETE; - } - } - }while( progress ); -} - -static int resolve_conflict(); - -/* Compute the reduce actions, and resolve conflicts. -*/ -void FindActions(lemp) -struct lemon *lemp; -{ - int i,j; - struct config *cfp; - struct state *stp; - struct symbol *sp; - struct rule *rp; - - /* Add all of the reduce actions - ** A reduce action is added for each element of the followset of - ** a configuration which has its dot at the extreme right. - */ - for(i=0; instate; i++){ /* Loop over all states */ - stp = lemp->sorted[i]; - for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ - if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ - for(j=0; jnterminal; j++){ - if( SetFind(cfp->fws,j) ){ - /* Add a reduce action to the state "stp" which will reduce by the - ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ - Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); - } - } - } - } - } - - /* Add the accepting token */ - if( lemp->start ){ - sp = Symbol_find(lemp->start); - if( sp==0 ) sp = lemp->rule->lhs; - }else{ - sp = lemp->rule->lhs; - } - /* Add to the first state (which is always the starting state of the - ** finite state machine) an action to ACCEPT if the lookahead is the - ** start nonterminal. */ - Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); - - /* Resolve conflicts */ - for(i=0; instate; i++){ - struct action *ap, *nap; - struct state *stp; - stp = lemp->sorted[i]; - assert( stp->ap ); - stp->ap = Action_sort(stp->ap); - for(ap=stp->ap; ap && ap->next; ap=ap->next){ - for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ - /* The two actions "ap" and "nap" have the same lookahead. - ** Figure out which one should be used */ - lemp->nconflict += resolve_conflict(ap,nap,lemp->errsym); - } - } - } - - /* Report an error for each rule that can never be reduced. */ - for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = B_FALSE; - for(i=0; instate; i++){ - struct action *ap; - for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ - if( ap->type==REDUCE ) ap->x.rp->canReduce = B_TRUE; - } - } - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->canReduce ) continue; - ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); - lemp->errorcnt++; - } -} - -/* Resolve a conflict between the two given actions. If the -** conflict can't be resolve, return non-zero. -** -** NO LONGER TRUE: -** To resolve a conflict, first look to see if either action -** is on an error rule. In that case, take the action which -** is not associated with the error rule. If neither or both -** actions are associated with an error rule, then try to -** use precedence to resolve the conflict. -** -** If either action is a SHIFT, then it must be apx. This -** function won't work if apx->type==REDUCE and apy->type==SHIFT. -*/ -static int resolve_conflict(apx,apy,errsym) -struct action *apx; -struct action *apy; -struct symbol *errsym; /* The error symbol (if defined. NULL otherwise) */ -{ - struct symbol *spx, *spy; - int errcnt = 0; - assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ - if( apx->type==SHIFT && apy->type==REDUCE ){ - spx = apx->sp; - spy = apy->x.rp->precsym; - if( spy==0 || spx->prec<0 || spy->prec<0 ){ - /* Not enough precedence information. */ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ /* Lower precedence wins */ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = SH_RESOLVED; - }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ - apy->type = RD_RESOLVED; /* associativity */ - }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ - apx->type = SH_RESOLVED; - }else{ - assert( spx->prec==spy->prec && spx->assoc==NONE ); - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - } - }else if( apx->type==REDUCE && apy->type==REDUCE ){ - spx = apx->x.rp->precsym; - spy = apy->x.rp->precsym; - if( spx==0 || spy==0 || spx->prec<0 || spy->prec<0 || spx->prec==spy->prec ){ - fprintf(stderr, "Not enough precedence: %s\n", errsym->name); - apy->type = CONFLICT; - errcnt++; - }else if( spx->prec>spy->prec ){ - apy->type = RD_RESOLVED; - }else if( spx->precprec ){ - apx->type = RD_RESOLVED; - } - }else{ - assert( - apx->type==SH_RESOLVED || - apx->type==RD_RESOLVED || - apx->type==CONFLICT || - apy->type==SH_RESOLVED || - apy->type==RD_RESOLVED || - apy->type==CONFLICT - ); - /* The REDUCE/SHIFT case cannot happen because SHIFTs come before - ** REDUCEs on the list. If we reach this point it must be because - ** the parser conflict had already been resolved. */ - } - return errcnt; -} -/********************* From the file "configlist.c" *************************/ - -static struct config *freelist = 0; /* List of free configurations */ -static struct config *current = 0; /* Top of list of configurations */ -static struct config **currentend = 0; /* Last on list of configs */ -static struct config *basis = 0; /* Top of list of basis configs */ -static struct config **basisend = 0; /* End of list of basis configs */ - -/* Return a pointer to a new configuration */ -PRIVATE struct config *newconfig(){ - struct config *new; - if( freelist==0 ){ - int i; - int amt = 3; - freelist = (struct config *)malloc( sizeof(struct config)*amt ); - if( freelist==0 ){ - fprintf(stderr,"Unable to allocate memory for a new configuration."); - exit(1); - } - for(i=0; inext; - return new; -} - -/* The configuration "old" is no longer used */ -PRIVATE void deleteconfig(old) -struct config *old; -{ - old->next = freelist; - freelist = old; -} - -/* Initialized the configuration list builder */ -void Configlist_init(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_init(); - return; -} - -/* Initialized the configuration list builder */ -void Configlist_reset(){ - current = 0; - currentend = ¤t; - basis = 0; - basisend = &basis; - Configtable_clear(0); - return; -} - -/* Add another configuration to the configuration list */ -struct config *Configlist_add(rp,dot) -struct rule *rp; /* The rule */ -int dot; /* Index into the RHS of the rule where the dot goes */ -{ - struct config *cfp, model; - - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - Configtable_insert(cfp); - } - return cfp; -} - -/* Add a basis configuration to the configuration list */ -struct config *Configlist_addbasis(rp,dot) -struct rule *rp; -int dot; -{ - struct config *cfp, model; - - assert( basisend!=0 ); - assert( currentend!=0 ); - model.rp = rp; - model.dot = dot; - cfp = Configtable_find(&model); - if( cfp==0 ){ - cfp = newconfig(); - cfp->rp = rp; - cfp->dot = dot; - cfp->fws = SetNew(); - cfp->stp = 0; - cfp->fplp = cfp->bplp = 0; - cfp->next = 0; - cfp->bp = 0; - *currentend = cfp; - currentend = &cfp->next; - *basisend = cfp; - basisend = &cfp->bp; - Configtable_insert(cfp); - } - return cfp; -} - -/* Compute the closure of the configuration list */ -void Configlist_closure(lemp) -struct lemon *lemp; -{ - struct config *cfp, *newcfp; - struct rule *rp, *newrp; - struct symbol *sp, *xsp; - int i, dot; - - assert( currentend!=0 ); - for(cfp=current; cfp; cfp=cfp->next){ - rp = cfp->rp; - dot = cfp->dot; - if( dot>=rp->nrhs ) continue; - sp = rp->rhs[dot]; - if( sp->type==NONTERMINAL ){ - if( sp->rule==0 && sp!=lemp->errsym ){ - ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", - sp->name); - lemp->errorcnt++; - } - for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ - newcfp = Configlist_add(newrp,0); - for(i=dot+1; inrhs; i++){ - xsp = rp->rhs[i]; - if( xsp->type==TERMINAL ){ - SetAdd(newcfp->fws,xsp->index); - break; - }else{ - SetUnion(newcfp->fws,xsp->firstset); - if( xsp->lambda==B_FALSE ) break; - } - } - if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); - } - } - } - return; -} - -/* Sort the configuration list */ -void Configlist_sort(){ - current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp); - currentend = 0; - return; -} - -/* Sort the basis configuration list */ -void Configlist_sortbasis(){ - basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp); - basisend = 0; - return; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_return(){ - struct config *old; - old = current; - current = 0; - currentend = 0; - return old; -} - -/* Return a pointer to the head of the configuration list and -** reset the list */ -struct config *Configlist_basis(){ - struct config *old; - old = basis; - basis = 0; - basisend = 0; - return old; -} - -/* Free all elements of the given configuration list */ -void Configlist_eat(cfp) -struct config *cfp; -{ - struct config *nextcfp; - for(; cfp; cfp=nextcfp){ - nextcfp = cfp->next; - assert( cfp->fplp==0 ); - assert( cfp->bplp==0 ); - if( cfp->fws ) SetFree(cfp->fws); - deleteconfig(cfp); - } - return; -} -/***************** From the file "error.c" *********************************/ - -/* Find a good place to break "msg" so that its length is at least "min" -** but no more than "max". Make the point as close to max as possible. -*/ -static int findbreak(msg,min,max) -char *msg; -int min; -int max; -{ - int i,spot; - char c; - for(i=spot=min; i<=max; i++){ - c = msg[i]; - if( c=='\t' ) msg[i] = ' '; - if( c=='\n' ){ msg[i] = ' '; spot = i; break; } - if( c==0 ){ spot = i; break; } - if( c=='-' && i0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); - }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); - } - prefixsize = strlen(prefix); - availablewidth = LINEWIDTH - prefixsize; - - /* Generate the error message */ - vsprintf(errmsg,format,ap); - va_end(ap); - errmsgsize = strlen(errmsg); - /* Remove trailing '\n's from the error message. */ - while( errmsgsize>0 && errmsg[errmsgsize-1]=='\n' ){ - errmsg[--errmsgsize] = 0; - } - - /* Print the error message */ - base = 0; - while( errmsg[base]!=0 ){ - end = restart = findbreak(&errmsg[base],0,availablewidth); - restart += base; - while( errmsg[restart]==' ' ) restart++; - fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); - base = restart; - } -} -/**************** From the file "main.c" ************************************/ - -/* Report an out-of-memory condition and abort. This function -** is used mostly by the "MemoryCheck" macro in struct.h -*/ -void memory_error(){ - fprintf(stderr,"Out of memory. Aborting...\n"); - exit(1); -} - -static int nDefine = 0; /* Number of -D options on the command line */ -static char **azDefine = 0; /* Name of the -D macros */ - -/* This routine is called with the argument to each -D command-line option. -** Add the macro defined to the azDefine array. -*/ -static void handle_D_option(char *z){ - char **paz; - nDefine++; - azDefine = realloc(azDefine, sizeof(azDefine[0])*nDefine); - if( azDefine==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - paz = &azDefine[nDefine-1]; - *paz = malloc( strlen(z)+1 ); - if( *paz==0 ){ - fprintf(stderr,"out of memory\n"); - exit(1); - } - strcpy(*paz, z); - for(z=*paz; *z && *z!='='; z++){} - *z = 0; -} - - -/* The main program. Parse the command line and do it... */ -int main(argc,argv) -int argc; -char **argv; -{ - static int version = 0; - static int rpflag = 0; - static int basisflag = 0; - static int compress = 0; - static int quiet = 0; - static int statistics = 0; - static int mhflag = 0; - static struct s_options options[] = { - {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, - "Print parser stats to standard output."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} - }; - int i; - struct lemon lem; - - OptInit(argv,options,stderr); - if( version ){ - printf("Lemon version 1.0\n"); - exit(0); - } - if( OptNArgs()!=1 ){ - fprintf(stderr,"Exactly one filename argument is required.\n"); - exit(1); - } - lem.errorcnt = 0; - - /* Initialize the machine */ - Strsafe_init(); - Symbol_init(); - State_init(); - lem.argv0 = argv[0]; - lem.filename = OptArg(0); - lem.basisflag = basisflag; - lem.has_fallback = 0; - lem.nconflict = 0; - lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0; - lem.vartype = 0; - lem.stacksize = 0; - lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest = - lem.tokenprefix = lem.outname = lem.extracode = 0; - lem.vardest = 0; - lem.tablesize = 0; - Symbol_new("$"); - lem.errsym = Symbol_new("error"); - - /* Parse the input file */ - Parse(&lem); - if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.rule==0 ){ - fprintf(stderr,"Empty grammar.\n"); - exit(1); - } - - /* Count and index the symbols of the grammar */ - lem.nsymbol = Symbol_count(); - Symbol_new("{default}"); - lem.symbols = Symbol_arrayof(); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*), - (int(*)())Symbolcmpp); - for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); - lem.nterminal = i; - - /* Generate a reprint of the grammar, if requested on the command line */ - if( rpflag ){ - Reprint(&lem); - }else{ - /* Initialize the size for all follow and first sets */ - SetSize(lem.nterminal); - - /* Find the precedence for every production rule (that has one) */ - FindRulePrecedences(&lem); - - /* Compute the lambda-nonterminals and the first-sets for every - ** nonterminal */ - FindFirstSets(&lem); - - /* Compute all LR(0) states. Also record follow-set propagation - ** links so that the follow-set can be computed later */ - lem.nstate = 0; - FindStates(&lem); - lem.sorted = State_arrayof(); - - /* Tie up loose ends on the propagation links */ - FindLinks(&lem); - - /* Compute the follow set of every reducible configuration */ - FindFollowSets(&lem); - - /* Compute the action tables */ - FindActions(&lem); - - /* Compress the action tables */ - if( compress==0 ) CompressTables(&lem); - - /* Generate a report of the parser generated. (the "y.output" file) */ - if( !quiet ) ReportOutput(&lem); - - /* Generate the source code for the parser */ - ReportTable(&lem, mhflag); - - /* Produce a header file for use by the scanner. (This step is - ** omitted if the "-m" option is used because makeheaders will - ** generate the file for us.) */ - if( !mhflag ) ReportHeader(&lem); - } - if( statistics ){ - printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", - lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); - printf(" %d states, %d parser table entries, %d conflicts\n", - lem.nstate, lem.tablesize, lem.nconflict); - } - if( lem.nconflict ){ - fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); - } - exit(lem.errorcnt + lem.nconflict); - return (lem.errorcnt + lem.nconflict); -} -/******************** From the file "msort.c" *******************************/ - -#define NEXT(A) (*(char**)(((unsigned long)A)+offset)) - -static char *merge(a,b,cmp,offset) -char *a; -char *b; -int (*cmp)(); -int offset; -{ - char *ptr, *head; - - if( a==0 ){ - head = b; - }else if( b==0 ){ - head = a; - }else{ - if( (*cmp)(a,b)<0 ){ - ptr = a; - a = NEXT(a); - }else{ - ptr = b; - b = NEXT(b); - } - head = ptr; - while( a && b ){ - if( (*cmp)(a,b)<0 ){ - NEXT(ptr) = a; - ptr = a; - a = NEXT(a); - }else{ - NEXT(ptr) = b; - ptr = b; - b = NEXT(b); - } - } - if( a ) NEXT(ptr) = a; - else NEXT(ptr) = b; - } - return head; -} - -#define LISTSIZE 30 -char *msort(list,next,cmp) -char *list; -char **next; -int (*cmp)(); -{ - unsigned long offset; - char *ep; - char *set[LISTSIZE]; - int i; - offset = (unsigned long)next - (unsigned long)list; - for(i=0; istate = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ - psp->lhs = Symbol_new(x); - psp->nrhs = 0; - psp->lhsalias = 0; - psp->state = WAITING_FOR_ARROW; - }else if( x[0]=='{' ){ - if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"There is not prior rule opon which to attach the code \ -fragment which begins on this line."); - psp->errorcnt++; - }else if( psp->prevrule->code!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Code fragment beginning on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->line = psp->tokenlineno; - psp->prevrule->code = &x[1]; - } - }else if( x[0]=='[' ){ - psp->state = PRECEDENCE_MARK_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Token \"%s\" should be either \"%%\" or a nonterminal name.", - x); - psp->errorcnt++; - } - break; - case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The precedence symbol must be a terminal."); - psp->errorcnt++; - }else if( psp->prevrule==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "There is no prior rule to assign precedence \"[%s]\".",x); - psp->errorcnt++; - }else if( psp->prevrule->precsym!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, -"Precedence mark on this line is not the first \ -to follow the previous rule."); - psp->errorcnt++; - }else{ - psp->prevrule->precsym = Symbol_new(x); - } - psp->state = PRECEDENCE_MARK_2; - break; - case PRECEDENCE_MARK_2: - if( x[0]!=']' ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"]\" on precedence mark."); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; - case WAITING_FOR_ARROW: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else if( x[0]=='(' ){ - psp->state = LHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Expected to see a \":\" following the LHS symbol \"%s\".", - psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->lhsalias = x; - psp->state = LHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the LHS \"%s\"\n", - x,psp->lhs->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = LHS_ALIAS_3; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case LHS_ALIAS_3: - if( x[0]==':' && x[1]==':' && x[2]=='=' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \"->\" following: \"%s(%s)\".", - psp->lhs->name,psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case IN_RHS: - if( x[0]=='.' ){ - struct rule *rp; - rp = (struct rule *)malloc( sizeof(struct rule) + - sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs ); - if( rp==0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't allocate enough memory for this rule."); - psp->errorcnt++; - psp->prevrule = 0; - }else{ - int i; - rp->ruleline = psp->tokenlineno; - rp->rhs = (struct symbol**)&rp[1]; - rp->rhsalias = (char**)&(rp->rhs[psp->nrhs]); - for(i=0; inrhs; i++){ - rp->rhs[i] = psp->rhs[i]; - rp->rhsalias[i] = psp->alias[i]; - } - rp->lhs = psp->lhs; - rp->lhsalias = psp->lhsalias; - rp->nrhs = psp->nrhs; - rp->code = 0; - rp->precsym = 0; - rp->index = psp->gp->nrule++; - rp->nextlhs = rp->lhs->rule; - rp->lhs->rule = rp; - rp->next = 0; - if( psp->firstrule==0 ){ - psp->firstrule = psp->lastrule = rp; - }else{ - psp->lastrule->next = rp; - psp->lastrule = rp; - } - psp->prevrule = rp; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ - if( psp->nrhs>=MAXRHS ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Too many symbol on RHS or rule beginning at \"%s\".", - x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - }else{ - psp->rhs[psp->nrhs] = Symbol_new(x); - psp->alias[psp->nrhs] = 0; - psp->nrhs++; - } - }else if( x[0]=='(' && psp->nrhs>0 ){ - psp->state = RHS_ALIAS_1; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal character on RHS of rule: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_1: - if( isalpha(x[0]) ){ - psp->alias[psp->nrhs-1] = x; - psp->state = RHS_ALIAS_2; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", - x,psp->rhs[psp->nrhs-1]->name); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case RHS_ALIAS_2: - if( x[0]==')' ){ - psp->state = IN_RHS; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); - psp->errorcnt++; - psp->state = RESYNC_AFTER_RULE_ERROR; - } - break; - case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ - psp->declkeyword = x; - psp->declargslot = 0; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - if( strcmp(x,"name")==0 ){ - psp->declargslot = &(psp->gp->name); - }else if( strcmp(x,"include")==0 ){ - psp->declargslot = &(psp->gp->include); - psp->decllnslot = &psp->gp->includeln; - }else if( strcmp(x,"code")==0 ){ - psp->declargslot = &(psp->gp->extracode); - psp->decllnslot = &psp->gp->extracodeln; - }else if( strcmp(x,"token_destructor")==0 ){ - psp->declargslot = &psp->gp->tokendest; - psp->decllnslot = &psp->gp->tokendestln; - }else if( strcmp(x,"default_destructor")==0 ){ - psp->declargslot = &psp->gp->vardest; - psp->decllnslot = &psp->gp->vardestln; - }else if( strcmp(x,"token_prefix")==0 ){ - psp->declargslot = &psp->gp->tokenprefix; - }else if( strcmp(x,"syntax_error")==0 ){ - psp->declargslot = &(psp->gp->error); - psp->decllnslot = &psp->gp->errorln; - }else if( strcmp(x,"parse_accept")==0 ){ - psp->declargslot = &(psp->gp->accept); - psp->decllnslot = &psp->gp->acceptln; - }else if( strcmp(x,"parse_failure")==0 ){ - psp->declargslot = &(psp->gp->failure); - psp->decllnslot = &psp->gp->failureln; - }else if( strcmp(x,"stack_overflow")==0 ){ - psp->declargslot = &(psp->gp->overflow); - psp->decllnslot = &psp->gp->overflowln; - }else if( strcmp(x,"extra_argument")==0 ){ - psp->declargslot = &(psp->gp->arg); - }else if( strcmp(x,"token_type")==0 ){ - psp->declargslot = &(psp->gp->tokentype); - }else if( strcmp(x,"default_type")==0 ){ - psp->declargslot = &(psp->gp->vartype); - }else if( strcmp(x,"stack_size")==0 ){ - psp->declargslot = &(psp->gp->stacksize); - }else if( strcmp(x,"start_symbol")==0 ){ - psp->declargslot = &(psp->gp->start); - }else if( strcmp(x,"left")==0 ){ - psp->preccounter++; - psp->declassoc = LEFT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"right")==0 ){ - psp->preccounter++; - psp->declassoc = RIGHT; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"nonassoc")==0 ){ - psp->preccounter++; - psp->declassoc = NONE; - psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; - }else if( strcmp(x,"destructor")==0 ){ - psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; - }else if( strcmp(x,"type")==0 ){ - psp->state = WAITING_FOR_DATATYPE_SYMBOL; - }else if( strcmp(x,"fallback")==0 ){ - psp->fallback = 0; - psp->state = WAITING_FOR_FALLBACK_ID; - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Unknown declaration keyword: \"%%%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal declaration keyword: \"%s\".",x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->destructor; - psp->decllnslot = &sp->destructorln; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol name missing after %destructor keyword"); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - struct symbol *sp = Symbol_new(x); - psp->declargslot = &sp->datatype; - psp->decllnslot = 0; - psp->state = WAITING_FOR_DECL_ARG; - } - break; - case WAITING_FOR_PRECEDENCE_SYMBOL: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ - struct symbol *sp; - sp = Symbol_new(x); - if( sp->prec>=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "Symbol \"%s\" has already be given a precedence.",x); - psp->errorcnt++; - }else{ - sp->prec = psp->preccounter; - sp->assoc = psp->declassoc; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Can't assign a precedence to \"%s\".",x); - psp->errorcnt++; - } - break; - case WAITING_FOR_DECL_ARG: - if( (x[0]=='{' || x[0]=='\"' || isalnum(x[0])) ){ - if( *(psp->declargslot)!=0 ){ - ErrorMsg(psp->filename,psp->tokenlineno, - "The argument \"%s\" to declaration \"%%%s\" is not the first.", - x[0]=='\"' ? &x[1] : x,psp->declkeyword); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - }else{ - *(psp->declargslot) = (x[0]=='\"' || x[0]=='{') ? &x[1] : x; - if( psp->decllnslot ) *psp->decllnslot = psp->tokenlineno; - psp->state = WAITING_FOR_DECL_OR_RULE; - } - }else{ - ErrorMsg(psp->filename,psp->tokenlineno, - "Illegal argument to %%%s: %s",psp->declkeyword,x); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } - break; - case WAITING_FOR_FALLBACK_ID: - if( x[0]=='.' ){ - psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "%%fallback argument \"%s\" should be a token", x); - psp->errorcnt++; - }else{ - struct symbol *sp = Symbol_new(x); - if( psp->fallback==0 ){ - psp->fallback = sp; - }else if( sp->fallback ){ - ErrorMsg(psp->filename, psp->tokenlineno, - "More than one fallback assigned to token %s", x); - psp->errorcnt++; - }else{ - sp->fallback = psp->fallback; - psp->gp->has_fallback = 1; - } - } - break; - case RESYNC_AFTER_RULE_ERROR: -/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; -** break; */ - case RESYNC_AFTER_DECL_ERROR: - if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; - if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; - break; - } -} - -/* Run the proprocessor over the input file text. The global variables -** azDefine[0] through azDefine[nDefine-1] contains the names of all defined -** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and -** comments them out. Text in between is also commented out as appropriate. -*/ -static preprocess_input(char *z){ - int i, j, k, n; - int exclude = 0; - int start; - int lineno = 1; - int start_lineno; - for(i=0; z[i]; i++){ - if( z[i]=='\n' ) lineno++; - if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ - if( exclude ){ - exclude--; - if( exclude==0 ){ - for(j=start; jfilename; - ps.errorcnt = 0; - ps.state = INITIALIZE; - - /* Begin by reading the input file */ - fp = fopen(ps.filename,"rb"); - if( fp==0 ){ - ErrorMsg(ps.filename,0,"Can't open this file for reading."); - gp->errorcnt++; - return; - } - fseek(fp,0,2); - filesize = ftell(fp); - rewind(fp); - filebuf = (char *)malloc( filesize+1 ); - if( filebuf==0 ){ - ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.", - filesize+1); - gp->errorcnt++; - return; - } - if( fread(filebuf,1,filesize,fp)!=filesize ){ - ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", - filesize); - free(filebuf); - gp->errorcnt++; - return; - } - fclose(fp); - filebuf[filesize] = 0; - - /* Make an initial pass through the file to handle %ifdef and %ifndef */ - preprocess_input(filebuf); - - /* Now scan the text of the input file */ - lineno = 1; - for(cp=filebuf; (c= *cp)!=0; ){ - if( c=='\n' ) lineno++; /* Keep track of the line number */ - if( isspace(c) ){ cp++; continue; } /* Skip all white space */ - if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ - cp+=2; - while( (c= *cp)!=0 && c!='\n' ) cp++; - continue; - } - if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ - cp+=2; - while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c ) cp++; - continue; - } - ps.tokenstart = cp; /* Mark the beginning of the token */ - ps.tokenlineno = lineno; /* Linenumber on which token begins */ - if( c=='\"' ){ /* String literals */ - cp++; - while( (c= *cp)!=0 && c!='\"' ){ - if( c=='\n' ) lineno++; - cp++; - } - if( c==0 ){ - ErrorMsg(ps.filename,startline, -"String starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( c=='{' ){ /* A block of C code */ - int level; - cp++; - for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ - if( c=='\n' ) lineno++; - else if( c=='{' ) level++; - else if( c=='}' ) level--; - else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ - int prevc; - cp = &cp[2]; - prevc = 0; - while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ - if( c=='\n' ) lineno++; - prevc = c; - cp++; - } - }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ - cp = &cp[2]; - while( (c= *cp)!=0 && c!='\n' ) cp++; - if( c ) lineno++; - }else if( c=='\'' || c=='\"' ){ /* String a character literals */ - int startchar, prevc; - startchar = c; - prevc = 0; - for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ - if( c=='\n' ) lineno++; - if( prevc=='\\' ) prevc = 0; - else prevc = c; - } - } - } - if( c==0 ){ - ErrorMsg(ps.filename,ps.tokenlineno, -"C code starting on this line is not terminated before the end of the file."); - ps.errorcnt++; - nextcp = cp; - }else{ - nextcp = cp+1; - } - }else if( isalnum(c) ){ /* Identifiers */ - while( (c= *cp)!=0 && (isalnum(c) || c=='_') ) cp++; - nextcp = cp; - }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ - cp += 3; - nextcp = cp; - }else{ /* All other (one character) operators */ - cp++; - nextcp = cp; - } - c = *cp; - *cp = 0; /* Null terminate the token */ - parseonetoken(&ps); /* Parse the token */ - *cp = c; /* Restore the buffer */ - cp = nextcp; - } - free(filebuf); /* Release the buffer after parsing */ - gp->rule = ps.firstrule; - gp->errorcnt = ps.errorcnt; -} -/*************************** From the file "plink.c" *********************/ -static struct plink *plink_freelist = 0; - -/* Allocate a new plink */ -struct plink *Plink_new(){ - struct plink *new; - - if( plink_freelist==0 ){ - int i; - int amt = 100; - plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt ); - if( plink_freelist==0 ){ - fprintf(stderr, - "Unable to allocate memory for a new follow-set propagation link.\n"); - exit(1); - } - for(i=0; inext; - return new; -} - -/* Add a plink to a plink list */ -void Plink_add(plpp,cfp) -struct plink **plpp; -struct config *cfp; -{ - struct plink *new; - new = Plink_new(); - new->next = *plpp; - *plpp = new; - new->cfp = cfp; -} - -/* Transfer every plink on the list "from" to the list "to" */ -void Plink_copy(to,from) -struct plink **to; -struct plink *from; -{ - struct plink *nextpl; - while( from ){ - nextpl = from->next; - from->next = *to; - *to = from; - from = nextpl; - } -} - -/* Delete every plink on the list */ -void Plink_delete(plp) -struct plink *plp; -{ - struct plink *nextpl; - - while( plp ){ - nextpl = plp->next; - plp->next = plink_freelist; - plink_freelist = plp; - plp = nextpl; - } -} -/*********************** From the file "report.c" **************************/ - -/* Generate a filename with the given suffix. Space to hold the -** name comes from malloc() and must be freed by the calling -** function. -*/ -PRIVATE char *file_makename(lemp,suffix) -struct lemon *lemp; -char *suffix; -{ - char *name; - char *cp; - - name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } - strcpy(name,lemp->filename); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; - strcat(name,suffix); - return name; -} - -/* Open a file with a name based on the name of the input file, -** but with a different (specified) suffix, and return a pointer -** to the stream */ -PRIVATE FILE *file_open(lemp,suffix,mode) -struct lemon *lemp; -char *suffix; -char *mode; -{ - FILE *fp; - - if( lemp->outname ) free(lemp->outname); - lemp->outname = file_makename(lemp, suffix); - fp = fopen(lemp->outname,mode); - if( fp==0 && *mode=='w' ){ - fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); - lemp->errorcnt++; - return 0; - } - return fp; -} - -/* Duplicate the input file without comments and without actions -** on rules */ -void Reprint(lemp) -struct lemon *lemp; -{ - struct rule *rp; - struct symbol *sp; - int i, j, maxlen, len, ncolumns, skip; - printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); - maxlen = 10; - for(i=0; insymbol; i++){ - sp = lemp->symbols[i]; - len = strlen(sp->name); - if( len>maxlen ) maxlen = len; - } - ncolumns = 76/(maxlen+5); - if( ncolumns<1 ) ncolumns = 1; - skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; - for(i=0; insymbol; j+=skip){ - sp = lemp->symbols[j]; - assert( sp->index==j ); - printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); - } - printf("\n"); - } - for(rp=lemp->rule; rp; rp=rp->next){ - printf("%s",rp->lhs->name); -/* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ - printf(" ::="); - for(i=0; inrhs; i++){ - printf(" %s",rp->rhs[i]->name); -/* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ - } - printf("."); - if( rp->precsym ) printf(" [%s]",rp->precsym->name); -/* if( rp->code ) printf("\n %s",rp->code); */ - printf("\n"); - } -} - -void ConfigPrint(fp,cfp) -FILE *fp; -struct config *cfp; -{ - struct rule *rp; - int i; - rp = cfp->rp; - fprintf(fp,"%s ::=",rp->lhs->name); - for(i=0; i<=rp->nrhs; i++){ - if( i==cfp->dot ) fprintf(fp," *"); - if( i==rp->nrhs ) break; - fprintf(fp," %s",rp->rhs[i]->name); - } -} - -/* #define TEST */ -#ifdef TEST -/* Print a set */ -PRIVATE void SetPrint(out,set,lemp) -FILE *out; -char *set; -struct lemon *lemp; -{ - int i; - char *spacer; - spacer = ""; - fprintf(out,"%12s[",""); - for(i=0; interminal; i++){ - if( SetFind(set,i) ){ - fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); - spacer = " "; - } - } - fprintf(out,"]\n"); -} - -/* Print a plink chain */ -PRIVATE void PlinkPrint(out,plp,tag) -FILE *out; -struct plink *plp; -char *tag; -{ - while( plp ){ - fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->index); - ConfigPrint(out,plp->cfp); - fprintf(out,"\n"); - plp = plp->next; - } -} -#endif - -/* Print an action to the given file descriptor. Return FALSE if -** nothing was actually printed. -*/ -int PrintAction(struct action *ap, FILE *fp, int indent){ - int result = 1; - switch( ap->type ){ - case SHIFT: - fprintf(fp,"%*s shift %d",indent,ap->sp->name,ap->x.stp->index); - break; - case REDUCE: - fprintf(fp,"%*s reduce %d",indent,ap->sp->name,ap->x.rp->index); - break; - case ACCEPT: - fprintf(fp,"%*s accept",indent,ap->sp->name); - break; - case ERROR: - fprintf(fp,"%*s error",indent,ap->sp->name); - break; - case CONFLICT: - fprintf(fp,"%*s reduce %-3d ** Parsing conflict **", - indent,ap->sp->name,ap->x.rp->index); - break; - case SH_RESOLVED: - case RD_RESOLVED: - case NOT_USED: - result = 0; - break; - } - return result; -} - -/* Generate the "y.output" log file */ -void ReportOutput(lemp) -struct lemon *lemp; -{ - int i; - struct state *stp; - struct config *cfp; - struct action *ap; - FILE *fp; - - fp = file_open(lemp,".out","w"); - if( fp==0 ) return; - fprintf(fp," \b"); - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - fprintf(fp,"State %d:\n",stp->index); - if( lemp->basisflag ) cfp=stp->bp; - else cfp=stp->cfp; - while( cfp ){ - char buf[20]; - if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); - fprintf(fp," %5s ",buf); - }else{ - fprintf(fp," "); - } - ConfigPrint(fp,cfp); - fprintf(fp,"\n"); -#ifdef TEST - SetPrint(fp,cfp->fws,lemp); - PlinkPrint(fp,cfp->fplp,"To "); - PlinkPrint(fp,cfp->bplp,"From"); -#endif - if( lemp->basisflag ) cfp=cfp->bp; - else cfp=cfp->next; - } - fprintf(fp,"\n"); - for(ap=stp->ap; ap; ap=ap->next){ - if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - } - fclose(fp); - return; -} - -/* Search for the file "name" which is in the same directory as -** the exacutable */ -PRIVATE char *pathsearch(argv0,name,modemask) -char *argv0; -char *name; -int modemask; -{ - char *pathlist; - char *path,*cp; - char c; - extern int access(); - -#ifdef __WIN32__ - cp = strrchr(argv0,'\\'); -#else - cp = strrchr(argv0,'/'); -#endif - if( cp ){ - c = *cp; - *cp = 0; - path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); - *cp = c; - }else{ - extern char *getenv(); - pathlist = getenv("PATH"); - if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; - path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); - if( path!=0 ){ - while( *pathlist ){ - cp = strchr(pathlist,':'); - if( cp==0 ) cp = &pathlist[strlen(pathlist)]; - c = *cp; - *cp = 0; - sprintf(path,"%s/%s",pathlist,name); - *cp = c; - if( c==0 ) pathlist = ""; - else pathlist = &cp[1]; - if( access(path,modemask)==0 ) break; - } - } - } - return path; -} - -/* Given an action, compute the integer value for that action -** which is to be put in the action table of the generated machine. -** Return negative if no action should be generated. -*/ -PRIVATE int compute_action(lemp,ap) -struct lemon *lemp; -struct action *ap; -{ - int act; - switch( ap->type ){ - case SHIFT: act = ap->x.stp->index; break; - case REDUCE: act = ap->x.rp->index + lemp->nstate; break; - case ERROR: act = lemp->nstate + lemp->nrule; break; - case ACCEPT: act = lemp->nstate + lemp->nrule + 1; break; - default: act = -1; break; - } - return act; -} - -#define LINESIZE 1000 -/* The next cluster of routines are for reading the template file -** and writing the results to the generated parser */ -/* The first function transfers data from "in" to "out" until -** a line is seen which begins with "%%". The line number is -** tracked. -** -** if name!=0, then any word that begin with "Parse" is changed to -** begin with *name instead. -*/ -PRIVATE void tplt_xfer(name,in,out,lineno) -char *name; -FILE *in; -FILE *out; -int *lineno; -{ - int i, iStart; - char line[LINESIZE]; - while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ - (*lineno)++; - iStart = 0; - if( name ){ - for(i=0; line[i]; i++){ - if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 - && (i==0 || !isalpha(line[i-1])) - ){ - if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); - fprintf(out,"%s",name); - i += 4; - iStart = i+1; - } - } - } - fprintf(out,"%s",&line[iStart]); - } -} - -/* The next function finds the template file and opens it, returning -** a pointer to the opened file. */ -PRIVATE FILE *tplt_open(lemp) -struct lemon *lemp; -{ - static char templatename[] = "lempar.c"; - char buf[1000]; - FILE *in; - char *tpltname; - char *cp; - - cp = strrchr(lemp->filename,'.'); - if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); - }else{ - sprintf(buf,"%s.lt",lemp->filename); - } - if( access(buf,004)==0 ){ - tpltname = buf; - }else if( access(templatename,004)==0 ){ - tpltname = templatename; - }else{ - tpltname = pathsearch(lemp->argv0,templatename,0); - } - if( tpltname==0 ){ - fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", - templatename); - lemp->errorcnt++; - return 0; - } - in = fopen(tpltname,"r"); - if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - lemp->errorcnt++; - return 0; - } - return in; -} - -/* Print a string to the file and keep the linenumber up to date */ -PRIVATE void tplt_print(out,lemp,str,strln,lineno) -FILE *out; -struct lemon *lemp; -char *str; -int strln; -int *lineno; -{ - if( str==0 ) return; - fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++; - while( *str ){ - if( *str=='\n' ) (*lineno)++; - putc(*str,out); - str++; - } - fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2; - return; -} - -void emit_destructor_code(out,sp,lemp,lineno) -FILE *out; -struct symbol *sp; -struct lemon *lemp; -int *lineno; -{ - char *cp = 0; - - int linecnt = 0; - if( sp->type==TERMINAL ){ - cp = lemp->tokendest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename); - }else if( sp->destructor ){ - cp = sp->destructor; - fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename); - }else if( lemp->vardest ){ - cp = lemp->vardest; - if( cp==0 ) return; - fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename); - }else{ - assert( 0 ); /* Cannot happen */ - } - for(; *cp; cp++){ - if( *cp=='$' && cp[1]=='$' ){ - fprintf(out,"(yypminor->yy%d)",sp->dtnum); - cp++; - continue; - } - if( *cp=='\n' ) linecnt++; - fputc(*cp,out); - } - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - return; -} - -int has_destructor(sp, lemp) -struct symbol *sp; -struct lemon *lemp; -{ - int ret; - if( sp->type==TERMINAL ){ - ret = lemp->tokendest!=0; - }else{ - ret = lemp->vardest!=0 || sp->destructor!=0; - } - return ret; -} - -PRIVATE char *append_str(char *zText, int n, int p1, int p2){ - static char *z = 0; - static int alloced = 0; - static int used = 0; - int i, c; - char zInt[40]; - - if( zText==0 ){ - used = 0; - return z; - } - if( n<=0 ){ - if( n<0 ){ - used += n; - assert( used>=0 ); - } - n = strlen(zText); - } - if( n+sizeof(zInt)*2+used >= alloced ){ - alloced = n + sizeof(zInt)*2 + used + 200; - z = realloc(z, alloced); - } - if( z==0 ) return ""; - while( n-- > 0 ){ - c = *(zText++); - if( c=='%' && zText[0]=='d' ){ - sprintf(zInt, "%d", p1); - p1 = p2; - strcpy(&z[used], zInt); - used += strlen(&z[used]); - zText++; - n--; - }else{ - z[used++] = c; - } - } - z[used] = 0; - return z; -} - -PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){ - char *cp, *xp; - int i; - char lhsused = 0; /* True if the LHS element has been used */ - char used[MAXRHS]; /* True for each RHS element which is used */ - - for(i=0; inrhs; i++) used[i] = 0; - lhsused = 0; - - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ - char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); - saved = *xp; - *xp = 0; - if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ - append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0); - cp = xp; - lhsused = 1; - }else{ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ - if( cp!=rp->code && cp[-1]=='@' ){ - /* If the argument is of the form @X then substituted - ** the token number of X, not the value of X */ - append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); - }else{ - append_str("yymsp[%d].minor.yy%d",0, - i-rp->nrhs+1,rp->rhs[i]->dtnum); - } - cp = xp; - used[i] = 1; - break; - } - } - } - *xp = saved; - } - append_str(cp, 1, 0, 0); - } /* End loop */ - - /* Check to make sure the LHS has been used */ - if( rp->lhsalias && !lhsused ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label \"%s\" for \"%s(%s)\" is never used.", - rp->lhsalias,rp->lhs->name,rp->lhsalias); - lemp->errorcnt++; - } - - /* Generate destructor code for RHS symbols which are not used in the - ** reduce code */ - for(i=0; inrhs; i++){ - if( rp->rhsalias[i] && !used[i] ){ - ErrorMsg(lemp->filename,rp->ruleline, - "Label %s for \"%s(%s)\" is never used.", - rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); - lemp->errorcnt++; - }else if( rp->rhsalias[i]==0 ){ - if( has_destructor(rp->rhs[i],lemp) ){ - append_str(" yy_destructor(%d,&yymsp[%d].minor);\n", 0, - rp->rhs[i]->index,i-rp->nrhs+1); - }else{ - /* No destructor defined for this term */ - } - } - } - cp = append_str(0,0,0,0); - rp->code = Strsafe(cp); -} - -PRIVATE void emit_code(out,rp,lemp,lineno) -FILE *out; -struct rule *rp; -struct lemon *lemp; -int *lineno; -{ - char *cp; - int linecnt = 0; - - /* Generate code to do the reduce action */ - if( rp->code ){ - fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename); - fprintf(out,"%s",rp->code); - for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; - } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname); - } /* End if( rp->code ) */ - - return; -} - -void print_stack_union(out,lemp,plineno,mhflag) -FILE *out; /* The output stream */ -struct lemon *lemp; /* The main info structure for this parser */ -int *plineno; /* Pointer to the line number */ -int mhflag; /* True if generating makeheaders output */ -{ - int lineno = *plineno; /* The line number of the output */ - char **types; /* A hash table of datatypes */ - int arraysize; /* Size of the "types" array */ - int maxdtlength; /* Maximum length of any ".datatype" field. */ - char *stddt; /* Standardized name for a datatype */ - int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ - char *name; /* Name of the parser */ - - /* Allocate and initialize types[] and allocate stddt[] */ - arraysize = lemp->nsymbol * 2; - types = (char**)malloc( arraysize * sizeof(char*) ); - for(i=0; ivartype ){ - maxdtlength = strlen(lemp->vartype); - } - for(i=0; insymbol; i++){ - int len; - struct symbol *sp = lemp->symbols[i]; - if( sp->datatype==0 ) continue; - len = strlen(sp->datatype); - if( len>maxdtlength ) maxdtlength = len; - } - stddt = (char*)malloc( maxdtlength*2 + 1 ); - if( types==0 || stddt==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - - /* Build a hash table of datatypes. The ".dtnum" field of each symbol - ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is - ** used for terminal symbols. If there is no %default_type defined then - ** 0 is also used as the .dtnum value for nonterminals which do not specify - ** a datatype using the %type directive. - */ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - char *cp; - if( sp==lemp->errsym ){ - sp->dtnum = arraysize+1; - continue; - } - if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ - sp->dtnum = 0; - continue; - } - cp = sp->datatype; - if( cp==0 ) cp = lemp->vartype; - j = 0; - while( isspace(*cp) ) cp++; - while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; - stddt[j] = 0; - hash = 0; - for(j=0; stddt[j]; j++){ - hash = hash*53 + stddt[j]; - } - hash = (hash & 0x7fffffff)%arraysize; - while( types[hash] ){ - if( strcmp(types[hash],stddt)==0 ){ - sp->dtnum = hash + 1; - break; - } - hash++; - if( hash>=arraysize ) hash = 0; - } - if( types[hash]==0 ){ - sp->dtnum = hash + 1; - types[hash] = (char*)malloc( strlen(stddt)+1 ); - if( types[hash]==0 ){ - fprintf(stderr,"Out of memory.\n"); - exit(1); - } - strcpy(types[hash],stddt); - } - } - - /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ - name = lemp->name ? lemp->name : "Parse"; - lineno = *plineno; - if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } - fprintf(out,"#define %sTOKENTYPE %s\n",name, - lemp->tokentype?lemp->tokentype:"void*"); lineno++; - if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } - fprintf(out,"typedef union {\n"); lineno++; - fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; - for(i=0; ierrsym->dtnum); lineno++; - free(stddt); - free(types); - fprintf(out,"} YYMINORTYPE;\n"); lineno++; - *plineno = lineno; -} - -static const char *minimum_size_type(int lwr, int upr){ - if( lwr>=0 ){ - if( upr<=255 ){ - return "unsigned char"; - }else if( upr<65535 ){ - return "unsigned short int"; - }else{ - return "unsigned int"; - } - }else if( lwr>=-127 && upr<=127 ){ - return "signed char"; - }else if( lwr>=-32767 && upr<32767 ){ - return "short"; - }else{ - return "int"; - } -} - -struct axset { - struct state *stp; /* A pointer to a state */ - int isTkn; /* True to use tokens. False for non-terminals */ - int nAction; /* Number of actions */ -}; - -static int axset_compare(const void *a, const void *b){ - struct axset *p1 = (struct axset*)a; - struct axset *p2 = (struct axset*)b; - return p2->nAction - p1->nAction; -} - -/* Generate C source code for the parser */ -void ReportTable(lemp, mhflag) -struct lemon *lemp; -int mhflag; /* Output in makeheaders format if true */ -{ - FILE *out, *in; - char line[LINESIZE]; - int lineno; - struct state *stp; - struct action *ap; - struct rule *rp; - struct acttab *pActtab; - int i, j, n; - char *name; - int mnTknOfst, mxTknOfst; - int mnNtOfst, mxNtOfst; - struct axset *ax; - - in = tplt_open(lemp); - if( in==0 ) return; - out = file_open(lemp,".c","w"); - if( out==0 ){ - fclose(in); - return; - } - lineno = 1; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the include code, if any */ - tplt_print(out,lemp,lemp->include,lemp->includeln,&lineno); - if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate #defines for all tokens */ - if( mhflag ){ - char *prefix; - fprintf(out,"#if INTERFACE\n"); lineno++; - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - lineno++; - } - fprintf(out,"#endif\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the defines */ - fprintf(out,"#define YYCODETYPE %s\n", - minimum_size_type(0, lemp->nsymbol+5)); lineno++; - fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; - fprintf(out,"#define YYACTIONTYPE %s\n", - minimum_size_type(0, lemp->nstate+lemp->nrule+5)); lineno++; - print_stack_union(out,lemp,&lineno,mhflag); - if( lemp->stacksize ){ - if( atoi(lemp->stacksize)<=0 ){ - ErrorMsg(lemp->filename,0, -"Illegal stack size: [%s]. The stack size should be an integer constant.", - lemp->stacksize); - lemp->errorcnt++; - lemp->stacksize = "100"; - } - fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; - }else{ - fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; - } - if( mhflag ){ - fprintf(out,"#if INTERFACE\n"); lineno++; - } - name = lemp->name ? lemp->name : "Parse"; - if( lemp->arg && lemp->arg[0] ){ - int i; - i = strlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; - fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; - fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", - name,lemp->arg,&lemp->arg[i]); lineno++; - fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", - name,&lemp->arg[i],&lemp->arg[i]); lineno++; - }else{ - fprintf(out,"#define %sARG_SDECL\n",name); lineno++; - fprintf(out,"#define %sARG_PDECL\n",name); lineno++; - fprintf(out,"#define %sARG_FETCH\n",name); lineno++; - fprintf(out,"#define %sARG_STORE\n",name); lineno++; - } - if( mhflag ){ - fprintf(out,"#endif\n"); lineno++; - } - fprintf(out,"#define YYNSTATE %d\n",lemp->nstate); lineno++; - fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; - fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; - fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; - if( lemp->has_fallback ){ - fprintf(out,"#define YYFALLBACK 1\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the action table and its associates: - ** - ** yy_action[] A single table containing all actions. - ** yy_lookahead[] A table containing the lookahead for each entry in - ** yy_action. Used to detect hash collisions. - ** yy_shift_ofst[] For each state, the offset into yy_action for - ** shifting terminals. - ** yy_reduce_ofst[] For each state, the offset into yy_action for - ** shifting non-terminals after a reduce. - ** yy_default[] Default action for each state. - */ - - /* Compute the actions on all states and count them up */ - ax = malloc( sizeof(ax[0])*lemp->nstate*2 ); - if( ax==0 ){ - fprintf(stderr,"malloc failed\n"); - exit(1); - } - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - stp->nTknAct = stp->nNtAct = 0; - stp->iDflt = lemp->nstate + lemp->nrule; - stp->iTknOfst = NO_OFFSET; - stp->iNtOfst = NO_OFFSET; - for(ap=stp->ap; ap; ap=ap->next){ - if( compute_action(lemp,ap)>=0 ){ - if( ap->sp->indexnterminal ){ - stp->nTknAct++; - }else if( ap->sp->indexnsymbol ){ - stp->nNtAct++; - }else{ - stp->iDflt = compute_action(lemp, ap); - } - } - } - ax[i*2].stp = stp; - ax[i*2].isTkn = 1; - ax[i*2].nAction = stp->nTknAct; - ax[i*2+1].stp = stp; - ax[i*2+1].isTkn = 0; - ax[i*2+1].nAction = stp->nNtAct; - } - mxTknOfst = mnTknOfst = 0; - mxNtOfst = mnNtOfst = 0; - - /* Compute the action table. In order to try to keep the size of the - ** action table to a minimum, the heuristic of placing the largest action - ** sets first is used. - */ - qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare); - pActtab = acttab_alloc(); - for(i=0; instate*2 && ax[i].nAction>0; i++){ - stp = ax[i].stp; - if( ax[i].isTkn ){ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->index>=lemp->nterminal ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iTknOfst = acttab_insert(pActtab); - if( stp->iTknOfstiTknOfst; - if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; - }else{ - for(ap=stp->ap; ap; ap=ap->next){ - int action; - if( ap->sp->indexnterminal ) continue; - if( ap->sp->index==lemp->nsymbol ) continue; - action = compute_action(lemp, ap); - if( action<0 ) continue; - acttab_action(pActtab, ap->sp->index, action); - } - stp->iNtOfst = acttab_insert(pActtab); - if( stp->iNtOfstiNtOfst; - if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; - } - } - free(ax); - - /* Output the yy_action table */ - fprintf(out,"static YYACTIONTYPE yy_action[] = {\n"); lineno++; - n = acttab_size(pActtab); - for(i=j=0; insymbol + lemp->nrule + 2; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", action); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_lookahead table */ - fprintf(out,"static YYCODETYPE yy_lookahead[] = {\n"); lineno++; - for(i=j=0; insymbol; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", la); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_shift_ofst[] table */ - fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++; - fprintf(out, "static %s yy_shift_ofst[] = {\n", - minimum_size_type(mnTknOfst-1, mxTknOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iTknOfst; - if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the yy_reduce_ofst[] table */ - fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; - fprintf(out, "static %s yy_reduce_ofst[] = {\n", - minimum_size_type(mnNtOfst-1, mxNtOfst)); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - ofst = stp->iNtOfst; - if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", ofst); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - - /* Output the default action table */ - fprintf(out, "static YYACTIONTYPE yy_default[] = {\n"); lineno++; - n = lemp->nstate; - for(i=j=0; isorted[i]; - if( j==0 ) fprintf(out," /* %5d */ ", i); - fprintf(out, " %4d,", stp->iDflt); - if( j==9 || i==n-1 ){ - fprintf(out, "\n"); lineno++; - j = 0; - }else{ - j++; - } - } - fprintf(out, "};\n"); lineno++; - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of fallback tokens. - */ - if( lemp->has_fallback ){ - for(i=0; interminal; i++){ - struct symbol *p = lemp->symbols[i]; - if( p->fallback==0 ){ - fprintf(out, " 0, /* %10s => nothing */\n", p->name); - }else{ - fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, - p->name, p->fallback->name); - } - lineno++; - } - } - tplt_xfer(lemp->name, in, out, &lineno); - - /* Generate a table containing the symbolic name of every symbol - */ - for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); - fprintf(out," %-15s",line); - if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } - } - if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate a table containing a text string that describes every - ** rule in the rule set of the grammer. This information is used - ** when tracing REDUCE actions. - */ - for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ - assert( rp->index==i ); - fprintf(out," /* %3d */ \"%s ::=", i, rp->lhs->name); - for(j=0; jnrhs; j++) fprintf(out," %s",rp->rhs[j]->name); - fprintf(out,"\",\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes every time a symbol is popped from - ** the stack while processing errors or while destroying the parser. - ** (In other words, generate the %destructor actions) - */ - if( lemp->tokendest ){ - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type!=TERMINAL ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - } - for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); - if( insymbol ){ - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - - /* Combine duplicate destructors into a single case */ - for(j=i+1; jnsymbol; j++){ - struct symbol *sp2 = lemp->symbols[j]; - if( sp2 && sp2->type!=TERMINAL && sp2->destructor - && sp2->dtnum==sp->dtnum - && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d:\n",sp2->index); lineno++; - sp2->destructor = 0; - } - } - - emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - if( lemp->vardest ){ - struct symbol *dflt_sp = 0; - for(i=0; insymbol; i++){ - struct symbol *sp = lemp->symbols[i]; - if( sp==0 || sp->type==TERMINAL || - sp->index<=0 || sp->destructor!=0 ) continue; - fprintf(out," case %d:\n",sp->index); lineno++; - dflt_sp = sp; - } - if( dflt_sp!=0 ){ - emit_destructor_code(out,dflt_sp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes whenever the parser stack overflows */ - tplt_print(out,lemp,lemp->overflow,lemp->overflowln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate the table of rule information - ** - ** Note: This code depends on the fact that rules are number - ** sequentually beginning with 0. - */ - for(rp=lemp->rule; rp; rp=rp->next){ - fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which execution during each REDUCE action */ - for(rp=lemp->rule; rp; rp=rp->next){ - if( rp->code ) translate_code(lemp, rp); - } - for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; - if( rp->code==0 ) continue; - fprintf(out," case %d:\n",rp->index); lineno++; - for(rp2=rp->next; rp2; rp2=rp2->next){ - if( rp2->code==rp->code ){ - fprintf(out," case %d:\n",rp2->index); lineno++; - rp2->code = 0; - } - } - emit_code(out,rp,lemp,&lineno); - fprintf(out," break;\n"); lineno++; - } - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes if a parse fails */ - tplt_print(out,lemp,lemp->failure,lemp->failureln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when a syntax error occurs */ - tplt_print(out,lemp,lemp->error,lemp->errorln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Generate code which executes when the parser accepts its input */ - tplt_print(out,lemp,lemp->accept,lemp->acceptln,&lineno); - tplt_xfer(lemp->name,in,out,&lineno); - - /* Append any addition code the user desires */ - tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); - - fclose(in); - fclose(out); - return; -} - -/* Generate a header file for the parser */ -void ReportHeader(lemp) -struct lemon *lemp; -{ - FILE *out, *in; - char *prefix; - char line[LINESIZE]; - char pattern[LINESIZE]; - int i; - - if( lemp->tokenprefix ) prefix = lemp->tokenprefix; - else prefix = ""; - in = file_open(lemp,".h","r"); - if( in ){ - for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - if( strcmp(line,pattern) ) break; - } - fclose(in); - if( i==lemp->nterminal ){ - /* No change in the file. Don't rewrite it. */ - return; - } - } - out = file_open(lemp,".h","w"); - if( out ){ - for(i=1; interminal; i++){ - fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); - } - fclose(out); - } - return; -} - -/* Reduce the size of the action tables, if possible, by making use -** of defaults. -** -** In this version, we take the most frequent REDUCE action and make -** it the default. Only default a reduce if there are more than one. -*/ -void CompressTables(lemp) -struct lemon *lemp; -{ - struct state *stp; - struct action *ap, *ap2; - struct rule *rp, *rp2, *rbest; - int nbest, n; - int i; - - for(i=0; instate; i++){ - stp = lemp->sorted[i]; - nbest = 0; - rbest = 0; - - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type!=REDUCE ) continue; - rp = ap->x.rp; - if( rp==rbest ) continue; - n = 1; - for(ap2=ap->next; ap2; ap2=ap2->next){ - if( ap2->type!=REDUCE ) continue; - rp2 = ap2->x.rp; - if( rp2==rbest ) continue; - if( rp2==rp ) n++; - } - if( n>nbest ){ - nbest = n; - rbest = rp; - } - } - - /* Do not make a default if the number of rules to default - ** is not at least 2 */ - if( nbest<2 ) continue; - - - /* Combine matching REDUCE actions into a single default */ - for(ap=stp->ap; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) break; - } - assert( ap ); - ap->sp = Symbol_new("{default}"); - for(ap=ap->next; ap; ap=ap->next){ - if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; - } - stp->ap = Action_sort(stp->ap); - } -} - -/***************** From the file "set.c" ************************************/ - -static int size = 0; - -/* Set the set size */ -void SetSize(n) -int n; -{ - size = n+1; -} - -/* Allocate a new set */ -char *SetNew(){ - char *s; - int i; - s = (char*)malloc( size ); - if( s==0 ){ - extern void memory_error(); - memory_error(); - } - for(i=0; isize = 1024; - x1a->count = 0; - x1a->tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*1024 ); - if( x1a->tbl==0 ){ - free(x1a); - x1a = 0; - }else{ - int i; - x1a->ht = (x1node**)&(x1a->tbl[1024]); - for(i=0; i<1024; i++) x1a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Strsafe_insert(data) -char *data; -{ - x1node *np; - int h; - int ph; - - if( x1a==0 ) return 0; - ph = strhash(data); - h = ph & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x1a->count>=x1a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x1 array; - array.size = size = x1a->size*2; - array.count = x1a->count; - array.tbl = (x1node*)malloc( - (sizeof(x1node) + sizeof(x1node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x1node *oldnp, *newnp; - oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x1a->tbl); - *x1a = array; - } - /* Insert the new data */ - h = ph & (x1a->size-1); - np = &(x1a->tbl[x1a->count++]); - np->data = data; - if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); - np->next = x1a->ht[h]; - x1a->ht[h] = np; - np->from = &(x1a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -char *Strsafe_find(key) -char *key; -{ - int h; - x1node *np; - - if( x1a==0 ) return 0; - h = strhash(key) & (x1a->size-1); - np = x1a->ht[h]; - while( np ){ - if( strcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return a pointer to the (terminal or nonterminal) symbol "x". -** Create a new symbol if this is the first time "x" has been seen. -*/ -struct symbol *Symbol_new(x) -char *x; -{ - struct symbol *sp; - - sp = Symbol_find(x); - if( sp==0 ){ - sp = (struct symbol *)malloc( sizeof(struct symbol) ); - MemoryCheck(sp); - sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; - sp->rule = 0; - sp->fallback = 0; - sp->prec = -1; - sp->assoc = UNK; - sp->firstset = 0; - sp->lambda = B_FALSE; - sp->destructor = 0; - sp->datatype = 0; - Symbol_insert(sp,sp->name); - } - return sp; -} - -/* Compare two symbols for working purposes -** -** Symbols that begin with upper case letters (terminals or tokens) -** must sort before symbols that begin with lower case letters -** (non-terminals). Other than that, the order does not matter. -** -** We find experimentally that leaving the symbols in their original -** order (the order they appeared in the grammar file) gives the -** smallest parser tables in SQLite. -*/ -int Symbolcmpp(struct symbol **a, struct symbol **b){ - int i1 = (**a).index + 10000000*((**a).name[0]>'Z'); - int i2 = (**b).index + 10000000*((**b).name[0]>'Z'); - return i1-i2; -} - -/* There is one instance of the following structure for each -** associative array of type "x2". -*/ -struct s_x2 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x2node *tbl; /* The data stored here */ - struct s_x2node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x2". -*/ -typedef struct s_x2node { - struct symbol *data; /* The data */ - char *key; /* The key */ - struct s_x2node *next; /* Next entry with the same hash */ - struct s_x2node **from; /* Previous link */ -} x2node; - -/* There is only one instance of the array, which is the following */ -static struct s_x2 *x2a; - -/* Allocate a new associative array */ -void Symbol_init(){ - if( x2a ) return; - x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); - if( x2a ){ - x2a->size = 128; - x2a->count = 0; - x2a->tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*128 ); - if( x2a->tbl==0 ){ - free(x2a); - x2a = 0; - }else{ - int i; - x2a->ht = (x2node**)&(x2a->tbl[128]); - for(i=0; i<128; i++) x2a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Symbol_insert(data,key) -struct symbol *data; -char *key; -{ - x2node *np; - int h; - int ph; - - if( x2a==0 ) return 0; - ph = strhash(key); - h = ph & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x2a->count>=x2a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x2 array; - array.size = size = x2a->size*2; - array.count = x2a->count; - array.tbl = (x2node*)malloc( - (sizeof(x2node) + sizeof(x2node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x2node *oldnp, *newnp; - oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x2a->tbl); - *x2a = array; - } - /* Insert the new data */ - h = ph & (x2a->size-1); - np = &(x2a->tbl[x2a->count++]); - np->key = key; - np->data = data; - if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); - np->next = x2a->ht[h]; - x2a->ht[h] = np; - np->from = &(x2a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct symbol *Symbol_find(key) -char *key; -{ - int h; - x2node *np; - - if( x2a==0 ) return 0; - h = strhash(key) & (x2a->size-1); - np = x2a->ht[h]; - while( np ){ - if( strcmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return the n-th data. Return NULL if n is out of range. */ -struct symbol *Symbol_Nth(n) -int n; -{ - struct symbol *data; - if( x2a && n>0 && n<=x2a->count ){ - data = x2a->tbl[n-1].data; - }else{ - data = 0; - } - return data; -} - -/* Return the size of the array */ -int Symbol_count() -{ - return x2a ? x2a->count : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct symbol **Symbol_arrayof() -{ - struct symbol **array; - int i,size; - if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)malloc( sizeof(struct symbol *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Compare two configurations */ -int Configcmp(a,b) -struct config *a; -struct config *b; -{ - int x; - x = a->rp->index - b->rp->index; - if( x==0 ) x = a->dot - b->dot; - return x; -} - -/* Compare two states */ -PRIVATE int statecmp(a,b) -struct config *a; -struct config *b; -{ - int rc; - for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ - rc = a->rp->index - b->rp->index; - if( rc==0 ) rc = a->dot - b->dot; - } - if( rc==0 ){ - if( a ) rc = 1; - if( b ) rc = -1; - } - return rc; -} - -/* Hash a state */ -PRIVATE int statehash(a) -struct config *a; -{ - int h=0; - while( a ){ - h = h*571 + a->rp->index*37 + a->dot; - a = a->bp; - } - return h; -} - -/* Allocate a new state structure */ -struct state *State_new() -{ - struct state *new; - new = (struct state *)malloc( sizeof(struct state) ); - MemoryCheck(new); - return new; -} - -/* There is one instance of the following structure for each -** associative array of type "x3". -*/ -struct s_x3 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x3node *tbl; /* The data stored here */ - struct s_x3node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x3". -*/ -typedef struct s_x3node { - struct state *data; /* The data */ - struct config *key; /* The key */ - struct s_x3node *next; /* Next entry with the same hash */ - struct s_x3node **from; /* Previous link */ -} x3node; - -/* There is only one instance of the array, which is the following */ -static struct s_x3 *x3a; - -/* Allocate a new associative array */ -void State_init(){ - if( x3a ) return; - x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); - if( x3a ){ - x3a->size = 128; - x3a->count = 0; - x3a->tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*128 ); - if( x3a->tbl==0 ){ - free(x3a); - x3a = 0; - }else{ - int i; - x3a->ht = (x3node**)&(x3a->tbl[128]); - for(i=0; i<128; i++) x3a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int State_insert(data,key) -struct state *data; -struct config *key; -{ - x3node *np; - int h; - int ph; - - if( x3a==0 ) return 0; - ph = statehash(key); - h = ph & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x3a->count>=x3a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x3 array; - array.size = size = x3a->size*2; - array.count = x3a->count; - array.tbl = (x3node*)malloc( - (sizeof(x3node) + sizeof(x3node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x3node *oldnp, *newnp; - oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->key = oldnp->key; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x3a->tbl); - *x3a = array; - } - /* Insert the new data */ - h = ph & (x3a->size-1); - np = &(x3a->tbl[x3a->count++]); - np->key = key; - np->data = data; - if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); - np->next = x3a->ht[h]; - x3a->ht[h] = np; - np->from = &(x3a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct state *State_find(key) -struct config *key; -{ - int h; - x3node *np; - - if( x3a==0 ) return 0; - h = statehash(key) & (x3a->size-1); - np = x3a->ht[h]; - while( np ){ - if( statecmp(np->key,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Return an array of pointers to all data in the table. -** The array is obtained from malloc. Return NULL if memory allocation -** problems, or if the array is empty. */ -struct state **State_arrayof() -{ - struct state **array; - int i,size; - if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)malloc( sizeof(struct state *)*size ); - if( array ){ - for(i=0; itbl[i].data; - } - return array; -} - -/* Hash a configuration */ -PRIVATE int confighash(a) -struct config *a; -{ - int h=0; - h = h*571 + a->rp->index*37 + a->dot; - return h; -} - -/* There is one instance of the following structure for each -** associative array of type "x4". -*/ -struct s_x4 { - int size; /* The number of available slots. */ - /* Must be a power of 2 greater than or */ - /* equal to 1 */ - int count; /* Number of currently slots filled */ - struct s_x4node *tbl; /* The data stored here */ - struct s_x4node **ht; /* Hash table for lookups */ -}; - -/* There is one instance of this structure for every data element -** in an associative array of type "x4". -*/ -typedef struct s_x4node { - struct config *data; /* The data */ - struct s_x4node *next; /* Next entry with the same hash */ - struct s_x4node **from; /* Previous link */ -} x4node; - -/* There is only one instance of the array, which is the following */ -static struct s_x4 *x4a; - -/* Allocate a new associative array */ -void Configtable_init(){ - if( x4a ) return; - x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); - if( x4a ){ - x4a->size = 64; - x4a->count = 0; - x4a->tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*64 ); - if( x4a->tbl==0 ){ - free(x4a); - x4a = 0; - }else{ - int i; - x4a->ht = (x4node**)&(x4a->tbl[64]); - for(i=0; i<64; i++) x4a->ht[i] = 0; - } - } -} -/* Insert a new record into the array. Return TRUE if successful. -** Prior data with the same key is NOT overwritten */ -int Configtable_insert(data) -struct config *data; -{ - x4node *np; - int h; - int ph; - - if( x4a==0 ) return 0; - ph = confighash(data); - h = ph & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,data)==0 ){ - /* An existing entry with the same key is found. */ - /* Fail because overwrite is not allows. */ - return 0; - } - np = np->next; - } - if( x4a->count>=x4a->size ){ - /* Need to make the hash table bigger */ - int i,size; - struct s_x4 array; - array.size = size = x4a->size*2; - array.count = x4a->count; - array.tbl = (x4node*)malloc( - (sizeof(x4node) + sizeof(x4node*))*size ); - if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ - x4node *oldnp, *newnp; - oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); - newnp = &(array.tbl[i]); - if( array.ht[h] ) array.ht[h]->from = &(newnp->next); - newnp->next = array.ht[h]; - newnp->data = oldnp->data; - newnp->from = &(array.ht[h]); - array.ht[h] = newnp; - } - free(x4a->tbl); - *x4a = array; - } - /* Insert the new data */ - h = ph & (x4a->size-1); - np = &(x4a->tbl[x4a->count++]); - np->data = data; - if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); - np->next = x4a->ht[h]; - x4a->ht[h] = np; - np->from = &(x4a->ht[h]); - return 1; -} - -/* Return a pointer to data assigned to the given key. Return NULL -** if no such key. */ -struct config *Configtable_find(key) -struct config *key; -{ - int h; - x4node *np; - - if( x4a==0 ) return 0; - h = confighash(key) & (x4a->size-1); - np = x4a->ht[h]; - while( np ){ - if( Configcmp(np->data,key)==0 ) break; - np = np->next; - } - return np ? np->data : 0; -} - -/* Remove all data from the table. Pass each data to the function "f" -** as it is removed. ("f" may be null to avoid this step.) */ -void Configtable_clear(f) -int(*f)(/* struct config * */); -{ - int i; - if( x4a==0 || x4a->count==0 ) return; - if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); - for(i=0; isize; i++) x4a->ht[i] = 0; - x4a->count = 0; - return; -} - - -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -%% -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -%% -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** ParseTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -%% -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -%% -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { -%% -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ - ParseARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *yyTokenName[] = { -%% -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *yyRuleName[] = { -%% -}; -#endif /* NDEBUG */ - -const char *ParseTokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; -#endif -} - -void *ParseAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ -%% - default: break; /* If no destructor action specified: do nothing */ - } -} - -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); -} - -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; - } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ - ParseARG_FETCH; - yypParser->yyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { -%% -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno - ** { ... } // User supplied code - ** #line - ** break; - */ -%% - }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); - } -} - -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH; -#define TOKEN (yyminor.yy0) -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -%% - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); - ParseARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; - }else{ - yymajor = YYNOCODE; - } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - - -#if PHP_VERSION_ID < 70000 -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php5.lemon" - - -// 12 "parser.php5.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval* vv40; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; + } +// 562 "scanner.re" -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ + } -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; + return status; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; +#ifdef HAVE_CONFIG_H #endif -} -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_Status) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Query, Status, phalcon, mvc_model_query_status, phalcon_mvc_model_query_status_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_success"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_query_status_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_query_status_ce TSRMLS_CC, 1, phalcon_mvc_model_query_statusinterface_ce); + return SUCCESS; + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 155 "parser.php5.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); - } - efree((vvpminor->vv0)); +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, __construct) { + + zval *success_param = NULL, *model = NULL; + zend_bool success; + + zephir_fetch_params(0, 1, 1, &success_param, &model); + + success = zephir_get_boolval(success_param); + if (!model) { + model = ZEPHIR_GLOBAL(global_null); } -} -// 1133 "parser.php5.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 172 "parser.php5.lemon" -{ -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(vvpminor->vv40)); -#endif -} -// 1175 "parser.php5.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; -} + if (success) { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_success"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getModel) { -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } -} + + + RETURN_MEMBER(this_ptr, "_model"); -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *model = NULL; + int ZEPHIR_LAST_CALL_STATUS; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 164 "parser.php5.lemon" -{ - status->ret = vvmsp[0].minor.vv40; -} -// 1544 "parser.php5.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 168 "parser.php5.lemon" -{ - vvgotominor.vv40 = vvmsp[0].minor.vv40; -} -// 1572 "parser.php5.c" - break; - case 2: -// 178 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); -} -// 1579 "parser.php5.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 182 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); -} -// 1590 "parser.php5.c" - break; - case 24: -// 278 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1603 "parser.php5.c" - break; - case 25: -// 282 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1616 "parser.php5.c" - break; - case 26: -// 286 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1632 "parser.php5.c" - break; - case 27: -// 290 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1648 "parser.php5.c" - break; - case 28: -// 294 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1664 "parser.php5.c" - break; - case 29: -// 304 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1674 "parser.php5.c" - break; - case 30: -// 314 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1684 "parser.php5.c" - break; - case 31: -// 324 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1698 "parser.php5.c" - break; - case 32: -// 328 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1713 "parser.php5.c" - break; - case 33: -// 332 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1728 "parser.php5.c" - break; - case 34: -// 336 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1744 "parser.php5.c" - break; - case 35: -// 346 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1754 "parser.php5.c" - break; - case 36: - case 48: - case 134: - case 141: -// 356 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); - vv_destructor(2,&vvmsp[-1].minor); -} -// 1765 "parser.php5.c" - break; - case 38: -// 370 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); -} -// 1773 "parser.php5.c" - break; - case 39: -// 374 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); -} -// 1781 "parser.php5.c" - break; - case 40: -// 378 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); -} -// 1789 "parser.php5.c" - break; - case 41: -// 382 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); -} -// 1797 "parser.php5.c" - break; - case 42: -// 386 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); -} -// 1805 "parser.php5.c" - break; - case 43: - case 67: - case 133: - case 145: -// 390 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); -} -// 1815 "parser.php5.c" - break; - case 44: - case 127: -// 394 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); -} -// 1825 "parser.php5.c" - break; - case 45: - case 116: -// 398 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); } -// 1834 "parser.php5.c" - break; - case 46: -// 408 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Query_Status, success) { + + + + RETURN_MEMBER(this_ptr, "_success"); + } -// 1849 "parser.php5.c" - break; - case 47: -// 412 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Query_StatusInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Query, StatusInterface, phalcon, mvc_model_query_statusinterface, phalcon_mvc_model_query_statusinterface_method_entry); + + return SUCCESS; + } -// 1864 "parser.php5.c" - break; - case 50: -// 436 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getModel); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, getMessages); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Query_StatusInterface, success); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Complex, phalcon, mvc_model_resultset_complex, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_complex_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_complex_ce, SL("_columnTypes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_complex_ce, SL("_disableHydration"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_resultset_complex_ce TSRMLS_CC, 1, phalcon_mvc_model_resultsetinterface_ce); + return SUCCESS; + } -// 1871 "parser.php5.c" - break; - case 51: -// 440 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnTypes, *result = NULL, *cache = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &columnTypes, &result, &cache); + + if (!result) { + result = ZEPHIR_GLOBAL(global_null); + } + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_columnTypes"), columnTypes TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_complex_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1879 "parser.php5.c" - break; - case 52: - case 66: - case 132: - case 146: -// 444 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { + + zend_class_entry *_13$$15; + HashTable *_3, *_6$$11; + HashPosition _2, _5$$11; + zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; + zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; + int ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); + RETURN_CCTOR(row); + } + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_INIT_NVAR(activeRow); + object_init_ex(activeRow, phalcon_mvc_model_row_ce); + if (zephir_has_constructor(activeRow TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); + zephir_check_call_status(); + } + break; + } + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + ZEPHIR_INIT_NVAR(activeRow); + array_init(activeRow); + break; + } + ZEPHIR_INIT_NVAR(activeRow); + object_init(activeRow); + break; + } while(0); + + dirtyState = 0; + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); + zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HMKEY(alias, _3, _2); + ZEPHIR_GET_HVALUE(column, _4); + if (Z_TYPE_P(column) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); + return; + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); + if (ZEPHIR_IS_STRING(type, "object")) { + ZEPHIR_OBS_NVAR(source); + zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); + ZEPHIR_OBS_NVAR(attributes); + zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); + ZEPHIR_OBS_NVAR(columnMap); + zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); + ZEPHIR_INIT_NVAR(rowModel); + array_init(rowModel); + zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); + for ( + ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$11, &_5$$11) + ) { + ZEPHIR_GET_HVALUE(attribute, _7$$11); + ZEPHIR_OBS_NVAR(columnValue); + ZEPHIR_INIT_LNVAR(_8$$12); + ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); + zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); + zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); + } + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + ZEPHIR_OBS_NVAR(keepSnapshots); + if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(keepSnapshots); + ZVAL_BOOL(keepSnapshots, 0); + } + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_NVAR(_9$$15); + zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); + if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { + zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); + ZEPHIR_INIT_NVAR(modelName); + zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_12$$15); + ZVAL_LONG(_12$$15, dirtyState); + _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); + zephir_check_call_status(); + } else { + zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_16$$18); + ZVAL_LONG(_16$$18, dirtyState); + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + ZEPHIR_OBS_NVAR(attribute); + zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(sqlAlias); + if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { + ZEPHIR_OBS_NVAR(value); + zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(value); + zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); + } + if (zephir_array_isset_string(column, SS("balias"))) { + ZEPHIR_CPY_WRT(attribute, alias); + } else { + ZEPHIR_SINIT_NVAR(_18$$24); + ZVAL_STRING(&_18$$24, "_", 0); + ZEPHIR_SINIT_NVAR(_19$$24); + ZVAL_STRING(&_19$$24, "", 0); + ZEPHIR_INIT_NVAR(attribute); + zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); + } + } + if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { + do { + if (ZEPHIR_IS_LONG(hydrateMode, 1)) { + zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); + break; + } + zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); + break; + } while(0); + + } + } + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1889 "parser.php5.c" - break; - case 53: - case 147: -// 448 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) { + + zval *records = NULL, *current = NULL, *_0 = NULL; + zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL, *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(records); + array_init(records); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", NULL, 78); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0, this_ptr, "valid", &_1, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0))) { + break; + } + ZEPHIR_CALL_METHOD(¤t, this_ptr, "current", &_2, 338); + zephir_check_call_status(); + zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 263); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "next", &_3, 0); + zephir_check_call_status(); + } + RETURN_CCTOR(records); + } -// 1897 "parser.php5.c" - break; - case 54: - case 148: -// 452 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) { + + zval *_0; + zval *records = NULL, *cache = NULL, *columnTypes = NULL, *hydrateMode = NULL, *serialized = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&records, this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(cache); + zephir_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnTypes); + zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 4, 0 TSRMLS_CC); + zephir_array_update_string(&_0, SL("cache"), &cache, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("rows"), &records, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("columnTypes"), &columnTypes, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("hydrateMode"), &hydrateMode, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_CCTOR(serialized); + } -// 1905 "parser.php5.c" - break; - case 55: - case 149: -// 456 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + if (1) { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_disableHydration"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 310); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 313 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_2); + ZVAL_LONG(_2, zephir_fast_count_int(_1 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _2 TSRMLS_CC); + zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 315 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 316 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 317 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1914 "parser.php5.c" - break; - case 56: - case 150: -// 460 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Resultset, Simple, phalcon, mvc_model_resultset_simple, phalcon_mvc_model_resultset_ce, phalcon_mvc_model_resultset_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_resultset_simple_ce, SL("_columnMap"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_resultset_simple_ce, SL("_keepSnapshots"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 1923 "parser.php5.c" - break; - case 57: - case 151: -// 464 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *columnMap, *model, *result, *cache = NULL, *keepSnapshots = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 2, &columnMap, &model, &result, &cache, &keepSnapshots); + + if (!cache) { + cache = ZEPHIR_GLOBAL(global_null); + } + if (!keepSnapshots) { + keepSnapshots = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), columnMap TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), keepSnapshots TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_resultset_simple_ce, this_ptr, "__construct", &_0, 337, result, cache); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 1932 "parser.php5.c" - break; - case 58: -// 474 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { + + zend_class_entry *_5$$6; + zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(activeRow); + zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); + if (Z_TYPE_P(activeRow) != IS_NULL) { + RETURN_CCTOR(activeRow); + } + ZEPHIR_OBS_VAR(row); + zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(row) != IS_ARRAY) { + if (0) { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_VAR(hydrateMode); + zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + do { + if (ZEPHIR_IS_LONG(hydrateMode, 0)) { + if (ZEPHIR_GLOBAL(orm).late_state_binding) { + ZEPHIR_OBS_VAR(_0$$6); + zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); + if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { + _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(modelName); + zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(modelName); + ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); + } + _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_4$$6); + ZVAL_LONG(_4$$6, 0); + _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); + zephir_check_call_status(); + } else { + _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); + _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_9$$9); + ZVAL_LONG(_9$$9, 0); + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 339, _7$$9, row, columnMap, _9$$9, _8$$9); + zephir_check_call_status(); + } + break; + } + ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 340, row, columnMap, hydrateMode); + zephir_check_call_status(); + break; + } while(0); + + zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); + RETURN_CCTOR(activeRow); + } -// 1947 "parser.php5.c" - break; - case 59: -// 478 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { + + HashTable *_2$$7, *_5$$8; + HashPosition _1$$7, _4$$8; + zephir_fcall_cache_entry *_9 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; + zend_bool renameColumns; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &renameColumns_param); + + if (!renameColumns_param) { + renameColumns = 1; + } else { + renameColumns = zephir_get_boolval(renameColumns_param); + } + + + ZEPHIR_OBS_VAR(records); + zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); + if (Z_TYPE_P(records) != IS_ARRAY) { + ZEPHIR_OBS_VAR(result); + zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); + if (Z_TYPE_P(_0$$3) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); + } + if (renameColumns) { + ZEPHIR_OBS_VAR(columnMap); + zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + RETURN_CCTOR(records); + } + ZEPHIR_INIT_VAR(renamedRecords); + array_init(renamedRecords); + if (Z_TYPE_P(records) == IS_ARRAY) { + zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 217); + for ( + ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) + ) { + ZEPHIR_GET_HVALUE(record, _3$$7); + ZEPHIR_INIT_NVAR(renamed); + array_init(renamed); + zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 215); + for ( + ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS + ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) + ) { + ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); + ZEPHIR_GET_HVALUE(value, _6$$8); + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 199 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(renamedKey) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(renamedKey); + if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_10$$12); + object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_11$$12); + ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 205 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); + } + zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 215); + } + } + RETURN_CCTOR(renamedRecords); + } + RETURN_CCTOR(records); + } -// 1962 "parser.php5.c" - break; - case 60: -// 488 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { + + zval *_1 = NULL, *_2 = NULL, *_3; + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 6, 0 TSRMLS_CC); + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(_3); + ZVAL_BOOL(_3, 0); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); + zephir_check_call_status(); + zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("keepSnapshots"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1971 "parser.php5.c" - break; - case 61: -// 498 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *resultset = NULL, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7; + zval *data = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + + if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(data_param) == IS_STRING)) { + zephir_get_strval(data, data_param); + } else { + ZEPHIR_INIT_VAR(data); + ZVAL_EMPTY_STRING(data); + } + + + ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", NULL, 66, data); + zephir_check_call_status(); + if (Z_TYPE_P(resultset) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 252); + return; + } + zephir_array_fetch_string(&_0, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_model"), _0 TSRMLS_CC); + zephir_array_fetch_string(&_1, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 256 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC); + zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 257 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_3); + ZVAL_LONG(_3, zephir_fast_count_int(_2 TSRMLS_CC)); + zephir_update_property_this(this_ptr, SL("_count"), _3 TSRMLS_CC); + zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 258 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC); + zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 259 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC); + zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 260 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC); + zephir_array_fetch_string(&_7, resultset, SL("keepSnapshots"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 261 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_keepSnapshots"), _7 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 1980 "parser.php5.c" - break; - case 62: -// 508 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Exception, phalcon, mvc_model_transaction_exception, phalcon_mvc_model_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1993 "parser.php5.c" - break; - case 63: -// 512 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Failed) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Transaction, Failed, phalcon, mvc_model_transaction_failed, phalcon_mvc_model_transaction_exception_ce, phalcon_mvc_model_transaction_failed_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_failed_ce, SL("_record"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2006 "parser.php5.c" - break; - case 64: -// 522 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *message_param = NULL, *record = NULL; + zval *message = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &record); + + if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(message, message_param); + } else { + ZEPHIR_INIT_VAR(message); + ZVAL_EMPTY_STRING(message); + } + if (!record) { + record = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_record"), record TSRMLS_CC); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_transaction_failed_ce, this_ptr, "__construct", NULL, 0, message); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2019 "parser.php5.c" - break; - case 65: -// 526 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { + + zval *record = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(record); + zephir_read_property_this(&record, this_ptr, SL("_record"), PH_NOISY_CC); + if (Z_TYPE_P(record) != IS_NULL) { + ZEPHIR_RETURN_CALL_METHOD(record, "getmessages", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmessage", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2032 "parser.php5.c" - break; - case 68: -// 550 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecord) { + + + + RETURN_MEMBER(this_ptr, "_record"); + } -// 2045 "parser.php5.c" - break; - case 69: -// 560 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_Manager) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model\\Transaction, Manager, phalcon, mvc_model_transaction_manager, phalcon_mvc_model_transaction_manager_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_initialized"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_model_transaction_manager_ce, SL("_rollbackPendent"), 1, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_model_transaction_manager_ce, SL("_number"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_model_transaction_manager_ce, SL("_service"), "db", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_model_transaction_manager_ce, SL("_transactions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_mvc_model_transaction_managerinterface_ce); + zend_class_implements(phalcon_mvc_model_transaction_manager_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2055 "parser.php5.c" - break; - case 70: -// 570 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *dependencyInjector = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &dependencyInjector); + + if (!dependencyInjector) { + ZEPHIR_CPY_WRT(dependencyInjector, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(dependencyInjector); + } + + + if (!(zephir_is_true(dependencyInjector))) { + ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_0, 1); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 101); + return; + } + ZEPHIR_MM_RESTORE(); + } -// 2065 "parser.php5.c" - break; - case 71: -// 574 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2076 "parser.php5.c" - break; - case 72: -// 584 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2086 "parser.php5.c" - break; - case 73: -// 594 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setDbService) { + + zval *service_param = NULL; + zval *service = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &service_param); + + if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(service_param) == IS_STRING)) { + zephir_get_strval(service, service_param); + } else { + ZEPHIR_INIT_VAR(service); + ZVAL_EMPTY_STRING(service); + } + + + zephir_update_property_this(this_ptr, SL("_service"), service TSRMLS_CC); + RETURN_THIS(); + } -// 2096 "parser.php5.c" - break; - case 74: -// 604 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getDbService) { + + + + RETURN_MEMBER(this_ptr, "_service"); + } -// 2110 "parser.php5.c" - break; - case 75: -// 608 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, setRollbackPendent) { + + zval *rollbackPendent_param = NULL; + zend_bool rollbackPendent; + + zephir_fetch_params(0, 1, 0, &rollbackPendent_param); + + rollbackPendent = zephir_get_boolval(rollbackPendent_param); + + + if (rollbackPendent) { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_rollbackPendent"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + RETURN_THISW(); + } -// 2124 "parser.php5.c" - break; - case 76: -// 618 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getRollbackPendent) { + + + + RETURN_MEMBER(this_ptr, "_rollbackPendent"); + } -// 2134 "parser.php5.c" - break; - case 77: -// 628 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, has) { + + zval *_0; + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + RETURN_BOOL(ZEPHIR_GT_LONG(_0, 0)); + } -// 2144 "parser.php5.c" - break; - case 78: -// 638 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, get) { + + zval *_2$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *_0, *_4, *_1$$3, *_3$$4; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_rollbackPendent"), PH_NOISY_CC); + if (zephir_is_true(_1$$3)) { + ZEPHIR_INIT_VAR(_2$$4); + zephir_create_array(_2$$4, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$4, this_ptr); + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "rollbackPendent", 1); + zephir_array_fast_append(_2$$4, _3$$4); + ZEPHIR_CALL_FUNCTION(NULL, "register_shutdown_function", NULL, 343, _2$$4); + zephir_check_call_status(); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(_4); + if (autoBegin) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getorcreatetransaction", NULL, 0, _4); + zephir_check_call_status(); + RETURN_MM(); + } -// 2151 "parser.php5.c" - break; - case 79: -// 648 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { + + HashTable *_2$$5; + HashPosition _1$$5; + int ZEPHIR_LAST_CALL_STATUS; + zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; + zend_bool autoBegin; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &autoBegin_param); + + if (!autoBegin_param) { + autoBegin = 1; + } else { + autoBegin = zephir_get_boolval(autoBegin_param); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 189); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); + if (zephir_is_true(_0)) { + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 201); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(transaction, _3$$5); + if (Z_TYPE_P(transaction) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_BOOL(_4$$7, 0); + ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); + zephir_check_call_status(); + RETURN_CCTOR(transaction); + } + } + } + } + ZEPHIR_INIT_NVAR(transaction); + object_init_ex(transaction, phalcon_mvc_model_transaction_ce); + _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_6); + if (autoBegin) { + ZVAL_BOOL(_6, 1); + } else { + ZVAL_BOOL(_6, 0); + } + ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 344, dependencyInjector, _6, _5); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 345, this_ptr); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); + RETURN_CCTOR(transaction); + } -// 2159 "parser.php5.c" - break; - case 80: -// 652 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollbackPendent) { + + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2167 "parser.php5.c" - break; - case 81: -// 656 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 234); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2175 "parser.php5.c" - break; - case 82: -// 660 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, rollback) { + + HashTable *_1$$3; + HashPosition _0$$3; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *collect = NULL, *transactions = NULL, *transaction = NULL, *connection = NULL, **_2$$3, *_3$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &collect); + + if (!collect) { + collect = ZEPHIR_GLOBAL(global_true); + } + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (Z_TYPE_P(transactions) == IS_ARRAY) { + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 259); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(transaction, _2$$3); + ZEPHIR_CALL_METHOD(&connection, transaction, "getconnection", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3$$4, connection, "isundertransaction", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(_3$$4)) { + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, connection, "close", NULL, 0); + zephir_check_call_status(); + } + if (zephir_is_true(collect)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", &_4, 0, transaction); + zephir_check_call_status(); + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2183 "parser.php5.c" - break; - case 83: -// 664 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyRollback) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2191 "parser.php5.c" - break; - case 84: -// 668 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, notifyCommit) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *transaction; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_collecttransaction", NULL, 0, transaction); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2200 "parser.php5.c" - break; - case 85: -// 672 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, _collectTransaction) { + + HashTable *_1$$3; + HashPosition _0$$3; + zval *transaction, *transactions = NULL, *newTransactions = NULL, *managedTransaction = NULL, **_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &transaction); + + + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(newTransactions); + array_init(newTransactions); + zephir_is_iterable(transactions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 296); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(managedTransaction, _2$$3); + if (!ZEPHIR_IS_EQUAL(managedTransaction, transaction)) { + zephir_array_append(&newTransactions, transaction, PH_SEPARATE, "phalcon/mvc/model/transaction/manager.zep", 290); + } else { + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + } + zephir_update_property_this(this_ptr, SL("_transactions"), newTransactions TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2208 "parser.php5.c" - break; - case 86: -// 676 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions) { + + HashTable *_2$$3; + HashPosition _1$$3; + zval *transactions = NULL, *_0$$3 = NULL, **_3$$3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(transactions); + zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); + if (zephir_fast_count_int(transactions TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_0$$3); + zephir_is_iterable(transactions, &_2$$3, &_1$$3, 0, 0, "phalcon/mvc/model/transaction/manager.zep", 312); + for ( + ; zephir_hash_get_current_data_ex(_2$$3, (void**) &_3$$3, &_1$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$3, &_1$$3) + ) { + ZEPHIR_GET_HVALUE(_0$$3, _3$$3); + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_number") TSRMLS_CC)); + } + zephir_update_property_this(this_ptr, SL("_transactions"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2217 "parser.php5.c" - break; - case 87: -// 680 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Transaction_ManagerInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model\\Transaction, ManagerInterface, phalcon, mvc_model_transaction_managerinterface, phalcon_mvc_model_transaction_managerinterface_method_entry); + + return SUCCESS; + } -// 2225 "parser.php5.c" - break; - case 88: -// 684 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, has); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, get); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollbackPendent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, commit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, rollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyRollback); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, notifyCommit); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_Transaction_ManagerInterface, collectTransactions); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Email, phalcon, mvc_model_validator_email, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_email_method_entry, 0); + + return SUCCESS; + } -// 2233 "parser.php5.c" - break; - case 89: -// 688 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 274); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must have a valid e-mail format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Email", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2241 "parser.php5.c" - break; - case 90: -// 692 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Exclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Exclusionin, phalcon, mvc_model_validator_exclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_exclusionin_method_entry, 0); + + return SUCCESS; + } -// 2249 "parser.php5.c" - break; - case 91: -// 696 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Exclusionin, validate) { + + zval *_5$$7; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$7 = NULL, *_6$$7 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/exclusionin.zep", 70); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required by this validator", "phalcon/mvc/model/validator/exclusionin.zep", 77); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/exclusionin.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if (zephir_fast_in_array(value, domain TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_4$$7); + ZVAL_STRING(_4$$7, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must not be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_4$$7); + zephir_fast_join_str(_4$$7, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_5$$7, SL(":domain"), &_4$$7, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_6$$7, "strtr", NULL, 26, message, _5$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_4$$7); + ZVAL_STRING(_4$$7, "Exclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _6$$7, field, _4$$7); + zephir_check_temp_parameter(_4$$7); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2257 "parser.php5.c" - break; - case 92: -// 700 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Inclusionin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Inclusionin, phalcon, mvc_model_validator_inclusionin, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_inclusionin_method_entry, 0); + + return SUCCESS; + } -// 2265 "parser.php5.c" - break; - case 93: -// 704 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Inclusionin, validate) { + + zval *_8$$9; + zend_bool _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *domain = NULL, *value = NULL, *message = NULL, *strict = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6 = NULL, *_5$$7, *_7$$9 = NULL, *_9$$9 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/inclusionin.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'domain' is required for this validator", "phalcon/mvc/model/validator/inclusionin.zep", 75); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "domain", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(domain) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'domain' must be an array", "phalcon/mvc/model/validator/inclusionin.zep", 80); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(strict); + ZVAL_BOOL(strict, 0); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_4)) { + if (Z_TYPE_P(strict) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Option 'strict' must be a boolean", "phalcon/mvc/model/validator/inclusionin.zep", 92); + return; + } + ZEPHIR_INIT_VAR(_5$$7); + ZVAL_STRING(_5$$7, "strict", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, _5$$7); + zephir_check_temp_parameter(_5$$7); + zephir_check_call_status(); + } + ZEPHIR_CALL_FUNCTION(&_6, "in_array", NULL, 346, value, domain, strict); + zephir_check_call_status(); + if (!(zephir_is_true(_6))) { + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' must be part of list: :domain", 1); + } + ZEPHIR_INIT_VAR(_8$$9); + zephir_create_array(_8$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_7$$9); + zephir_fast_join_str(_7$$9, SL(", "), domain TSRMLS_CC); + zephir_array_update_string(&_8$$9, SL(":domain"), &_7$$9, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_9$$9, "strtr", NULL, 26, message, _8$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_7$$9); + ZVAL_STRING(_7$$9, "Inclusion", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _9$$9, field, _7$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2273 "parser.php5.c" - break; - case 94: -// 708 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Ip) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Ip, phalcon, mvc_model_validator_ip, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_ip_method_entry, 0); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_4"), 1048576 TSRMLS_CC); + + zend_declare_class_constant_long(phalcon_mvc_model_validator_ip_ce, SL("VERSION_6"), 2097152 TSRMLS_CC); + + return SUCCESS; + } -// 2282 "parser.php5.c" - break; - case 95: -// 712 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Ip, validate) { + + zval *_6, *_12$$5; + zend_bool _5; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *version = NULL, *allowPrivate = NULL, *allowReserved = NULL, *options = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10$$5 = NULL, *_11$$5, *_13$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/ip.zep", 99); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "version", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_1); + ZVAL_LONG(_1, (1048576 | 2097152)); + ZEPHIR_CALL_METHOD(&version, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowPrivate", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_2)) { + ZEPHIR_INIT_VAR(allowPrivate); + ZVAL_LONG(allowPrivate, 0); + } else { + ZEPHIR_INIT_NVAR(allowPrivate); + ZVAL_LONG(allowPrivate, 8388608); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowReserved", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (zephir_is_true(_3)) { + ZEPHIR_INIT_VAR(allowReserved); + ZVAL_LONG(allowReserved, 0); + } else { + ZEPHIR_INIT_NVAR(allowReserved); + ZVAL_LONG(allowReserved, 4194304); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_NVAR(_1); + ZVAL_BOOL(_1, 0); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "getoption", NULL, 0, _0, _1); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _5 = zephir_is_true(_4); + if (_5) { + _5 = ZEPHIR_IS_EMPTY(value); + } + if (_5) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_VAR(options); + zephir_create_array(options, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_6); + zephir_create_array(_6, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6, SL("default"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&options, SL("options"), &_6, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_VAR(_7); + zephir_bitwise_or_function(&_7, version, allowPrivate TSRMLS_CC); + ZEPHIR_INIT_VAR(_8); + zephir_bitwise_or_function(_8, &_7, allowReserved TSRMLS_CC); + zephir_array_update_string(&options, SL("flags"), &_8, PH_COPY | PH_SEPARATE); + ZEPHIR_SINIT_NVAR(_7); + ZVAL_LONG(&_7, 275); + ZEPHIR_CALL_FUNCTION(&_9, "filter_var", NULL, 201, value, &_7, options); + zephir_check_call_status(); + if (!(zephir_is_true(_9))) { + ZEPHIR_INIT_VAR(_10$$5); + ZVAL_STRING(_10$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_INIT_VAR(_11$$5); + ZVAL_STRING(_11$$5, "IP address is incorrect", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$5, _11$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_temp_parameter(_11$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_12$$5); + zephir_create_array(_12$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_12$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_13$$5, "strtr", NULL, 26, message, _12$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$5); + ZVAL_STRING(_10$$5, "IP", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _13$$5, field, _10$$5); + zephir_check_temp_parameter(_10$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2291 "parser.php5.c" - break; - case 96: -// 716 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Numericality, phalcon, mvc_model_validator_numericality, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_numericality_method_entry, 0); + + return SUCCESS; + +} + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) { + + zval *_4$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_3$$5 = NULL, *_5$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + if (!(zephir_is_numeric(value))) { + ZEPHIR_INIT_VAR(_3$$5); + ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field :field must be numeric", 1); + } + ZEPHIR_INIT_VAR(_4$$5); + zephir_create_array(_4$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$5, "strtr", NULL, 26, message, _4$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$5); + ZVAL_STRING(_3$$5, "Numericality", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$5, field, _3$$5); + zephir_check_temp_parameter(_3$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2300 "parser.php5.c" - break; - case 97: -// 720 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, PresenceOf, phalcon, mvc_model_validator_presenceof, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_presenceof_method_entry, 0); + + return SUCCESS; + } -// 2309 "parser.php5.c" - break; - case 98: -// 724 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) { + + zval *_4$$4; + zend_bool _1, _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0, *_3$$4 = NULL, *_5$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 68); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + _1 = Z_TYPE_P(value) == IS_NULL; + if (!(_1)) { + _2 = Z_TYPE_P(value) == IS_STRING; + if (_2) { + _2 = !(zephir_fast_strlen_ev(value)); + } + _1 = _2; + } + if (_1) { + ZEPHIR_INIT_VAR(_3$$4); + ZVAL_STRING(_3$$4, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "':field' is required", 1); + } + ZEPHIR_INIT_VAR(_4$$4); + zephir_create_array(_4$$4, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_4$$4, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 26, message, _4$$4); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_3$$4); + ZVAL_STRING(_3$$4, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _5$$4, field, _3$$4); + zephir_check_temp_parameter(_3$$4); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2318 "parser.php5.c" - break; - case 99: -// 728 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Regex, phalcon, mvc_model_validator_regex, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_regex_method_entry, 0); + + return SUCCESS; + } -// 2327 "parser.php5.c" - break; - case 100: -// 732 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) { + + zval *_6$$8; + zend_bool failed = 0, _3; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *matches = NULL, *pattern = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4$$6, *_5$$8 = NULL, *_7$$8 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 68); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (!(zephir_is_true(_1))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 75); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + failed = 0; + ZEPHIR_INIT_VAR(matches); + ZVAL_NULL(matches); + ZEPHIR_INIT_NVAR(_0); + zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC); + if (zephir_is_true(_0)) { + zephir_array_fetch_long(&_4$$6, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 94 TSRMLS_CC); + failed = !ZEPHIR_IS_EQUAL(_4$$6, value); + } else { + failed = 1; + } + if (failed == 1) { + ZEPHIR_INIT_VAR(_5$$8); + ZVAL_STRING(_5$$8, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' doesn't match regular expression", 1); + } + ZEPHIR_INIT_VAR(_6$$8); + zephir_create_array(_6$$8, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$8, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$8, "strtr", NULL, 26, message, _6$$8); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$8); + ZVAL_STRING(_5$$8, "Regex", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$8, field, _5$$8); + zephir_check_temp_parameter(_5$$8); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2336 "parser.php5.c" - break; - case 101: -// 736 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, StringLength, phalcon, mvc_model_validator_stringlength, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_stringlength_method_entry, 0); + + return SUCCESS; + } -// 2345 "parser.php5.c" - break; - case 102: -// 740 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { + + zval *_6$$9, *_11$$12; + zend_bool _1, _3; + zephir_fcall_cache_entry *_8 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$11, *_10$$12 = NULL, *_12$$12 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 72); + return; + } + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _1 = !zephir_is_true(isSetMin); + if (_1) { + _1 = !zephir_is_true(isSetMax); + } + if (_1) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 82); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _3 = zephir_is_true(_2); + if (_3) { + _3 = ZEPHIR_IS_EMPTY(value); + } + if (_3) { + RETURN_MM_BOOL(1); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 347, value); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(length); + ZVAL_LONG(length, zephir_fast_strlen_ev(value)); + } + if (zephir_is_true(isSetMax)) { + ZEPHIR_INIT_VAR(_4$$8); + ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); + zephir_check_temp_parameter(_4$$8); + zephir_check_call_status(); + if (ZEPHIR_GT(length, maximum)) { + ZEPHIR_INIT_VAR(_5$$9); + ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); + } + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 26, message, _6$$9); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$9); + ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); + zephir_check_temp_parameter(_5$$9); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + if (zephir_is_true(isSetMin)) { + ZEPHIR_INIT_VAR(_9$$11); + ZVAL_STRING(_9$$11, "min", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _9$$11); + zephir_check_temp_parameter(_9$$11); + zephir_check_call_status(); + if (ZEPHIR_LT(length, minimum)) { + ZEPHIR_INIT_VAR(_10$$12); + ZVAL_STRING(_10$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); + } + ZEPHIR_INIT_VAR(_11$$12); + zephir_create_array(_11$$12, 2, 0 TSRMLS_CC); + zephir_array_update_string(&_11$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_11$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_12$$12, "strtr", &_8, 26, message, _11$$12); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_10$$12); + ZVAL_STRING(_10$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _12$$12, field, _10$$12); + zephir_check_temp_parameter(_10$$12); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } + RETURN_MM_BOOL(1); + } -// 2354 "parser.php5.c" - break; - case 103: -// 744 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Uniqueness, phalcon, mvc_model_validator_uniqueness, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_uniqueness_method_entry, 0); + + return SUCCESS; + } -// 2363 "parser.php5.c" - break; - case 104: -// 748 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { + + HashTable *_2$$5, *_22$$16; + HashPosition _1$$5, _21$$16; + zend_class_entry *_33; + zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; + int ZEPHIR_LAST_CALL_STATUS, number = 0; + zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(bindTypes); + array_init(bindTypes); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_INIT_VAR(conditions); + array_init(conditions); + ZEPHIR_INIT_VAR(bindParams); + array_init(bindParams); + number = 0; + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HVALUE(composeField, _3$$5); + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_4$$8); + object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_5$$8); + ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, composeField); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_7$$10); + object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_8$$10); + ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_SINIT_NVAR(_9$$6); + ZVAL_LONG(&_9$$6, number); + ZEPHIR_INIT_LNVAR(_10$$6); + ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); + zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); + ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); + number++; + } + } else { + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(columnField); + if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_13$$13); + object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_14$$13); + ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(columnField, field); + } + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_15$$15); + object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(_16$$15); + ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(_17$$11); + ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); + zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); + ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); + number++; + } + ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(_19, 2)) { + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(columnMap); + ZVAL_NULL(columnMap); + } + ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); + zephir_check_call_status(); + zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) + ) { + ZEPHIR_GET_HVALUE(primaryField, _23$$16); + ZEPHIR_OBS_NVAR(bindType); + if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_24$$20); + object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_25$$20); + ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); + zephir_check_call_status(); + zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(attributeField); + if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(_26$$22); + object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_LNVAR(_27$$22); + ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); + zephir_check_call_status(); + zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(attributeField, primaryField); + } + ZEPHIR_SINIT_NVAR(_28$$19); + ZVAL_LONG(&_28$$19, number); + ZEPHIR_INIT_LNVAR(_29$$19); + ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); + zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); + ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); + zephir_check_call_status(); + zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); + zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); + number++; + } + } + ZEPHIR_INIT_VAR(params); + array_init(params); + zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_0); + zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); + zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(className); + zephir_get_class(className, record, 0 TSRMLS_CC); + _33 = zephir_fetch_class(className TSRMLS_CC); + ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); + zephir_check_call_status(); + if (!ZEPHIR_IS_LONG(_32, 0)) { + ZEPHIR_INIT_VAR(_34$$24); + ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(replacePairs); + if (Z_TYPE_P(field) == IS_ARRAY) { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_35$$25); + zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); + } + } else { + zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); + zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); + } + } + ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_34$$24); + ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); + zephir_check_temp_parameter(_34$$24); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2372 "parser.php5.c" - break; - case 105: -// 752 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\Validator, Url, phalcon, mvc_model_validator_url, phalcon_mvc_model_validator_ce, phalcon_mvc_model_validator_url_method_entry, 0); + + return SUCCESS; + } -// 2381 "parser.php5.c" - break; - case 106: -// 756 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) { + + zval *_6$$5; + zend_bool _2; + int ZEPHIR_LAST_CALL_STATUS; + zval *record, *field = NULL, *value = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5$$5 = NULL, *_7$$5 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &record); + + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + if (Z_TYPE_P(field) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 67); + return; + } + ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_0); + ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "issetoption", NULL, 0, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + _2 = zephir_is_true(_1); + if (_2) { + _2 = ZEPHIR_IS_EMPTY(value); + } + if (_2) { + RETURN_MM_BOOL(1); + } + ZEPHIR_SINIT_VAR(_3); + ZVAL_LONG(&_3, 273); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 201, value, &_3); + zephir_check_call_status(); + if (!(zephir_is_true(_4))) { + ZEPHIR_INIT_VAR(_5$$5); + ZVAL_STRING(_5$$5, "message", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(message)) { + ZEPHIR_INIT_NVAR(message); + ZVAL_STRING(message, ":field does not have a valid url format", 1); + } + ZEPHIR_INIT_VAR(_6$$5); + zephir_create_array(_6$$5, 1, 0 TSRMLS_CC); + zephir_array_update_string(&_6$$5, SL(":field"), &field, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, _6$$5); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(_5$$5); + ZVAL_STRING(_5$$5, "Url", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$5, field, _5$$5); + zephir_check_temp_parameter(_5$$5); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); + } -// 2390 "parser.php5.c" - break; - case 107: -// 760 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_handlers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_controllerSuffix"), "Controller", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("_actionSuffix"), "Action", ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("_routePrefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; + return SUCCESS; + } -// 2399 "parser.php5.c" - break; - case 108: -// 764 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { + + zval *_0; + zval *handler_param = NULL, *prefix_param = NULL; + zval *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2407 "parser.php5.c" - break; - case 109: -// 768 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { + + zval *_0; + zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; + zval *module = NULL, *handler = NULL, *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + if (!prefix_param) { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } else { + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + } + + + ZEPHIR_INIT_VAR(_0); + zephir_create_array(_0, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_0, prefix); + zephir_array_fast_append(_0, handler); + zephir_array_fast_append(_0, module); + zephir_update_property_array_append(this_ptr, SL("_handlers"), _0 TSRMLS_CC); + RETURN_THIS(); + } -// 2415 "parser.php5.c" - break; - case 110: -// 772 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { + + zend_bool _5$$6; + HashTable *_3, *_9$$14, *_13$$16, *_17$$18; + HashPosition _2, _8$$14, _12$$16, _16$$18; + zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; + zval *uri = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &uri_param); + + if (!uri_param) { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } else { + if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(uri, uri_param); + } else { + ZEPHIR_INIT_VAR(uri); + ZVAL_EMPTY_STRING(uri); + } + } + + + if (!(!(!uri) && Z_STRLEN_P(uri))) { + ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(realUri, uri); + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _0); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); + return; + } + ZEPHIR_INIT_VAR(_1); + ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); + zephir_check_temp_parameter(_1); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(handlers); + zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(controllerSuffix); + zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); + zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); + for ( + ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS + ; zephir_hash_move_forward_ex(_3, &_2) + ) { + ZEPHIR_GET_HVALUE(scope, _4); + if (Z_TYPE_P(scope) != IS_ARRAY) { + continue; + } + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); + _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); + if (_5$$6) { + _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); + } + if (_5$$6) { + continue; + } + ZEPHIR_OBS_NVAR(handler); + zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); + if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 133)) { + ZEPHIR_INIT_NVAR(controllerName); + zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(namespaceName); + zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(controllerName, handler); + ZEPHIR_OBS_NVAR(namespaceName); + zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); + } + zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); + ZEPHIR_INIT_NVAR(sufixed); + ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); + if (Z_TYPE_P(namespaceName) != IS_NULL) { + ZEPHIR_INIT_LNVAR(_6$$11); + ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "\\", sufixed); + ZEPHIR_CPY_WRT(sufixed, _6$$11); + } + ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); + zephir_check_call_status(); + if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(annotations) == IS_ARRAY) { + zephir_is_iterable(annotations, &_9$$14, &_8$$14, 0, 0, "phalcon/mvc/router/annotations.zep", 182); + for ( + ; zephir_hash_get_current_data_ex(_9$$14, (void**) &_10$$14, &_8$$14) == SUCCESS + ; zephir_hash_move_forward_ex(_9$$14, &_8$$14) + ) { + ZEPHIR_GET_HVALUE(annotation, _10$$14); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_11, 0, controllerName, annotation); + zephir_check_call_status(); + } + } + } + ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(lowerControllerName); + zephir_uncamelize(lowerControllerName, controllerName, NULL ); + zephir_is_iterable(methodAnnotations, &_13$$16, &_12$$16, 0, 0, "phalcon/mvc/router/annotations.zep", 199); + for ( + ; zephir_hash_get_current_data_ex(_13$$16, (void**) &_14$$16, &_12$$16) == SUCCESS + ; zephir_hash_move_forward_ex(_13$$16, &_12$$16) + ) { + ZEPHIR_GET_HMKEY(method, _13$$16, _12$$16); + ZEPHIR_GET_HVALUE(collection, _14$$16); + if (Z_TYPE_P(collection) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_15$$18, collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(_15$$18, &_17$$18, &_16$$18, 0, 0, "phalcon/mvc/router/annotations.zep", 197); + for ( + ; zephir_hash_get_current_data_ex(_17$$18, (void**) &_18$$18, &_16$$18) == SUCCESS + ; zephir_hash_move_forward_ex(_17$$18, &_16$$18) + ) { + ZEPHIR_GET_HVALUE(annotation, _18$$18); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_19, 0, moduleName, namespaceName, lowerControllerName, method, annotation); + zephir_check_call_status(); + } + } + } + } + } + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_20, 348, realUri); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); + } -// 2423 "parser.php5.c" - break; - case 111: -// 776 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *handler_param = NULL, *annotation, *_0 = NULL, *_1$$3 = NULL, *_2$$3; + zval *handler = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &handler_param, &annotation); + + if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(handler, handler_param); + } else { + ZEPHIR_INIT_VAR(handler); + ZVAL_EMPTY_STRING(handler); + } + + + ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) { + ZEPHIR_INIT_VAR(_2$$3); + ZVAL_LONG(_2$$3, 0); + ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, _2$$3); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_routePrefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + } -// 2431 "parser.php5.c" - break; - case 112: -// 780 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { + + HashTable *_7$$22, *_11$$24; + HashPosition _6$$22, _10$$24; + zend_bool isRoute = 0, _14$$9, _5$$20; + zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName = NULL, *routePrefix = NULL, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0$$9, *_1$$9, _2$$9, *_3$$9 = NULL, *_4$$20, **_8$$22, **_12$$24; + zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); + + if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(module, module_param); + } else { + ZEPHIR_INIT_VAR(module); + ZVAL_EMPTY_STRING(module); + } + if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { + zephir_get_strval(namespaceName, namespaceName_param); + } else { + ZEPHIR_INIT_VAR(namespaceName); + ZVAL_EMPTY_STRING(namespaceName); + } + if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { + zephir_get_strval(controller, controller_param); + } else { + ZEPHIR_INIT_VAR(controller); + ZVAL_EMPTY_STRING(controller); + } + if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(action_param) == IS_STRING)) { + zephir_get_strval(action, action_param); + } else { + ZEPHIR_INIT_VAR(action); + ZVAL_EMPTY_STRING(action); + } + + + isRoute = 0; + ZEPHIR_INIT_VAR(methods); + ZVAL_NULL(methods); + ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); + zephir_check_call_status(); + do { + if (ZEPHIR_IS_STRING(name, "Route")) { + isRoute = 1; + break; + } + if (ZEPHIR_IS_STRING(name, "Get")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "GET", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Post")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "POST", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Put")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "PUT", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Delete")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "DELETE", 1); + break; + } + if (ZEPHIR_IS_STRING(name, "Options")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(methods); + ZVAL_STRING(methods, "OPTIONS", 1); + break; + } + } while(0); + + if (isRoute == 1) { + ZEPHIR_INIT_VAR(_0$$9); + _1$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); + ZEPHIR_SINIT_VAR(_2$$9); + ZVAL_STRING(&_2$$9, "", 0); + zephir_fast_str_replace(&_0$$9, _1$$9, &_2$$9, action TSRMLS_CC); + ZEPHIR_INIT_VAR(actionName); + zephir_fast_strtolower(actionName, _0$$9); + ZEPHIR_OBS_VAR(routePrefix); + zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_3$$9); + ZVAL_STRING(_3$$9, "paths", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(paths) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(paths); + array_init(paths); + } + if (!(ZEPHIR_IS_EMPTY(module))) { + zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); + } + if (!(ZEPHIR_IS_EMPTY(namespaceName))) { + zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_LONG(_3$$9, 0); + ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(value) != IS_NULL) { + if (!ZEPHIR_IS_STRING(value, "/")) { + ZEPHIR_INIT_VAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, value); + } else { + if (Z_TYPE_P(routePrefix) != IS_NULL) { + ZEPHIR_CPY_WRT(uri, routePrefix); + } else { + ZEPHIR_CPY_WRT(uri, value); + } + } + } else { + ZEPHIR_INIT_NVAR(uri); + ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); + } + ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); + zephir_check_call_status(); + if (Z_TYPE_P(methods) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(_4$$20); + ZVAL_STRING(_4$$20, "methods", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _4$$20); + zephir_check_temp_parameter(_4$$20); + zephir_check_call_status(); + _5$$20 = Z_TYPE_P(methods) == IS_ARRAY; + if (!(_5$$20)) { + _5$$20 = Z_TYPE_P(methods) == IS_STRING; + } + if (_5$$20) { + ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "converts", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_7$$22, &_6$$22, 0, 0, "phalcon/mvc/router/annotations.zep", 339); + for ( + ; zephir_hash_get_current_data_ex(_7$$22, (void**) &_8$$22, &_6$$22) == SUCCESS + ; zephir_hash_move_forward_ex(_7$$22, &_6$$22) + ) { + ZEPHIR_GET_HMKEY(param, _7$$22, _6$$22); + ZEPHIR_GET_HVALUE(convert, _8$$22); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_9, 0, param, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "conversors", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(converts) == IS_ARRAY) { + zephir_is_iterable(converts, &_11$$24, &_10$$24, 0, 0, "phalcon/mvc/router/annotations.zep", 349); + for ( + ; zephir_hash_get_current_data_ex(_11$$24, (void**) &_12$$24, &_10$$24) == SUCCESS + ; zephir_hash_move_forward_ex(_11$$24, &_10$$24) + ) { + ZEPHIR_GET_HMKEY(conversorParam, _11$$24, _10$$24); + ZEPHIR_GET_HVALUE(convert, _12$$24); + ZEPHIR_CALL_METHOD(NULL, route, "convert", &_13, 0, conversorParam, convert); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + _14$$9 = Z_TYPE_P(beforeMatch) == IS_ARRAY; + if (!(_14$$9)) { + _14$$9 = Z_TYPE_P(beforeMatch) == IS_STRING; + } + if (_14$$9) { + ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(_3$$9); + ZVAL_STRING(_3$$9, "name", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3$$9); + zephir_check_temp_parameter(_3$$9); + zephir_check_call_status(); + if (Z_TYPE_P(routeName) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); + zephir_check_call_status(); + } + RETURN_MM_BOOL(1); + } + ZEPHIR_MM_RESTORE(); + } -// 2439 "parser.php5.c" - break; - case 113: -// 784 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { + + zval *controllerSuffix_param = NULL; + zval *controllerSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &controllerSuffix_param); + + if (unlikely(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { + zephir_get_strval(controllerSuffix, controllerSuffix_param); + } else { + ZEPHIR_INIT_VAR(controllerSuffix); + ZVAL_EMPTY_STRING(controllerSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_controllerSuffix"), controllerSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2447 "parser.php5.c" - break; - case 114: -// 788 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) { + + zval *actionSuffix_param = NULL; + zval *actionSuffix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &actionSuffix_param); + + if (unlikely(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { + zephir_get_strval(actionSuffix, actionSuffix_param); + } else { + ZEPHIR_INIT_VAR(actionSuffix); + ZVAL_EMPTY_STRING(actionSuffix); + } + + + zephir_update_property_this(this_ptr, SL("_actionSuffix"), actionSuffix TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2455 "parser.php5.c" - break; - case 115: -// 792 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { + + + + RETURN_MEMBER(this_ptr, "_handlers"); + } -// 2463 "parser.php5.c" - break; - case 117: -// 800 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC) { + + zval *_0, *_2, *_4, *_1$$3, *_3$$4, *_5$$5; + + ZEPHIR_MM_GROW(); + + { + zval *this_ptr = NULL; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); + if (Z_TYPE_P(_0) == IS_NULL) { + ZEPHIR_INIT_VAR(_1$$3); + array_init(_1$$3); + zephir_update_property_this(this_ptr, SL("_defaultParams"), _1$$3 TSRMLS_CC); + } + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC); + if (Z_TYPE_P(_2) == IS_NULL) { + ZEPHIR_INIT_VAR(_3$$4); + array_init(_3$$4); + zephir_update_property_this(this_ptr, SL("_params"), _3$$4 TSRMLS_CC); + } + _4 = zephir_fetch_nproperty_this(this_ptr, SL("_handlers"), PH_NOISY_CC); + if (Z_TYPE_P(_4) == IS_NULL) { + ZEPHIR_INIT_VAR(_5$$5); + array_init(_5$$5); + zephir_update_property_this(this_ptr, SL("_handlers"), _5$$5 TSRMLS_CC); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJVAL_P(this_ptr); + } + } -// 2471 "parser.php5.c" - break; - case 118: -// 804 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2480 "parser.php5.c" - break; - case 119: -// 808 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_routes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_group_ce TSRMLS_CC, 1, phalcon_mvc_router_groupinterface_ce); + return SUCCESS; + } -// 2488 "parser.php5.c" - break; - case 120: -// 812 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *paths = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + _0 = Z_TYPE_P(paths) == IS_ARRAY; + if (!(_0)) { + _0 = Z_TYPE_P(paths) == IS_STRING; + } + if (_0) { + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + } + if ((zephir_method_exists_ex(this_ptr, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2496 "parser.php5.c" - break; - case 121: -// 816 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + zephir_get_strval(hostname, hostname_param); + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 2504 "parser.php5.c" - break; - case 122: -// 820 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 2513 "parser.php5.c" - break; - case 123: -// 824 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + zephir_get_strval(prefix, prefix_param); + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2522 "parser.php5.c" - break; - case 124: -// 828 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { + + + + RETURN_MEMBER(this_ptr, "_prefix"); + } -// 2531 "parser.php5.c" - break; - case 125: -// 832 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { + + zval *beforeMatch; + + zephir_fetch_params(0, 1, 0, &beforeMatch); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), beforeMatch TSRMLS_CC); + RETURN_THISW(); + } -// 2540 "parser.php5.c" - break; - case 126: -// 836 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 2549 "parser.php5.c" - break; - case 128: -// 844 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { + + zval *paths; + + zephir_fetch_params(0, 1, 0, &paths); + + + + zephir_update_property_this(this_ptr, SL("_paths"), paths TSRMLS_CC); + RETURN_THISW(); + } -// 2558 "parser.php5.c" - break; - case 129: -// 848 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 2568 "parser.php5.c" - break; - case 130: -// 852 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { + + + + RETURN_MEMBER(this_ptr, "_routes"); + } -// 2578 "parser.php5.c" - break; - case 131: -// 856 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, httpMethods); + zephir_check_call_status(); + RETURN_MM(); + } -// 2588 "parser.php5.c" - break; - case 136: - case 144: -// 894 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "GET", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2597 "parser.php5.c" - break; - case 137: - case 143: -// 898 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "POST", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2605 "parser.php5.c" - break; - case 139: -// 912 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PUT", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2614 "parser.php5.c" - break; - case 140: -// 916 "parser.php5.lemon" -{ - vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "PATCH", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -// 2623 "parser.php5.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "DELETE", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "OPTIONS", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php5.lemon" +static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { - { + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *_0; + zval *pattern = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_INIT_VAR(_0); + ZVAL_STRING(_0, "HEAD", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_addroute", NULL, 0, pattern, paths, _0); + zephir_check_temp_parameter(_0); + zephir_check_call_status(); + RETURN_MM(); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + zval *_0; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + ZEPHIR_INIT_VAR(_0); + array_init(_0); + zephir_update_property_this(this_ptr, SL("_routes"), _0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); - } +} - } else { +static PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) { - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); + int ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route = NULL, *defaultPaths = NULL, *processedPaths = NULL, *_1, *_2; + zval *pattern = NULL; - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } - } - } + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } - smart_str_0(&error_str); -#if PHP_VERSION_ID < 70000 - if (error_str.len) { - status->syntax_error = error_str.c; - status->syntax_error_len = error_str.len; + ZEPHIR_OBS_VAR(defaultPaths); + zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC); + if (Z_TYPE_P(defaultPaths) == IS_ARRAY) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 81, paths); + zephir_check_call_status(); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(processedPaths, paths); } -#else - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); + if (Z_TYPE_P(processedPaths) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedPaths); + zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC); } else { - status->syntax_error = NULL; + ZEPHIR_CPY_WRT(mergedPaths, defaultPaths); } -#endif + } else { + ZEPHIR_CPY_WRT(mergedPaths, paths); } + ZEPHIR_INIT_VAR(route); + object_init_ex(route, phalcon_mvc_router_route_ce); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_2); + ZEPHIR_CONCAT_VV(_2, _1, pattern); + ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 80, _2, mergedPaths, httpMethods); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC); + ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 349, this_ptr); + zephir_check_call_status(); + RETURN_CCTOR(route); - status->status = PHVOLT_PARSING_FAILED; - -// 2774 "parser.php5.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } +#ifdef HAVE_CONFIG_H #endif - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); + + return SUCCESS; + } -#else -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 42 "parser.php7.lemon" +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** VVCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** VVNOCODE is a number of type VVCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** VVFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** VVACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phvolt_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** VVMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "vv0". -** VVSTACKDEPTH is the maximum depth of the parser's stack. -** phvolt_ARG_SDECL A static variable declaration for the %extra_argument -** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into vvpParser -** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser -** VVNSTATE the combined number of states. -** VVNRULE the number of rules in the grammar -** VVERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define VVCODETYPE unsigned char -#define VVNOCODE 125 -#define VVACTIONTYPE unsigned short int -#define phvolt_TOKENTYPE phvolt_parser_token* -typedef union { - phvolt_TOKENTYPE vv0; - zval vv146; - int vv249; -} VVMINORTYPE; -#define VVSTACKDEPTH 100 -#define phvolt_ARG_SDECL phvolt_parser_status *status; -#define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status -#define phvolt_ARG_STORE vvpParser->status = status -#define VVNSTATE 348 -#define VVNRULE 152 -#define VVERRORSYMBOL 85 -#define VVERRSYMDT vv249 -#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) -#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) -#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < VVNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. -** -** N == VVNSTATE+VVNRULE A syntax error has occurred. -** -** N == VVNSTATE+VVNRULE+1 The parser accepts its input. -** -** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused -** slots in the vv_action[] table. -** -** The action table is constructed as a single large table named vv_action[]. -** Given state S and lookahead X, the action is computed as -** -** vv_action[ vv_shift_ofst[S] + X ] -** -** If the index value vv_shift_ofst[S]+X is out of range or if the value -** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] -** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table -** and that vv_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the vv_reduce_ofst[] array is used in place of -** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of -** VV_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** vv_action[] A single table containing all actions. -** vv_lookahead[] A table containing the lookahead for each entry in -** vv_action. Used to detect hash collisions. -** vv_shift_ofst[] For each state, the offset into vv_action for -** shifting terminals. -** vv_reduce_ofst[] For each state, the offset into vv_action for -** shifting non-terminals after a reduce. -** vv_default[] Default action for each state. -*/ -static VVACTIONTYPE vv_action[] = { - /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, - /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, - /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, - /* 30 */ 85, 88, 89, 97, 81, 286, 44, 41, 57, 90, - /* 40 */ 59, 85, 88, 89, 97, 81, 108, 285, 180, 201, - /* 50 */ 184, 83, 93, 182, 61, 53, 55, 67, 63, 65, - /* 60 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 70 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 223, - /* 80 */ 251, 83, 93, 181, 61, 53, 55, 67, 63, 65, - /* 90 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 100 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 314, - /* 110 */ 174, 321, 172, 37, 83, 93, 252, 61, 53, 55, - /* 120 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 130 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 140 */ 97, 81, 330, 325, 83, 93, 228, 61, 53, 55, - /* 150 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 160 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 170 */ 97, 81, 279, 260, 83, 93, 95, 61, 53, 55, - /* 180 */ 67, 63, 65, 73, 75, 77, 79, 69, 71, 49, - /* 190 */ 47, 51, 44, 41, 57, 90, 59, 85, 88, 89, - /* 200 */ 97, 81, 83, 93, 302, 61, 53, 55, 67, 63, - /* 210 */ 65, 73, 75, 77, 79, 69, 71, 49, 47, 51, - /* 220 */ 44, 41, 57, 90, 59, 85, 88, 89, 97, 81, - /* 230 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 240 */ 89, 97, 81, 304, 295, 313, 199, 103, 109, 346, - /* 250 */ 296, 83, 93, 205, 61, 53, 55, 67, 63, 65, - /* 260 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 270 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 129, - /* 280 */ 316, 83, 93, 145, 61, 53, 55, 67, 63, 65, - /* 290 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 300 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 90, - /* 310 */ 59, 85, 88, 89, 97, 81, 307, 308, 309, 310, - /* 320 */ 311, 312, 183, 184, 92, 215, 262, 273, 83, 93, - /* 330 */ 113, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 340 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 350 */ 59, 85, 88, 89, 97, 81, 140, 140, 224, 271, - /* 360 */ 284, 56, 91, 235, 143, 102, 216, 344, 139, 139, - /* 370 */ 414, 197, 141, 118, 118, 83, 93, 118, 61, 53, - /* 380 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 390 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 400 */ 89, 97, 81, 171, 40, 83, 93, 415, 61, 53, - /* 410 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 420 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 430 */ 89, 97, 81, 237, 27, 83, 93, 481, 61, 53, - /* 440 */ 55, 67, 63, 65, 73, 75, 77, 79, 69, 71, - /* 450 */ 49, 47, 51, 44, 41, 57, 90, 59, 85, 88, - /* 460 */ 89, 97, 81, 83, 93, 320, 61, 53, 55, 67, - /* 470 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 480 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 490 */ 81, 240, 332, 83, 93, 289, 61, 53, 55, 67, - /* 500 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 510 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 520 */ 81, 200, 248, 83, 93, 169, 61, 53, 55, 67, - /* 530 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 540 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 550 */ 81, 291, 254, 83, 93, 280, 61, 53, 55, 67, - /* 560 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 570 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 580 */ 81, 339, 257, 83, 93, 292, 61, 53, 55, 67, - /* 590 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 600 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 213, - /* 610 */ 81, 83, 93, 293, 61, 53, 55, 67, 63, 65, - /* 620 */ 73, 75, 77, 79, 69, 71, 49, 47, 51, 44, - /* 630 */ 41, 57, 90, 59, 85, 88, 89, 97, 81, 93, - /* 640 */ 322, 61, 53, 55, 67, 63, 65, 73, 75, 77, - /* 650 */ 79, 69, 71, 49, 47, 51, 44, 41, 57, 90, - /* 660 */ 59, 85, 88, 89, 97, 81, 61, 53, 55, 67, - /* 670 */ 63, 65, 73, 75, 77, 79, 69, 71, 49, 47, - /* 680 */ 51, 44, 41, 57, 90, 59, 85, 88, 89, 97, - /* 690 */ 81, 53, 55, 67, 63, 65, 73, 75, 77, 79, - /* 700 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 710 */ 85, 88, 89, 97, 81, 501, 1, 2, 272, 4, - /* 720 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 730 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, - /* 740 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 750 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 760 */ 23, 207, 272, 4, 5, 6, 7, 8, 9, 10, - /* 770 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 780 */ 21, 22, 23, 67, 63, 65, 73, 75, 77, 79, - /* 790 */ 69, 71, 49, 47, 51, 44, 41, 57, 90, 59, - /* 800 */ 85, 88, 89, 97, 81, 232, 272, 4, 5, 6, - /* 810 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 820 */ 17, 18, 19, 20, 21, 22, 23, 264, 272, 4, - /* 830 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 840 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 217, - /* 850 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 860 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 870 */ 23, 281, 272, 4, 5, 6, 7, 8, 9, 10, - /* 880 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 890 */ 21, 22, 23, 275, 272, 4, 5, 6, 7, 8, - /* 900 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 910 */ 19, 20, 21, 22, 23, 333, 272, 4, 5, 6, - /* 920 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 930 */ 17, 18, 19, 20, 21, 22, 23, 175, 272, 4, - /* 940 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 950 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 298, - /* 960 */ 272, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 970 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 980 */ 23, 317, 272, 4, 5, 6, 7, 8, 9, 10, - /* 990 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 1000 */ 21, 22, 23, 326, 272, 4, 5, 6, 7, 8, - /* 1010 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 1020 */ 19, 20, 21, 22, 23, 34, 272, 4, 5, 6, - /* 1030 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 1040 */ 17, 18, 19, 20, 21, 22, 23, 225, 272, 4, - /* 1050 */ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 1060 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, - /* 1070 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - /* 1080 */ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - /* 1090 */ 241, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 1100 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 1110 */ 23, 25, 221, 341, 343, 38, 168, 170, 98, 294, - /* 1120 */ 179, 349, 24, 105, 480, 127, 98, 202, 242, 24, - /* 1130 */ 118, 135, 107, 214, 114, 118, 211, 340, 118, 135, - /* 1140 */ 222, 263, 229, 26, 236, 105, 246, 249, 167, 255, - /* 1150 */ 258, 261, 196, 268, 270, 118, 126, 118, 45, 42, - /* 1160 */ 118, 104, 70, 99, 118, 29, 101, 243, 45, 42, - /* 1170 */ 117, 104, 105, 99, 118, 119, 101, 323, 297, 238, - /* 1180 */ 336, 112, 118, 114, 118, 119, 238, 120, 121, 122, - /* 1190 */ 123, 124, 125, 98, 238, 239, 245, 120, 121, 122, - /* 1200 */ 123, 124, 125, 245, 337, 118, 130, 118, 176, 68, - /* 1210 */ 345, 245, 129, 155, 156, 157, 158, 159, 160, 161, - /* 1220 */ 110, 118, 238, 148, 149, 150, 151, 152, 153, 154, - /* 1230 */ 110, 25, 221, 30, 32, 38, 168, 170, 244, 245, - /* 1240 */ 179, 58, 173, 247, 348, 54, 203, 202, 204, 301, - /* 1250 */ 481, 304, 342, 118, 118, 118, 211, 118, 128, 31, - /* 1260 */ 222, 238, 229, 35, 236, 238, 246, 249, 208, 255, - /* 1270 */ 258, 261, 218, 268, 270, 33, 303, 250, 245, 25, - /* 1280 */ 221, 195, 245, 38, 168, 170, 206, 198, 179, 118, - /* 1290 */ 287, 137, 305, 72, 39, 202, 144, 306, 185, 187, - /* 1300 */ 189, 191, 193, 116, 211, 118, 118, 138, 222, 227, - /* 1310 */ 229, 226, 236, 178, 246, 249, 233, 255, 258, 261, - /* 1320 */ 238, 268, 270, 347, 220, 238, 274, 25, 221, 238, - /* 1330 */ 132, 38, 168, 170, 210, 265, 179, 245, 276, 253, - /* 1340 */ 267, 212, 245, 202, 142, 256, 245, 238, 282, 480, - /* 1350 */ 329, 118, 211, 118, 278, 269, 222, 118, 229, 234, - /* 1360 */ 236, 278, 246, 249, 245, 255, 258, 261, 238, 268, - /* 1370 */ 270, 278, 278, 238, 278, 25, 221, 36, 278, 38, - /* 1380 */ 168, 170, 278, 299, 179, 245, 318, 278, 278, 64, - /* 1390 */ 245, 202, 238, 278, 327, 238, 334, 278, 278, 278, - /* 1400 */ 211, 118, 278, 278, 222, 238, 229, 278, 236, 245, - /* 1410 */ 246, 249, 245, 255, 258, 261, 278, 268, 270, 278, - /* 1420 */ 278, 163, 245, 25, 221, 278, 315, 38, 168, 170, - /* 1430 */ 259, 335, 179, 118, 278, 278, 278, 278, 118, 202, - /* 1440 */ 238, 278, 118, 238, 278, 278, 278, 278, 211, 278, - /* 1450 */ 278, 238, 222, 238, 229, 278, 236, 245, 246, 249, - /* 1460 */ 245, 255, 258, 261, 278, 268, 270, 76, 245, 66, - /* 1470 */ 245, 25, 221, 62, 324, 38, 168, 170, 165, 118, - /* 1480 */ 179, 118, 278, 278, 278, 118, 118, 202, 278, 278, - /* 1490 */ 118, 52, 278, 278, 278, 278, 211, 219, 278, 278, - /* 1500 */ 222, 278, 229, 118, 236, 278, 246, 249, 278, 255, - /* 1510 */ 258, 261, 278, 268, 270, 186, 278, 133, 278, 25, - /* 1520 */ 221, 50, 331, 38, 168, 170, 188, 118, 179, 118, - /* 1530 */ 278, 278, 278, 118, 118, 202, 278, 60, 118, 278, - /* 1540 */ 278, 87, 278, 278, 211, 278, 278, 278, 222, 118, - /* 1550 */ 229, 283, 236, 118, 246, 249, 278, 255, 258, 261, - /* 1560 */ 278, 268, 270, 48, 278, 190, 278, 25, 221, 46, - /* 1570 */ 192, 38, 168, 170, 166, 118, 179, 118, 94, 84, - /* 1580 */ 278, 118, 118, 202, 278, 96, 118, 230, 278, 74, - /* 1590 */ 118, 118, 211, 278, 278, 278, 222, 118, 229, 118, - /* 1600 */ 236, 118, 246, 249, 278, 255, 258, 261, 277, 268, - /* 1610 */ 270, 82, 278, 80, 194, 25, 221, 338, 100, 38, - /* 1620 */ 168, 170, 78, 118, 179, 118, 118, 278, 278, 278, - /* 1630 */ 118, 202, 278, 43, 118, 278, 278, 278, 278, 278, - /* 1640 */ 211, 278, 278, 278, 222, 118, 229, 278, 236, 278, - /* 1650 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1660 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1670 */ 278, 278, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1680 */ 278, 209, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1690 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1700 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1710 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 278, - /* 1720 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1730 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1740 */ 222, 288, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1750 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 1760 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 1770 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 1780 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 1790 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 1800 */ 266, 268, 270, 278, 278, 278, 278, 25, 221, 278, - /* 1810 */ 278, 38, 168, 170, 278, 328, 179, 278, 278, 278, - /* 1820 */ 278, 278, 278, 202, 278, 278, 278, 278, 278, 278, - /* 1830 */ 278, 278, 211, 278, 278, 278, 222, 278, 229, 278, - /* 1840 */ 236, 278, 246, 249, 278, 255, 258, 261, 278, 268, - /* 1850 */ 270, 278, 278, 278, 278, 25, 221, 278, 278, 38, - /* 1860 */ 168, 170, 278, 278, 179, 278, 278, 278, 278, 278, - /* 1870 */ 278, 202, 278, 300, 278, 278, 278, 278, 278, 278, - /* 1880 */ 211, 278, 278, 278, 222, 278, 229, 278, 236, 278, - /* 1890 */ 246, 249, 278, 255, 258, 261, 278, 268, 270, 278, - /* 1900 */ 278, 278, 278, 25, 221, 278, 278, 38, 168, 170, - /* 1910 */ 278, 177, 179, 278, 278, 278, 278, 278, 278, 202, - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 211, 278, - /* 1930 */ 278, 278, 222, 278, 229, 278, 236, 278, 246, 249, - /* 1940 */ 278, 255, 258, 261, 278, 268, 270, 278, 278, 278, - /* 1950 */ 278, 25, 221, 278, 278, 38, 168, 170, 278, 319, - /* 1960 */ 179, 278, 278, 278, 278, 278, 278, 202, 278, 278, - /* 1970 */ 278, 278, 278, 278, 278, 278, 211, 278, 278, 278, - /* 1980 */ 222, 278, 229, 278, 236, 278, 246, 249, 278, 255, - /* 1990 */ 258, 261, 278, 268, 270, 278, 278, 278, 278, 25, - /* 2000 */ 221, 278, 278, 38, 168, 170, 278, 278, 179, 278, - /* 2010 */ 278, 278, 278, 278, 278, 202, 278, 278, 278, 278, - /* 2020 */ 278, 278, 278, 278, 211, 278, 278, 278, 222, 278, - /* 2030 */ 229, 278, 236, 278, 246, 249, 278, 255, 258, 261, - /* 2040 */ 278, 268, 270, 278, 164, 278, 45, 42, 278, 104, - /* 2050 */ 136, 99, 278, 162, 101, 278, 45, 42, 278, 104, - /* 2060 */ 278, 99, 278, 119, 101, 278, 45, 42, 278, 104, - /* 2070 */ 278, 99, 278, 119, 101, 120, 121, 122, 123, 124, - /* 2080 */ 125, 278, 278, 147, 278, 120, 121, 122, 123, 124, - /* 2090 */ 125, 278, 278, 278, 278, 146, 121, 122, 123, 124, - /* 2100 */ 125, 278, 45, 42, 278, 104, 278, 99, 110, 278, - /* 2110 */ 101, 278, 45, 42, 278, 104, 278, 99, 110, 119, - /* 2120 */ 101, 278, 278, 278, 278, 278, 278, 106, 110, 119, - /* 2130 */ 278, 120, 115, 122, 123, 124, 125, 278, 278, 134, - /* 2140 */ 278, 120, 131, 122, 123, 124, 125, 278, 278, 45, - /* 2150 */ 42, 278, 104, 278, 99, 45, 42, 101, 104, 278, - /* 2160 */ 99, 278, 278, 101, 110, 278, 119, 278, 278, 278, - /* 2170 */ 278, 278, 119, 278, 110, 278, 290, 278, 120, 131, - /* 2180 */ 122, 123, 124, 125, 120, 115, 122, 123, 124, 125, - /* 2190 */ 278, 278, 278, 278, 278, 278, 45, 42, 278, 104, - /* 2200 */ 278, 99, 45, 42, 101, 104, 278, 99, 278, 278, - /* 2210 */ 101, 110, 278, 119, 278, 278, 278, 110, 111, 119, - /* 2220 */ 278, 278, 278, 278, 278, 120, 121, 122, 123, 124, - /* 2230 */ 125, 120, 115, 122, 123, 124, 125, 278, 278, 45, - /* 2240 */ 42, 278, 104, 278, 99, 278, 278, 101, 278, 278, - /* 2250 */ 278, 278, 278, 278, 278, 278, 119, 278, 110, 278, - /* 2260 */ 278, 278, 278, 278, 110, 278, 278, 278, 120, 131, - /* 2270 */ 122, 123, 124, 125, 278, 278, 278, 278, 278, 278, - /* 2280 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 2300 */ 278, 110, -}; -static VVCODETYPE vv_lookahead[] = { - /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, - /* 30 */ 26, 27, 28, 29, 30, 38, 21, 22, 23, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 46, 50, 111, 112, - /* 50 */ 113, 3, 4, 2, 6, 7, 8, 9, 10, 11, - /* 60 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 70 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 38, - /* 80 */ 32, 3, 4, 32, 6, 7, 8, 9, 10, 11, - /* 90 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 100 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - /* 110 */ 32, 2, 3, 32, 3, 4, 68, 6, 7, 8, - /* 120 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 130 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 140 */ 29, 30, 31, 32, 3, 4, 32, 6, 7, 8, - /* 150 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 160 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 118, 32, 3, 4, 5, 6, 7, 8, - /* 180 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - /* 190 */ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 3, 4, 2, 6, 7, 8, 9, 10, - /* 210 */ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - /* 220 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - /* 230 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 240 */ 28, 29, 30, 38, 114, 115, 38, 48, 2, 33, - /* 250 */ 48, 3, 4, 48, 6, 7, 8, 9, 10, 11, - /* 260 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 270 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, - /* 280 */ 32, 3, 4, 46, 6, 7, 8, 9, 10, 11, - /* 290 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 300 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 24, - /* 310 */ 25, 26, 27, 28, 29, 30, 50, 51, 52, 53, - /* 320 */ 54, 55, 112, 113, 46, 48, 54, 55, 3, 4, - /* 330 */ 84, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 340 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 350 */ 25, 26, 27, 28, 29, 30, 38, 38, 32, 32, - /* 360 */ 32, 110, 110, 32, 46, 110, 32, 32, 50, 50, - /* 370 */ 32, 46, 120, 122, 122, 3, 4, 122, 6, 7, - /* 380 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 390 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 400 */ 28, 29, 30, 38, 32, 3, 4, 32, 6, 7, - /* 410 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 420 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 32, 32, 3, 4, 46, 6, 7, - /* 440 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 450 */ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - /* 460 */ 28, 29, 30, 3, 4, 32, 6, 7, 8, 9, - /* 470 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 480 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 490 */ 30, 59, 32, 3, 4, 32, 6, 7, 8, 9, - /* 500 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 510 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 113, 32, 3, 4, 32, 6, 7, 8, 9, - /* 530 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 540 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 550 */ 30, 32, 32, 3, 4, 32, 6, 7, 8, 9, - /* 560 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 570 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 580 */ 30, 32, 32, 3, 4, 1, 6, 7, 8, 9, - /* 590 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 600 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 610 */ 30, 3, 4, 57, 6, 7, 8, 9, 10, 11, - /* 620 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - /* 630 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 4, - /* 640 */ 38, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 650 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - /* 660 */ 25, 26, 27, 28, 29, 30, 6, 7, 8, 9, - /* 670 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 680 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 7, 8, 9, 10, 11, 12, 13, 14, 15, - /* 700 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 710 */ 26, 27, 28, 29, 30, 86, 87, 88, 89, 90, - /* 720 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 730 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 740 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 750 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 760 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 770 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 780 */ 107, 108, 109, 9, 10, 11, 12, 13, 14, 15, - /* 790 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - /* 800 */ 26, 27, 28, 29, 30, 88, 89, 90, 91, 92, - /* 810 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 820 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 830 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 840 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 850 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 860 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 870 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 880 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 890 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 900 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 910 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 930 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 940 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 950 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 88, - /* 960 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 970 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 980 */ 109, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 990 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1000 */ 107, 108, 109, 88, 89, 90, 91, 92, 93, 94, - /* 1010 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 1020 */ 105, 106, 107, 108, 109, 88, 89, 90, 91, 92, - /* 1030 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1040 */ 103, 104, 105, 106, 107, 108, 109, 88, 89, 90, - /* 1050 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 1060 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - /* 1080 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - /* 1090 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - /* 1100 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 1110 */ 109, 31, 32, 33, 34, 35, 36, 37, 110, 32, - /* 1120 */ 40, 0, 1, 110, 5, 117, 110, 47, 1, 1, - /* 1130 */ 122, 123, 119, 117, 121, 122, 56, 1, 122, 123, - /* 1140 */ 60, 32, 62, 110, 64, 110, 66, 67, 110, 69, - /* 1150 */ 70, 71, 110, 73, 74, 122, 121, 122, 21, 22, - /* 1160 */ 122, 24, 110, 26, 122, 1, 29, 65, 21, 22, - /* 1170 */ 110, 24, 110, 26, 122, 38, 29, 3, 32, 58, - /* 1180 */ 32, 119, 122, 121, 122, 38, 58, 50, 51, 52, - /* 1190 */ 53, 54, 55, 110, 58, 110, 75, 50, 51, 52, - /* 1200 */ 53, 54, 55, 75, 1, 122, 123, 122, 1, 110, - /* 1210 */ 1, 75, 2, 76, 77, 78, 79, 80, 81, 82, - /* 1220 */ 83, 122, 58, 76, 77, 78, 79, 80, 81, 82, - /* 1230 */ 83, 31, 32, 33, 34, 35, 36, 37, 32, 75, - /* 1240 */ 40, 110, 110, 110, 0, 110, 38, 47, 29, 32, - /* 1250 */ 5, 38, 32, 122, 122, 122, 56, 122, 48, 32, - /* 1260 */ 60, 58, 62, 1, 64, 58, 66, 67, 1, 69, - /* 1270 */ 70, 71, 1, 73, 74, 32, 115, 110, 75, 31, - /* 1280 */ 32, 24, 75, 35, 36, 37, 32, 30, 40, 122, - /* 1290 */ 1, 120, 41, 110, 110, 47, 120, 116, 41, 42, - /* 1300 */ 43, 44, 45, 5, 56, 122, 122, 46, 60, 61, - /* 1310 */ 62, 1, 64, 32, 66, 67, 1, 69, 70, 71, - /* 1320 */ 58, 73, 74, 32, 32, 58, 32, 31, 32, 58, - /* 1330 */ 5, 35, 36, 37, 32, 1, 40, 75, 1, 110, - /* 1340 */ 32, 110, 75, 47, 5, 110, 75, 58, 1, 46, - /* 1350 */ 32, 122, 56, 122, 32, 32, 60, 122, 62, 63, - /* 1360 */ 64, 124, 66, 67, 75, 69, 70, 71, 58, 73, - /* 1370 */ 74, 124, 124, 58, 124, 31, 32, 33, 124, 35, - /* 1380 */ 36, 37, 124, 1, 40, 75, 1, 124, 124, 110, - /* 1390 */ 75, 47, 58, 124, 1, 58, 1, 124, 124, 124, - /* 1400 */ 56, 122, 124, 124, 60, 58, 62, 124, 64, 75, - /* 1410 */ 66, 67, 75, 69, 70, 71, 124, 73, 74, 124, - /* 1420 */ 124, 110, 75, 31, 32, 124, 110, 35, 36, 37, - /* 1430 */ 110, 39, 40, 122, 124, 124, 124, 124, 122, 47, - /* 1440 */ 58, 124, 122, 58, 124, 124, 124, 124, 56, 124, - /* 1450 */ 124, 58, 60, 58, 62, 124, 64, 75, 66, 67, - /* 1460 */ 75, 69, 70, 71, 124, 73, 74, 110, 75, 110, - /* 1470 */ 75, 31, 32, 110, 110, 35, 36, 37, 110, 122, - /* 1480 */ 40, 122, 124, 124, 124, 122, 122, 47, 124, 124, - /* 1490 */ 122, 110, 124, 124, 124, 124, 56, 57, 124, 124, - /* 1500 */ 60, 124, 62, 122, 64, 124, 66, 67, 124, 69, - /* 1510 */ 70, 71, 124, 73, 74, 110, 124, 110, 124, 31, - /* 1520 */ 32, 110, 110, 35, 36, 37, 110, 122, 40, 122, - /* 1530 */ 124, 124, 124, 122, 122, 47, 124, 110, 122, 124, - /* 1540 */ 124, 110, 124, 124, 56, 124, 124, 124, 60, 122, - /* 1550 */ 62, 63, 64, 122, 66, 67, 124, 69, 70, 71, - /* 1560 */ 124, 73, 74, 110, 124, 110, 124, 31, 32, 110, - /* 1570 */ 110, 35, 36, 37, 110, 122, 40, 122, 110, 110, - /* 1580 */ 124, 122, 122, 47, 124, 110, 122, 110, 124, 110, - /* 1590 */ 122, 122, 56, 124, 124, 124, 60, 122, 62, 122, - /* 1600 */ 64, 122, 66, 67, 124, 69, 70, 71, 72, 73, - /* 1610 */ 74, 110, 124, 110, 110, 31, 32, 33, 110, 35, - /* 1620 */ 36, 37, 110, 122, 40, 122, 122, 124, 124, 124, - /* 1630 */ 122, 47, 124, 110, 122, 124, 124, 124, 124, 124, - /* 1640 */ 56, 124, 124, 124, 60, 122, 62, 124, 64, 124, - /* 1650 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1660 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1670 */ 124, 124, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1680 */ 124, 49, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1690 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1700 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1710 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 124, - /* 1720 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1730 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1740 */ 60, 61, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1750 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 1760 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 1770 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 1780 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 1790 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 1800 */ 72, 73, 74, 124, 124, 124, 124, 31, 32, 124, - /* 1810 */ 124, 35, 36, 37, 124, 39, 40, 124, 124, 124, - /* 1820 */ 124, 124, 124, 47, 124, 124, 124, 124, 124, 124, - /* 1830 */ 124, 124, 56, 124, 124, 124, 60, 124, 62, 124, - /* 1840 */ 64, 124, 66, 67, 124, 69, 70, 71, 124, 73, - /* 1850 */ 74, 124, 124, 124, 124, 31, 32, 124, 124, 35, - /* 1860 */ 36, 37, 124, 124, 40, 124, 124, 124, 124, 124, - /* 1870 */ 124, 47, 124, 49, 124, 124, 124, 124, 124, 124, - /* 1880 */ 56, 124, 124, 124, 60, 124, 62, 124, 64, 124, - /* 1890 */ 66, 67, 124, 69, 70, 71, 124, 73, 74, 124, - /* 1900 */ 124, 124, 124, 31, 32, 124, 124, 35, 36, 37, - /* 1910 */ 124, 39, 40, 124, 124, 124, 124, 124, 124, 47, - /* 1920 */ 124, 124, 124, 124, 124, 124, 124, 124, 56, 124, - /* 1930 */ 124, 124, 60, 124, 62, 124, 64, 124, 66, 67, - /* 1940 */ 124, 69, 70, 71, 124, 73, 74, 124, 124, 124, - /* 1950 */ 124, 31, 32, 124, 124, 35, 36, 37, 124, 39, - /* 1960 */ 40, 124, 124, 124, 124, 124, 124, 47, 124, 124, - /* 1970 */ 124, 124, 124, 124, 124, 124, 56, 124, 124, 124, - /* 1980 */ 60, 124, 62, 124, 64, 124, 66, 67, 124, 69, - /* 1990 */ 70, 71, 124, 73, 74, 124, 124, 124, 124, 31, - /* 2000 */ 32, 124, 124, 35, 36, 37, 124, 124, 40, 124, - /* 2010 */ 124, 124, 124, 124, 124, 47, 124, 124, 124, 124, - /* 2020 */ 124, 124, 124, 124, 56, 124, 124, 124, 60, 124, - /* 2030 */ 62, 124, 64, 124, 66, 67, 124, 69, 70, 71, - /* 2040 */ 124, 73, 74, 124, 19, 124, 21, 22, 124, 24, - /* 2050 */ 5, 26, 124, 18, 29, 124, 21, 22, 124, 24, - /* 2060 */ 124, 26, 124, 38, 29, 124, 21, 22, 124, 24, - /* 2070 */ 124, 26, 124, 38, 29, 50, 51, 52, 53, 54, - /* 2080 */ 55, 124, 124, 38, 124, 50, 51, 52, 53, 54, - /* 2090 */ 55, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2100 */ 55, 124, 21, 22, 124, 24, 124, 26, 83, 124, - /* 2110 */ 29, 124, 21, 22, 124, 24, 124, 26, 83, 38, - /* 2120 */ 29, 124, 124, 124, 124, 124, 124, 46, 83, 38, - /* 2130 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 48, - /* 2140 */ 124, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2150 */ 22, 124, 24, 124, 26, 21, 22, 29, 24, 124, - /* 2160 */ 26, 124, 124, 29, 83, 124, 38, 124, 124, 124, - /* 2170 */ 124, 124, 38, 124, 83, 124, 48, 124, 50, 51, - /* 2180 */ 52, 53, 54, 55, 50, 51, 52, 53, 54, 55, - /* 2190 */ 124, 124, 124, 124, 124, 124, 21, 22, 124, 24, - /* 2200 */ 124, 26, 21, 22, 29, 24, 124, 26, 124, 124, - /* 2210 */ 29, 83, 124, 38, 124, 124, 124, 83, 84, 38, - /* 2220 */ 124, 124, 124, 124, 124, 50, 51, 52, 53, 54, - /* 2230 */ 55, 50, 51, 52, 53, 54, 55, 124, 124, 21, - /* 2240 */ 22, 124, 24, 124, 26, 124, 124, 29, 124, 124, - /* 2250 */ 124, 124, 124, 124, 124, 124, 38, 124, 83, 124, - /* 2260 */ 124, 124, 124, 124, 83, 124, 124, 124, 50, 51, - /* 2270 */ 52, 53, 54, 55, 124, 124, 124, 124, 124, 124, - /* 2280 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - /* 2300 */ 124, 83, -}; -#define VV_SHIFT_USE_DFLT (-4) -static short vv_shift_ofst[] = { - /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, - /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, - /* 30 */ 1227, -4, 1243, 1203, 1262, 1344, 81, -4, 2175, 372, - /* 40 */ -4, 2175, 2175, 285, 2175, 2175, 285, 2025, 15, 2035, - /* 50 */ 15, 2175, 15, 2175, 774, 2175, 774, 2175, 285, 2175, - /* 60 */ 4, 2175, 684, 2175, 212, 1137, 212, 1147, 212, 2175, - /* 70 */ 212, 2175, 212, 2175, 212, 2175, 212, 2175, 212, 2175, - /* 80 */ 212, 2175, -4, 2175, 635, 25, 2175, 4, -4, -4, - /* 90 */ 2045, 278, -4, 2175, 171, 2175, 660, 2091, 608, 2175, - /* 100 */ 4, 2175, 199, -4, 2081, 608, -4, 0, -4, 2181, - /* 110 */ 2134, -4, 246, -4, -4, 1298, 2175, 608, -4, -4, - /* 120 */ -4, -4, -4, -4, -4, -4, -4, 1210, -4, 2218, - /* 130 */ -4, 1325, 2175, 608, -4, -4, 319, 1261, -4, 1303, - /* 140 */ 391, 1339, 318, -4, 237, -4, 1119, 1245, -4, -4, - /* 150 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - /* 160 */ -4, -4, 2175, 15, 2175, 15, 285, 285, 493, -4, - /* 170 */ 365, 109, 2175, 78, 1128, 1207, 1872, 1281, -4, 208, - /* 180 */ 51, -4, 208, -4, 1257, 2175, 608, 2175, 608, 2175, - /* 190 */ 608, 2175, 608, 2175, 608, 2175, 325, -4, 208, -4, - /* 200 */ -4, -4, 1208, 1219, 205, 1254, 1128, 1267, 1632, 1302, - /* 210 */ -4, 2175, 580, 2128, 277, 334, 1128, 1271, 1440, 1292, - /* 220 */ -4, -4, 41, 326, 1289, 1310, 1248, 114, -4, 2175, - /* 230 */ -3, 1128, 1315, 1296, 331, -4, 401, 1128, 2175, 432, - /* 240 */ -4, 1127, 1102, 1206, -4, -4, 2175, 490, -4, 2175, - /* 250 */ 48, -4, 2175, 520, -4, 2175, 550, -4, 2175, 141, - /* 260 */ -4, 272, 1109, 1128, 1334, 1728, 1308, -4, 1323, -4, - /* 270 */ 327, -4, -4, 1294, 1128, 1337, 1536, 1322, -4, 523, - /* 280 */ 1128, 1347, 1488, 328, -4, 338, 375, 1680, 463, -4, - /* 290 */ 519, 584, 556, 1087, -4, 202, 1146, 1128, 1382, 1824, - /* 300 */ 1217, -4, 1213, -4, 1251, 266, -4, -4, -4, -4, - /* 310 */ -4, -4, -4, -4, 2175, 248, 1128, 1385, 1920, 433, - /* 320 */ -4, 602, 1174, 2175, 111, 1128, 1393, 1776, 1318, -4, - /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, - /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, -}; -#define VV_REDUCE_USE_DFLT (-64) -static short vv_reduce_ofst[] = { - /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, - /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, - /* 30 */ -64, -64, -64, 937, 980, -64, -64, -64, 1184, -64, - /* 40 */ -64, 1038, 1523, -64, 1464, 1459, -64, 1453, -64, 1411, - /* 50 */ -64, 1381, -64, 1135, -64, 251, -64, 1131, -64, 1427, - /* 60 */ -64, 1363, -64, 1279, -64, 1359, -64, 1099, -64, 1052, - /* 70 */ -64, 1183, -64, 1479, -64, 1357, -64, 1512, -64, 1503, - /* 80 */ -64, 1501, -64, 1469, -64, -64, 1431, -64, -64, -64, - /* 90 */ 252, -64, -64, 1468, -64, 1475, -64, 1008, -64, 1508, - /* 100 */ -64, 255, -64, -64, 1013, -64, -64, -64, -64, 1035, - /* 110 */ 1062, -64, -64, -64, -64, -64, 1060, -64, -64, -64, - /* 120 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, 1083, - /* 130 */ -64, -64, 1407, -64, -64, -64, 1171, -64, -64, -64, - /* 140 */ -64, -64, 1176, -64, -64, -64, -64, -64, -64, -64, - /* 150 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - /* 160 */ -64, -64, 1311, -64, 1368, -64, -64, -64, -64, -64, - /* 170 */ -64, -64, 1132, -64, 849, 980, -64, -64, -64, -63, - /* 180 */ -64, -64, 210, -64, -64, 1405, -64, 1416, -64, 1455, - /* 190 */ -64, 1460, -64, 1504, -64, 1042, -64, -64, 408, -64, - /* 200 */ -64, -64, -64, -64, 130, -64, 673, 980, -64, -64, - /* 210 */ -64, 1231, -64, 1016, -64, -64, 761, 980, -64, -64, - /* 220 */ -64, -64, -64, -64, 959, 980, -64, -64, -64, 1477, - /* 230 */ 54, 717, 980, -64, -64, -64, -64, 1001, 1085, -64, - /* 240 */ -64, -64, -64, -64, -64, -64, 1133, -64, -64, 1167, - /* 250 */ -64, -64, 1229, -64, -64, 1235, -64, -64, 1320, -64, - /* 260 */ -64, -64, -64, 739, 980, -64, -64, -64, -64, -64, - /* 270 */ -64, -64, -64, -64, 805, 980, -64, -64, -64, -64, - /* 280 */ 783, 980, -64, -64, -64, -64, -64, -64, -64, -64, - /* 290 */ -64, -64, -64, -64, -64, -64, -64, 871, 980, -64, - /* 300 */ -64, -64, 1161, -64, -64, 1181, -64, -64, -64, -64, - /* 310 */ -64, -64, -64, -64, 1316, -64, 893, 980, -64, -64, - /* 320 */ -64, -64, -64, 1364, -64, 915, 980, -64, -64, -64, - /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, - /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, -}; -static VVACTIONTYPE vv_default[] = { - /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, - /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, - /* 30 */ 500, 372, 500, 500, 500, 500, 500, 374, 500, 500, - /* 40 */ 377, 500, 500, 427, 500, 500, 428, 500, 431, 500, - /* 50 */ 433, 500, 435, 500, 436, 500, 437, 500, 438, 500, - /* 60 */ 439, 500, 440, 500, 441, 500, 457, 500, 456, 500, - /* 70 */ 458, 500, 459, 500, 460, 500, 461, 500, 462, 500, - /* 80 */ 463, 500, 464, 500, 465, 500, 500, 466, 468, 469, - /* 90 */ 500, 500, 475, 500, 500, 500, 476, 500, 491, 500, - /* 100 */ 467, 500, 500, 470, 500, 485, 471, 500, 472, 500, - /* 110 */ 500, 473, 500, 474, 483, 495, 500, 484, 486, 493, - /* 120 */ 494, 495, 496, 497, 498, 499, 482, 500, 487, 500, - /* 130 */ 489, 495, 500, 492, 488, 490, 500, 500, 477, 500, - /* 140 */ 500, 500, 500, 478, 500, 479, 494, 493, 443, 445, - /* 150 */ 447, 449, 451, 453, 455, 442, 444, 446, 448, 450, - /* 160 */ 452, 454, 500, 434, 500, 432, 430, 429, 500, 378, - /* 170 */ 500, 500, 500, 500, 500, 500, 500, 500, 379, 500, - /* 180 */ 500, 383, 500, 384, 500, 500, 386, 500, 387, 500, - /* 190 */ 388, 500, 389, 500, 390, 500, 500, 392, 500, 391, - /* 200 */ 393, 385, 500, 500, 500, 500, 500, 500, 500, 500, - /* 210 */ 394, 500, 500, 500, 500, 487, 500, 500, 500, 500, - /* 220 */ 406, 408, 500, 500, 500, 500, 500, 500, 410, 500, - /* 230 */ 500, 500, 500, 500, 500, 412, 500, 500, 500, 500, - /* 240 */ 409, 500, 500, 500, 416, 426, 500, 500, 417, 500, - /* 250 */ 500, 418, 500, 500, 419, 500, 500, 420, 500, 500, - /* 260 */ 421, 500, 500, 500, 500, 500, 500, 422, 500, 424, - /* 270 */ 500, 425, 351, 500, 500, 500, 500, 500, 423, 500, - /* 280 */ 500, 500, 500, 500, 413, 500, 500, 500, 500, 411, - /* 290 */ 488, 500, 500, 500, 407, 500, 500, 500, 500, 500, - /* 300 */ 500, 395, 500, 396, 398, 500, 399, 400, 401, 402, - /* 310 */ 403, 404, 405, 397, 500, 500, 500, 500, 500, 500, - /* 320 */ 380, 500, 500, 500, 500, 500, 500, 500, 500, 381, - /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, - /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, -}; -#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef VVFALLBACK -static const VVCODETYPE vvFallback[] = { -}; -#endif /* VVFALLBACK */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct vvStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - VVMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct vvStackEntry vvStackEntry; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct vvParser { - int vvidx; /* Index of top element in stack */ - int vverrcnt; /* Shifts left before out of the error */ - phvolt_ARG_SDECL /* A place to hold %extra_argument */ - vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ -}; -typedef struct vvParser vvParser; +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); -#ifndef NDEBUG -static FILE *vvTraceFILE = 0; -static char *vvTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); -#ifndef NDEBUG -static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - vvTraceFILE = TraceFILE; - vvTracePrompt = zTracePrompt; - if( vvTraceFILE==0 ) vvTracePrompt = 0; - else if( vvTracePrompt==0 ) vvTraceFILE = 0; -} -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *vvTokenName[] = { - "$", "OPEN_DELIMITER", "COMMA", "IN", - "QUESTION", "COLON", "RANGE", "AND", - "OR", "IS", "EQUALS", "NOTEQUALS", - "LESS", "GREATER", "GREATEREQUAL", "LESSEQUAL", - "IDENTICAL", "NOTIDENTICAL", "DIVIDE", "TIMES", - "MOD", "PLUS", "MINUS", "CONCAT", - "SBRACKET_OPEN", "PIPE", "NOT", "INCR", - "DECR", "PARENTHESES_OPEN", "DOT", "IF", - "CLOSE_DELIMITER", "ENDIF", "ELSE", "ELSEIF", - "ELSEFOR", "FOR", "IDENTIFIER", "ENDFOR", - "SET", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", - "MUL_ASSIGN", "DIV_ASSIGN", "SBRACKET_CLOSE", "MACRO", - "PARENTHESES_CLOSE", "ENDMACRO", "INTEGER", "STRING", - "DOUBLE", "NULL", "FALSE", "TRUE", - "CALL", "ENDCALL", "OPEN_EDELIMITER", "CLOSE_EDELIMITER", - "BLOCK", "ENDBLOCK", "CACHE", "ENDCACHE", - "RAW", "ENDRAW", "EXTENDS", "INCLUDE", - "WITH", "DO", "RETURN", "AUTOESCAPE", - "ENDAUTOESCAPE", "BREAK", "CONTINUE", "RAW_FRAGMENT", - "DEFINED", "EMPTY", "EVEN", "ODD", - "NUMERIC", "SCALAR", "ITERABLE", "CBRACKET_OPEN", - "CBRACKET_CLOSE", "error", "program", "volt_language", - "statement_list", "statement", "raw_fragment", "if_statement", - "elseif_statement", "elsefor_statement", "for_statement", "set_statement", - "echo_statement", "block_statement", "cache_statement", "extends_statement", - "include_statement", "do_statement", "return_statement", "autoescape_statement", - "raw_statement", "break_statement", "continue_statement", "macro_statement", - "empty_statement", "macro_call_statement", "expr", "set_assignments", - "set_assignment", "assignable_expr", "macro_parameters", "macro_parameter", - "macro_parameter_default", "argument_list", "cache_lifetime", "array_list", - "slice_offset", "array_item", "function_call", "argument_item", -}; -#endif /* NDEBUG */ +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *vvRuleName[] = { - /* 0 */ "program ::= volt_language", - /* 1 */ "volt_language ::= statement_list", - /* 2 */ "statement_list ::= statement_list statement", - /* 3 */ "statement_list ::= statement", - /* 4 */ "statement ::= raw_fragment", - /* 5 */ "statement ::= if_statement", - /* 6 */ "statement ::= elseif_statement", - /* 7 */ "statement ::= elsefor_statement", - /* 8 */ "statement ::= for_statement", - /* 9 */ "statement ::= set_statement", - /* 10 */ "statement ::= echo_statement", - /* 11 */ "statement ::= block_statement", - /* 12 */ "statement ::= cache_statement", - /* 13 */ "statement ::= extends_statement", - /* 14 */ "statement ::= include_statement", - /* 15 */ "statement ::= do_statement", - /* 16 */ "statement ::= return_statement", - /* 17 */ "statement ::= autoescape_statement", - /* 18 */ "statement ::= raw_statement", - /* 19 */ "statement ::= break_statement", - /* 20 */ "statement ::= continue_statement", - /* 21 */ "statement ::= macro_statement", - /* 22 */ "statement ::= empty_statement", - /* 23 */ "statement ::= macro_call_statement", - /* 24 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 25 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 26 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 27 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 28 */ "if_statement ::= OPEN_DELIMITER IF expr CLOSE_DELIMITER OPEN_DELIMITER ELSE CLOSE_DELIMITER OPEN_DELIMITER ENDIF CLOSE_DELIMITER", - /* 29 */ "elseif_statement ::= OPEN_DELIMITER ELSEIF expr CLOSE_DELIMITER", - /* 30 */ "elsefor_statement ::= OPEN_DELIMITER ELSEFOR CLOSE_DELIMITER", - /* 31 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 32 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 33 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 34 */ "for_statement ::= OPEN_DELIMITER FOR IDENTIFIER COMMA IDENTIFIER IN expr IF expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDFOR CLOSE_DELIMITER", - /* 35 */ "set_statement ::= OPEN_DELIMITER SET set_assignments CLOSE_DELIMITER", - /* 36 */ "set_assignments ::= set_assignments COMMA set_assignment", - /* 37 */ "set_assignments ::= set_assignment", - /* 38 */ "set_assignment ::= assignable_expr ASSIGN expr", - /* 39 */ "set_assignment ::= assignable_expr ADD_ASSIGN expr", - /* 40 */ "set_assignment ::= assignable_expr SUB_ASSIGN expr", - /* 41 */ "set_assignment ::= assignable_expr MUL_ASSIGN expr", - /* 42 */ "set_assignment ::= assignable_expr DIV_ASSIGN expr", - /* 43 */ "assignable_expr ::= IDENTIFIER", - /* 44 */ "assignable_expr ::= assignable_expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 45 */ "assignable_expr ::= assignable_expr DOT assignable_expr", - /* 46 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 47 */ "macro_statement ::= OPEN_DELIMITER MACRO IDENTIFIER PARENTHESES_OPEN macro_parameters PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDMACRO CLOSE_DELIMITER", - /* 48 */ "macro_parameters ::= macro_parameters COMMA macro_parameter", - /* 49 */ "macro_parameters ::= macro_parameter", - /* 50 */ "macro_parameter ::= IDENTIFIER", - /* 51 */ "macro_parameter ::= IDENTIFIER ASSIGN macro_parameter_default", - /* 52 */ "macro_parameter_default ::= INTEGER", - /* 53 */ "macro_parameter_default ::= STRING", - /* 54 */ "macro_parameter_default ::= DOUBLE", - /* 55 */ "macro_parameter_default ::= NULL", - /* 56 */ "macro_parameter_default ::= FALSE", - /* 57 */ "macro_parameter_default ::= TRUE", - /* 58 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 59 */ "macro_call_statement ::= OPEN_DELIMITER CALL expr PARENTHESES_OPEN PARENTHESES_CLOSE CLOSE_DELIMITER OPEN_DELIMITER ENDCALL CLOSE_DELIMITER", - /* 60 */ "empty_statement ::= OPEN_DELIMITER CLOSE_DELIMITER", - /* 61 */ "echo_statement ::= OPEN_EDELIMITER expr CLOSE_EDELIMITER", - /* 62 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 63 */ "block_statement ::= OPEN_DELIMITER BLOCK IDENTIFIER CLOSE_DELIMITER OPEN_DELIMITER ENDBLOCK CLOSE_DELIMITER", - /* 64 */ "cache_statement ::= OPEN_DELIMITER CACHE expr CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 65 */ "cache_statement ::= OPEN_DELIMITER CACHE expr cache_lifetime CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDCACHE CLOSE_DELIMITER", - /* 66 */ "cache_lifetime ::= INTEGER", - /* 67 */ "cache_lifetime ::= IDENTIFIER", - /* 68 */ "raw_statement ::= OPEN_DELIMITER RAW CLOSE_DELIMITER statement OPEN_DELIMITER ENDRAW CLOSE_DELIMITER", - /* 69 */ "extends_statement ::= OPEN_DELIMITER EXTENDS expr CLOSE_DELIMITER", - /* 70 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr CLOSE_DELIMITER", - /* 71 */ "include_statement ::= OPEN_DELIMITER INCLUDE expr WITH expr CLOSE_DELIMITER", - /* 72 */ "do_statement ::= OPEN_DELIMITER DO expr CLOSE_DELIMITER", - /* 73 */ "return_statement ::= OPEN_DELIMITER RETURN expr CLOSE_DELIMITER", - /* 74 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE FALSE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 75 */ "autoescape_statement ::= OPEN_DELIMITER AUTOESCAPE TRUE CLOSE_DELIMITER statement_list OPEN_DELIMITER ENDAUTOESCAPE CLOSE_DELIMITER", - /* 76 */ "break_statement ::= OPEN_DELIMITER BREAK CLOSE_DELIMITER", - /* 77 */ "continue_statement ::= OPEN_DELIMITER CONTINUE CLOSE_DELIMITER", - /* 78 */ "raw_fragment ::= RAW_FRAGMENT", - /* 79 */ "expr ::= MINUS expr", - /* 80 */ "expr ::= PLUS expr", - /* 81 */ "expr ::= expr MINUS expr", - /* 82 */ "expr ::= expr PLUS expr", - /* 83 */ "expr ::= expr TIMES expr", - /* 84 */ "expr ::= expr TIMES TIMES expr", - /* 85 */ "expr ::= expr DIVIDE expr", - /* 86 */ "expr ::= expr DIVIDE DIVIDE expr", - /* 87 */ "expr ::= expr MOD expr", - /* 88 */ "expr ::= expr AND expr", - /* 89 */ "expr ::= expr OR expr", - /* 90 */ "expr ::= expr CONCAT expr", - /* 91 */ "expr ::= expr PIPE expr", - /* 92 */ "expr ::= expr RANGE expr", - /* 93 */ "expr ::= expr EQUALS expr", - /* 94 */ "expr ::= expr NOTEQUALS DEFINED", - /* 95 */ "expr ::= expr IS DEFINED", - /* 96 */ "expr ::= expr NOTEQUALS EMPTY", - /* 97 */ "expr ::= expr IS EMPTY", - /* 98 */ "expr ::= expr NOTEQUALS EVEN", - /* 99 */ "expr ::= expr IS EVEN", - /* 100 */ "expr ::= expr NOTEQUALS ODD", - /* 101 */ "expr ::= expr IS ODD", - /* 102 */ "expr ::= expr NOTEQUALS NUMERIC", - /* 103 */ "expr ::= expr IS NUMERIC", - /* 104 */ "expr ::= expr NOTEQUALS SCALAR", - /* 105 */ "expr ::= expr IS SCALAR", - /* 106 */ "expr ::= expr NOTEQUALS ITERABLE", - /* 107 */ "expr ::= expr IS ITERABLE", - /* 108 */ "expr ::= expr IS expr", - /* 109 */ "expr ::= expr NOTEQUALS expr", - /* 110 */ "expr ::= expr IDENTICAL expr", - /* 111 */ "expr ::= expr NOTIDENTICAL expr", - /* 112 */ "expr ::= expr LESS expr", - /* 113 */ "expr ::= expr GREATER expr", - /* 114 */ "expr ::= expr GREATEREQUAL expr", - /* 115 */ "expr ::= expr LESSEQUAL expr", - /* 116 */ "expr ::= expr DOT expr", - /* 117 */ "expr ::= expr IN expr", - /* 118 */ "expr ::= expr NOT IN expr", - /* 119 */ "expr ::= NOT expr", - /* 120 */ "expr ::= expr INCR", - /* 121 */ "expr ::= expr DECR", - /* 122 */ "expr ::= PARENTHESES_OPEN expr PARENTHESES_CLOSE", - /* 123 */ "expr ::= SBRACKET_OPEN SBRACKET_CLOSE", - /* 124 */ "expr ::= SBRACKET_OPEN array_list SBRACKET_CLOSE", - /* 125 */ "expr ::= CBRACKET_OPEN CBRACKET_CLOSE", - /* 126 */ "expr ::= CBRACKET_OPEN array_list CBRACKET_CLOSE", - /* 127 */ "expr ::= expr SBRACKET_OPEN expr SBRACKET_CLOSE", - /* 128 */ "expr ::= expr QUESTION expr COLON expr", - /* 129 */ "expr ::= expr SBRACKET_OPEN COLON slice_offset SBRACKET_CLOSE", - /* 130 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON SBRACKET_CLOSE", - /* 131 */ "expr ::= expr SBRACKET_OPEN slice_offset COLON slice_offset SBRACKET_CLOSE", - /* 132 */ "slice_offset ::= INTEGER", - /* 133 */ "slice_offset ::= IDENTIFIER", - /* 134 */ "array_list ::= array_list COMMA array_item", - /* 135 */ "array_list ::= array_item", - /* 136 */ "array_item ::= STRING COLON expr", - /* 137 */ "array_item ::= expr", - /* 138 */ "expr ::= function_call", - /* 139 */ "function_call ::= expr PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 140 */ "function_call ::= expr PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 141 */ "argument_list ::= argument_list COMMA argument_item", - /* 142 */ "argument_list ::= argument_item", - /* 143 */ "argument_item ::= expr", - /* 144 */ "argument_item ::= STRING COLON expr", - /* 145 */ "expr ::= IDENTIFIER", - /* 146 */ "expr ::= INTEGER", - /* 147 */ "expr ::= STRING", - /* 148 */ "expr ::= DOUBLE", - /* 149 */ "expr ::= NULL", - /* 150 */ "expr ::= FALSE", - /* 151 */ "expr ::= TRUE", -}; -#endif /* NDEBUG */ -const char *phvolt_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ - return vvTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; + + +#ifdef HAVE_CONFIG_H #endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_pattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_compiledPattern"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_paths"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_methods"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_hostname"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_converters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_id"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_beforeMatch"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_match"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_group"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("_uniqueId"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC TSRMLS_CC); + + zend_class_implements(phalcon_mvc_router_route_ce TSRMLS_CC, 1, phalcon_mvc_router_routeinterface_ce); + return SUCCESS; + } -void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - vvParser *pParser; - pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); - if( pParser ){ - pParser->vvidx = -1; - } - return pParser; +static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *routeId = NULL, *uniqueId = NULL, *_0; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + if (!httpMethods) { + httpMethods = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + ZEPHIR_OBS_VAR(uniqueId); + zephir_read_static_property_ce(&uniqueId, phalcon_mvc_router_route_ce, SL("_uniqueId") TSRMLS_CC); + if (Z_TYPE_P(uniqueId) == IS_NULL) { + ZEPHIR_INIT_NVAR(uniqueId); + ZVAL_LONG(uniqueId, 0); + } + ZEPHIR_CPY_WRT(routeId, uniqueId); + zephir_update_property_this(this_ptr, SL("_id"), routeId TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, (zephir_get_numberval(uniqueId) + 1)); + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &_0 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "vvmajor" is the symbol code, and "vvpminor" is a pointer to -** the value. -*/ -static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ - switch( vvmajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: -// 146 "parser.php7.lemon" -{ - if ((vvpminor->vv0)) { - if ((vvpminor->vv0)->free_flag) { - efree((vvpminor->vv0)->token); +static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { + + zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 89)) { + ZEPHIR_INIT_VAR(idPattern); + ZVAL_STRING(idPattern, "/([\\w0-9\\_\\-]+)", 1); + if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 95)) { + ZEPHIR_INIT_VAR(_0$$4); + ZEPHIR_SINIT_VAR(_1$$4); + ZVAL_STRING(&_1$$4, "/:module", 0); + zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _0$$4); + } + if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 100)) { + ZEPHIR_INIT_VAR(_2$$5); + ZEPHIR_SINIT_VAR(_3$$5); + ZVAL_STRING(&_3$$5, "/:controller", 0); + zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _2$$5); + } + if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 105)) { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_SINIT_VAR(_5$$6); + ZVAL_STRING(&_5$$6, "/:namespace", 0); + zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _4$$6); + } + if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 110)) { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_SINIT_VAR(_7$$7); + ZVAL_STRING(&_7$$7, "/:action", 0); + zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); + zephir_get_strval(pattern, _6$$7); + } + if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 115)) { + ZEPHIR_INIT_VAR(_8$$8); + ZEPHIR_SINIT_VAR(_9$$8); + ZVAL_STRING(&_9$$8, "/:params", 0); + ZEPHIR_SINIT_VAR(_10$$8); + ZVAL_STRING(&_10$$8, "(/.*)*", 0); + zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); + zephir_get_strval(pattern, _8$$8); + } + if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 120)) { + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_SINIT_VAR(_12$$9); + ZVAL_STRING(&_12$$9, "/:int", 0); + ZEPHIR_SINIT_VAR(_13$$9); + ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); + zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); + zephir_get_strval(pattern, _11$$9); } - efree((vvpminor->vv0)); } -} -// 1133 "parser.php7.c" - break; - case 88: - case 89: - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 114: - case 115: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: -// 163 "parser.php7.lemon" -{ - zval_ptr_dtor(&(vvpminor->vv146)); -} -// 1173 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } + if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 126)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 131)) { + ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#u"); + RETURN_MM(); + } + RETURN_CTOR(pattern); + } -static int vv_pop_parser_stack(vvParser *pParser){ - VVCODETYPE vvmajor; - vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; +static PHP_METHOD(Phalcon_Mvc_Router_Route, via) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); - if( pParser->vvidx<0 ) return 0; -#ifndef NDEBUG - if( vvTraceFILE && pParser->vvidx>=0 ){ - fprintf(vvTraceFILE,"%sPopping %s\n", - vvTracePrompt, - vvTokenName[vvtos->major]); - } -#endif - vvmajor = vvtos->major; - vv_destructor( vvmajor, &vvtos->minor); - pParser->vvidx--; - return vvmajor; } -static void phvolt_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - vvParser *pParser = (vvParser*)p; - if( pParser==0 ) return; - while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); +static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { + + long _0, _5$$11, _26$$19; + zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18, _31$$36, _32$$37, _33$$37, _34$$37; + int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; + char ch = 0, prevCh; + zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_28$$19 = NULL, *_29$$28 = NULL; + zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = NULL, *_27$$26 = NULL, *_30$$29 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &pattern_param); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + + + prevCh = '\0'; + bracketCount = 0; + parenthesesCount = 0; + foundPattern = 0; + intermediate = 0; + numberMatches = 0; + if (zephir_fast_strlen_ev(pattern) <= 0) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(matches); + array_init(matches); + ZEPHIR_INIT_VAR(route); + ZVAL_EMPTY_STRING(route); + for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) { + cursor = _0; + ch = ZEPHIR_STRING_OFFSET(pattern, _0); + if (parenthesesCount == 0) { + if (ch == '{') { + if (bracketCount == 0) { + marker = (cursor + 1); + intermediate = 0; + notValid = 0; + } + bracketCount++; + } else { + if (ch == '}') { + bracketCount--; + if (intermediate > 0) { + if (bracketCount == 0) { + numberMatches++; + ZEPHIR_INIT_NVAR(variable); + ZVAL_EMPTY_STRING(variable); + ZEPHIR_INIT_NVAR(regexp); + ZVAL_EMPTY_STRING(regexp); + ZEPHIR_SINIT_NVAR(_1$$11); + ZVAL_LONG(&_1$$11, marker); + ZEPHIR_SINIT_NVAR(_2$$11); + ZVAL_LONG(&_2$$11, (cursor - marker)); + ZEPHIR_INIT_NVAR(_3$$11); + zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0); + zephir_get_strval(_4$$11, _3$$11); + ZEPHIR_CPY_WRT(item, _4$$11); + for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) { + cursorVar = _5$$11; + ch = ZEPHIR_STRING_OFFSET(item, _5$$11); + if (ch == '\0') { + break; + } + _6$$12 = cursorVar == 0; + if (_6$$12) { + _7$$12 = ch >= 'a'; + if (_7$$12) { + _7$$12 = ch <= 'z'; + } + _8$$12 = _7$$12; + if (!(_8$$12)) { + _9$$12 = ch >= 'A'; + if (_9$$12) { + _9$$12 = ch <= 'Z'; + } + _8$$12 = _9$$12; + } + _6$$12 = !(_8$$12); + } + if (_6$$12) { + notValid = 1; + break; + } + _10$$12 = ch >= 'a'; + if (_10$$12) { + _10$$12 = ch <= 'z'; + } + _11$$12 = _10$$12; + if (!(_11$$12)) { + _12$$12 = ch >= 'A'; + if (_12$$12) { + _12$$12 = ch <= 'Z'; + } + _11$$12 = _12$$12; + } + _13$$12 = _11$$12; + if (!(_13$$12)) { + _14$$12 = ch >= '0'; + if (_14$$12) { + _14$$12 = ch <= '9'; + } + _13$$12 = _14$$12; + } + _15$$12 = _13$$12; + if (!(_15$$12)) { + _15$$12 = ch == '-'; + } + _16$$12 = _15$$12; + if (!(_16$$12)) { + _16$$12 = ch == '_'; + } + _17$$12 = _16$$12; + if (!(_17$$12)) { + _17$$12 = ch == ':'; + } + if (_17$$12) { + if (ch == ':') { + ZEPHIR_SINIT_NVAR(_18$$16); + ZVAL_LONG(&_18$$16, 0); + ZEPHIR_SINIT_NVAR(_19$$16); + ZVAL_LONG(&_19$$16, cursorVar); + ZEPHIR_INIT_NVAR(_20$$16); + zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0); + zephir_get_strval(_21$$16, _20$$16); + ZEPHIR_CPY_WRT(variable, _21$$16); + ZEPHIR_SINIT_NVAR(_22$$16); + ZVAL_LONG(&_22$$16, (cursorVar + 1)); + ZEPHIR_INIT_NVAR(_23$$16); + zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_get_strval(_24$$16, _23$$16); + ZEPHIR_CPY_WRT(regexp, _24$$16); + break; + } + } else { + notValid = 1; + break; + } + } + if (!(notValid)) { + tmp = numberMatches; + _25$$18 = zephir_is_true(variable); + if (_25$$18) { + _25$$18 = zephir_is_true(regexp); + } + if (_25$$18) { + foundPattern = 0; + for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) { + ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19); + if (ch == '\0') { + break; + } + if (!(foundPattern)) { + if (ch == '(') { + foundPattern = 1; + } + } else { + if (ch == ')') { + foundPattern = 2; + break; + } + } + } + if (foundPattern != 2) { + ZEPHIR_INIT_LNVAR(_27$$26); + ZEPHIR_CONCAT_SVS(_27$$26, "(", regexp, ")"); + zephir_concat_self(&route, _27$$26 TSRMLS_CC); + } else { + zephir_concat_self(&route, regexp TSRMLS_CC); + } + ZEPHIR_INIT_NVAR(_28$$19); + ZVAL_LONG(_28$$19, tmp); + zephir_array_update_zval(&matches, variable, &_28$$19, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC); + ZEPHIR_INIT_NVAR(_29$$28); + ZVAL_LONG(_29$$28, tmp); + zephir_array_update_zval(&matches, item, &_29$$28, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_INIT_LNVAR(_30$$29); + ZEPHIR_CONCAT_SVS(_30$$29, "{", item, "}"); + zephir_concat_self(&route, _30$$29 TSRMLS_CC); + } + continue; + } + } + } + } + } + if (bracketCount == 0) { + if (ch == '(') { + parenthesesCount++; + } else { + if (ch == ')') { + parenthesesCount--; + if (parenthesesCount == 0) { + numberMatches++; + } + } + } + } + if (bracketCount > 0) { + intermediate++; + } else { + _31$$36 = parenthesesCount == 0; + if (_31$$36) { + _31$$36 = prevCh != '\\'; + } + if (_31$$36) { + _32$$37 = ch == '.'; + if (!(_32$$37)) { + _32$$37 = ch == '+'; + } + _33$$37 = _32$$37; + if (!(_33$$37)) { + _33$$37 = ch == '|'; + } + _34$$37 = _33$$37; + if (!(_34$$37)) { + _34$$37 = ch == '#'; + } + if (_34$$37) { + zephir_concat_self_str(&route, "\\", sizeof("\\")-1 TSRMLS_CC); + } + } + zephir_concat_self_char(&route, ch TSRMLS_CC); + prevCh = ch; + } + } + zephir_create_array(return_value, 2, 0 TSRMLS_CC); + zephir_array_fast_append(return_value, route); + zephir_array_fast_append(return_value, matches); + RETURN_MM(); + } -static int vv_find_shift_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ - i = vv_shift_ofst[stateno]; - if( i==VV_SHIFT_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ -#ifdef VVFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); - } -#endif - return vv_find_shift_action(pParser, iFallback); - } -#endif - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0$$4, *_1$$4; + zval *pattern = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + + if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(pattern); + ZVAL_EMPTY_STRING(pattern); + } + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); + zephir_check_call_status(); + if (!(zephir_start_with_str(pattern, SL("#")))) { + if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 309)) { + ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(pcrePattern); + zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 314 TSRMLS_CC); + ZEPHIR_INIT_VAR(_0$$4); + zephir_array_fetch_long(&_1$$4, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 315 TSRMLS_CC); + zephir_fast_array_merge(_0$$4, &(routePaths), &(_1$$4) TSRMLS_CC); + ZEPHIR_CPY_WRT(routePaths, _0$$4); + } else { + ZEPHIR_CPY_WRT(pcrePattern, pattern); + } + ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(compiledPattern, pattern); + } + zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -static int vv_find_reduce_action( - vvParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->vvstack[pParser->vvidx].stateno; - - i = vv_reduce_ofst[stateno]; - if( i==VV_REDUCE_USE_DFLT ){ - return vv_default[stateno]; - } - if( iLookAhead==VVNOCODE ){ - return VV_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ - return vv_default[stateno]; - }else{ - return vv_action[i]; - } +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) { + + int _0$$4; + zval *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *_1$$9; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &paths); + + if (!paths) { + paths = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(paths) != IS_NULL) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_INIT_VAR(moduleName); + ZVAL_NULL(moduleName); + ZEPHIR_INIT_VAR(controllerName); + ZVAL_NULL(controllerName); + ZEPHIR_INIT_VAR(actionName); + ZVAL_NULL(actionName); + ZEPHIR_INIT_VAR(parts); + zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); + do { + _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); + if (_0$$4 == 3) { + ZEPHIR_OBS_NVAR(moduleName); + zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 367 TSRMLS_CC); + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 369 TSRMLS_CC); + break; + } + if (_0$$4 == 2) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 373 TSRMLS_CC); + ZEPHIR_OBS_NVAR(actionName); + zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 374 TSRMLS_CC); + break; + } + if (_0$$4 == 1) { + ZEPHIR_OBS_NVAR(controllerName); + zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 378 TSRMLS_CC); + break; + } + } while(0); + + ZEPHIR_INIT_VAR(routePaths); + array_init(routePaths); + if (Z_TYPE_P(moduleName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(controllerName) != IS_NULL) { + if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 393)) { + ZEPHIR_INIT_VAR(realClassName); + zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(namespaceName); + zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); + if (zephir_is_true(namespaceName)) { + zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(realClassName, controllerName); + } + ZEPHIR_INIT_VAR(_1$$9); + zephir_uncamelize(_1$$9, realClassName, NULL ); + zephir_array_update_string(&routePaths, SL("controller"), &_1$$9, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(actionName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(routePaths, paths); + } + } else { + ZEPHIR_INIT_NVAR(routePaths); + array_init(routePaths); + } + if (Z_TYPE_P(routePaths) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 425); + return; + } + RETURN_CCTOR(routePaths); + } -static void vv_shift( - vvParser *vvpParser, /* The parser to be shifted */ - int vvNewState, /* The new state to shift in */ - int vvMajor, /* The major token to shift in */ - VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ -){ - vvStackEntry *vvtos; - vvpParser->vvidx++; - if( vvpParser->vvidx>=VVSTACKDEPTH ){ - phvolt_ARG_FETCH; - vvpParser->vvidx--; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - vvtos = &vvpParser->vvstack[vvpParser->vvidx]; - vvtos->stateno = vvNewState; - vvtos->major = vvMajor; - vvtos->minor = *vvpMinor; -#ifndef NDEBUG - if( vvTraceFILE && vvpParser->vvidx>0 ){ - int i; - fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); - fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); - for(i=1; i<=vvpParser->vvidx; i++) - fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); - fprintf(vvTraceFILE,"\n"); - } -#endif +static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) { + + + + RETURN_MEMBER(this_ptr, "_name"); + } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} vvRuleInfo[] = { - { 86, 1 }, - { 87, 1 }, - { 88, 2 }, - { 88, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 89, 1 }, - { 91, 8 }, - { 91, 7 }, - { 91, 12 }, - { 91, 11 }, - { 91, 10 }, - { 92, 4 }, - { 93, 3 }, - { 94, 10 }, - { 94, 12 }, - { 94, 12 }, - { 94, 14 }, - { 95, 4 }, - { 111, 3 }, - { 111, 1 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 112, 3 }, - { 113, 1 }, - { 113, 4 }, - { 113, 3 }, - { 107, 10 }, - { 107, 11 }, - { 114, 3 }, - { 114, 1 }, - { 115, 1 }, - { 115, 3 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 116, 1 }, - { 109, 11 }, - { 109, 9 }, - { 108, 2 }, - { 96, 3 }, - { 97, 8 }, - { 97, 7 }, - { 98, 8 }, - { 98, 9 }, - { 118, 1 }, - { 118, 1 }, - { 104, 7 }, - { 99, 4 }, - { 100, 4 }, - { 100, 6 }, - { 101, 4 }, - { 102, 4 }, - { 103, 8 }, - { 103, 8 }, - { 105, 3 }, - { 106, 3 }, - { 90, 1 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 4 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 3 }, - { 110, 4 }, - { 110, 2 }, - { 110, 2 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 2 }, - { 110, 3 }, - { 110, 4 }, - { 110, 5 }, - { 110, 5 }, - { 110, 5 }, - { 110, 6 }, - { 120, 1 }, - { 120, 1 }, - { 119, 3 }, - { 119, 1 }, - { 121, 3 }, - { 121, 1 }, - { 110, 1 }, - { 122, 4 }, - { 122, 3 }, - { 117, 3 }, - { 117, 1 }, - { 123, 1 }, - { 123, 3 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, - { 110, 1 }, -}; +static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) { -static void vv_accept(vvParser*); /* Forward Declaration */ + zval *name_param = NULL; + zval *name = NULL; -static void vv_reduce( - vvParser *vvpParser, /* The parser */ - int vvruleno /* Number of the rule by which to reduce */ -){ - int vvgoto; /* The next state */ - int vvact; /* The next action */ - VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ - vvStackEntry *vvmsp; /* The top of the parser's stack */ - int vvsize; /* Amount to pop the stack */ - phvolt_ARG_FETCH; - vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; -#ifndef NDEBUG - if( vvTraceFILE && vvruleno>=0 - && vvruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 155 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); -} -// 1542 "parser.php7.c" - break; - case 1: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 138: -// 159 "parser.php7.lemon" -{ - vvgotominor.vv146 = vvmsp[0].minor.vv146; -} -// 1570 "parser.php7.c" - break; - case 2: -// 167 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); -} -// 1577 "parser.php7.c" - break; - case 3: - case 37: - case 49: - case 135: - case 142: -// 171 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); -} -// 1588 "parser.php7.c" - break; - case 24: -// 263 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1601 "parser.php7.c" - break; - case 25: -// 267 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(31,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1614 "parser.php7.c" - break; - case 26: -// 271 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(31,&vvmsp[-10].minor); - vv_destructor(32,&vvmsp[-8].minor); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(34,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1630 "parser.php7.c" - break; - case 27: -// 275 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(31,&vvmsp[-9].minor); - vv_destructor(32,&vvmsp[-7].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1646 "parser.php7.c" - break; - case 28: -// 279 "parser.php7.lemon" -{ - phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(31,&vvmsp[-8].minor); - vv_destructor(32,&vvmsp[-6].minor); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(34,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(33,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1662 "parser.php7.c" - break; - case 29: -// 287 "parser.php7.lemon" -{ - phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(35,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); -} -// 1672 "parser.php7.c" - break; - case 30: -// 295 "parser.php7.lemon" -{ - phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(36,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); } -// 1682 "parser.php7.c" - break; - case 31: -// 303 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(37,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_beforeMatch"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1696 "parser.php7.c" - break; - case 32: -// 307 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) { + + + + RETURN_MEMBER(this_ptr, "_beforeMatch"); + } -// 1711 "parser.php7.c" - break; - case 33: -// 311 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-11].minor); - vv_destructor(37,&vvmsp[-10].minor); - vv_destructor(2,&vvmsp[-8].minor); - vv_destructor(3,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, match) { + + zval *callback; + + zephir_fetch_params(0, 1, 0, &callback); + + + + zephir_update_property_this(this_ptr, SL("_match"), callback TSRMLS_CC); + RETURN_THISW(); + } -// 1726 "parser.php7.c" - break; - case 34: -// 315 "parser.php7.lemon" -{ - phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-13].minor); - vv_destructor(37,&vvmsp[-12].minor); - vv_destructor(2,&vvmsp[-10].minor); - vv_destructor(3,&vvmsp[-8].minor); - vv_destructor(31,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(39,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) { + + + + RETURN_MEMBER(this_ptr, "_match"); + } -// 1742 "parser.php7.c" - break; - case 35: -// 323 "parser.php7.lemon" -{ - phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(40,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { + + + + RETURN_MEMBER(this_ptr, "_id"); + } -// 1752 "parser.php7.c" - break; - case 36: - case 48: - case 134: - case 141: -// 331 "parser.php7.lemon" -{ - phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); - vv_destructor(2,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) { + + + + RETURN_MEMBER(this_ptr, "_pattern"); + } -// 1763 "parser.php7.c" - break; - case 38: -// 343 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { + + + + RETURN_MEMBER(this_ptr, "_compiledPattern"); + } -// 1771 "parser.php7.c" - break; - case 39: -// 347 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(42,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) { + + + + RETURN_MEMBER(this_ptr, "_paths"); + } -// 1779 "parser.php7.c" - break; - case 40: -// 351 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(43,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { + + HashTable *_2; + HashPosition _1; + zval *reversed = NULL, *path = NULL, *position = NULL, *_0, **_3; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(reversed); + array_init(reversed); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_paths"), PH_NOISY_CC); + zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/router/route.zep", 566); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HMKEY(path, _2, _1); + ZEPHIR_GET_HVALUE(position, _3); + zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); + } + RETURN_CCTOR(reversed); + } -// 1787 "parser.php7.c" - break; - case 41: -// 355 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(44,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { + + zval *httpMethods; + + zephir_fetch_params(0, 1, 0, &httpMethods); + + + + zephir_update_property_this(this_ptr, SL("_methods"), httpMethods TSRMLS_CC); + RETURN_THISW(); + } -// 1795 "parser.php7.c" - break; - case 42: -// 359 "parser.php7.lemon" -{ - phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(45,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) { + + + + RETURN_MEMBER(this_ptr, "_methods"); + } -// 1803 "parser.php7.c" - break; - case 43: - case 67: - case 133: - case 145: -// 363 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) { + + zval *hostname_param = NULL; + zval *hostname = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + + if (unlikely(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(hostname_param) == IS_STRING)) { + zephir_get_strval(hostname, hostname_param); + } else { + ZEPHIR_INIT_VAR(hostname); + ZVAL_EMPTY_STRING(hostname); + } + + + zephir_update_property_this(this_ptr, SL("_hostname"), hostname TSRMLS_CC); + RETURN_THIS(); + } -// 1813 "parser.php7.c" - break; - case 44: - case 127: -// 367 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) { + + + + RETURN_MEMBER(this_ptr, "_hostname"); + } -// 1823 "parser.php7.c" - break; - case 45: - case 116: -// 371 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(30,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { + + zval *group; + + zephir_fetch_params(0, 1, 0, &group); + + + + zephir_update_property_this(this_ptr, SL("_group"), group TSRMLS_CC); + RETURN_THISW(); + } -// 1832 "parser.php7.c" - break; - case 46: -// 379 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-9].minor); - vv_destructor(47,&vvmsp[-8].minor); - vv_destructor(29,&vvmsp[-6].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) { + + + + RETURN_MEMBER(this_ptr, "_group"); + } -// 1847 "parser.php7.c" - break; - case 47: -// 383 "parser.php7.lemon" -{ - phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(47,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(49,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { + + zval *name_param = NULL, *converter; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &converter); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); + RETURN_THIS(); + } -// 1862 "parser.php7.c" - break; - case 50: -// 403 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { + + + + RETURN_MEMBER(this_ptr, "_converters"); + } -// 1869 "parser.php7.c" - break; - case 51: -// 407 "parser.php7.lemon" -{ - phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(41,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { + + + + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, SL("_uniqueId"), &ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + } -// 1877 "parser.php7.c" - break; - case 52: - case 66: - case 132: - case 146: -// 411 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); + + return SUCCESS; + } -// 1887 "parser.php7.c" - break; - case 53: - case 147: -// 415 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 1895 "parser.php7.c" - break; - case 54: - case 148: -// 419 "parser.php7.lemon" + + + + + +#ifdef HAVE_CONFIG_H +#endif + + + +#if PHP_VERSION_ID < 70000 +#else +#endif + + +static void phalcon_get_uri(zval *return_value, zval *path) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); + int i, found = 0, mark = 0; + char *cursor, *str, ch; + + if (Z_TYPE_P(path) != IS_STRING) { + RETURN_EMPTY_STRING(); + } + + if (Z_STRLEN_P(path) > 0) { + cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; + for (i = Z_STRLEN_P(path); i > 0; i--) { + ch = *cursor; + if (ch == '/' || ch == '\\') { + found++; + if (found == 1) { + mark = i - 1; + } else { + str = emalloc(mark - i + 1); + memcpy(str, Z_STRVAL_P(path) + i, mark - i); + str[mark - i] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, str, mark - i, 0); +#else + ZVAL_STRINGL(return_value, str, mark - i); +#endif + return; + } + } + cursor--; + } + } + + RETURN_EMPTY_STRING(); } -// 1903 "parser.php7.c" - break; - case 55: - case 149: -// 423 "parser.php7.lemon" + +zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); - vv_destructor(53,&vvmsp[0].minor); + unsigned int length = 0, variable_length, ch, j; + char *item = NULL, *cursor_var, *variable = NULL; + int not_valid = 0; +#if PHP_VERSION_ID < 70000 + int result = FAILURE; + zval **zv, **tmp; +#else + zval *zv, *tmp; +#endif + + if (named) { + length = cursor - marker - 1; + item = estrndup(marker + 1, length); + cursor_var = item; + marker = item; + for (j = 0; j < length; j++) { + ch = *cursor_var; + if (ch == '\0') { + not_valid = 1; + break; + } + if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ + not_valid = 1; + break; + } + if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { + if (ch == ':') { + variable_length = cursor_var - marker; + variable = estrndup(marker, variable_length); + break; + } + } else { + not_valid = 1; + break; + } + cursor_var++; + } + } + + if (!not_valid) { + + if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { + if (named) { + if (variable) { + efree(item); + item = variable; + length = variable_length; + } +#if PHP_VERSION_ID < 70000 + if (zend_hash_exists(Z_ARRVAL_P(replacements), item, length + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), item, length + 1, (void**) &zv)) == SUCCESS) { + efree(item); + (*position)++; + return *zv; + } + } +#else + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { + if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { + efree(item); + (*position)++; + return zv; + } + } +#endif + } else { +#if PHP_VERSION_ID < 70000 + if ((result = zend_hash_index_find(Z_ARRVAL_P(paths), *position, (void**) &zv)) == SUCCESS) { + if (Z_TYPE_PP(zv) == IS_STRING) { + if (zend_hash_exists(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1)) { + if ((result = zend_hash_find(Z_ARRVAL_P(replacements), Z_STRVAL_PP(zv), Z_STRLEN_PP(zv) + 1, (void**) &tmp)) == SUCCESS) { + (*position)++; + return *tmp; + } + } + } + } +#else + if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { + if (Z_TYPE_P(zv) == IS_STRING) { + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { + (*position)++; + return tmp; + } + } + } + } +#endif + } + } + + (*position)++; + } + + if (item) { + efree(item); + } + + return NULL; } -// 1912 "parser.php7.c" - break; - case 56: - case 150: -// 427 "parser.php7.lemon" + +static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements TSRMLS_DC) { - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); - vv_destructor(54,&vvmsp[0].minor); + + char *cursor, *marker = NULL; + unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; + unsigned char ch; + smart_str route_str = {0}; + ulong position = 1; + int i; + zval *replace, replace_copy; + int use_copy, looking_placeholder = 0; + + if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { + ZVAL_NULL(return_value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); + return; + } + + if (Z_STRLEN_P(pattern) <= 0) { + ZVAL_FALSE(return_value); + return; + } + + cursor = Z_STRVAL_P(pattern); + if (*cursor == '/') { + ++cursor; + i = 1; + } + else { + i = 0; + } + + if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { +#if PHP_VERSION_ID < 70000 + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i, 1); +#else + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); +#endif + return; + } + + for (; i < Z_STRLEN_P(pattern); ++i) { + + ch = *cursor; + if (ch == '\0') { + break; + } + + if (parentheses_count == 0 && !looking_placeholder) { + if (ch == '{') { + if (bracket_count == 0) { + marker = cursor; + intermediate = 0; + } + bracket_count++; + } else { + if (ch == '}') { + bracket_count--; + if (intermediate > 0) { + if (bracket_count == 0) { + replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && !looking_placeholder) { + if (ch == '(') { + if (parentheses_count == 0) { + marker = cursor; + intermediate = 0; + } + parentheses_count++; + } else { + if (ch == ')') { + parentheses_count--; + if (intermediate > 0) { + if (parentheses_count == 0) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + + if (bracket_count == 0 && parentheses_count == 0) { + if (looking_placeholder) { + if (intermediate > 0) { + if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { +#if PHP_VERSION_ID < 70000 + zend_make_printable_zval(replace, &replace_copy, &use_copy); +#else + use_copy = zend_make_printable_zval(replace, &replace_copy); +#endif + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + looking_placeholder = 0; + continue; + } + } + } else { + if (ch == ':') { + looking_placeholder = 1; + marker = cursor; + intermediate = 0; + } + } + } + + if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { + intermediate++; + } else { + smart_str_appendc(&route_str, ch); + } + + cursor++; + } + smart_str_0(&route_str); + +#if PHP_VERSION_ID < 70000 + if (route_str.len) { + RETURN_STRINGL(route_str.c, route_str.len, 0); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#else + if (route_str.s) { + RETURN_STR(route_str.s); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } +#endif } -// 1921 "parser.php7.c" - break; - case 57: - case 151: -// 431 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); - vv_destructor(55,&vvmsp[0].minor); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Component) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Component, phalcon, mvc_user_component, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1930 "parser.php7.c" - break; - case 58: -// 439 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-10].minor); - vv_destructor(56,&vvmsp[-9].minor); - vv_destructor(29,&vvmsp[-7].minor); - vv_destructor(48,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Module) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Module, phalcon, mvc_user_module, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1945 "parser.php7.c" - break; - case 59: -// 443 "parser.php7.lemon" -{ - phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(56,&vvmsp[-7].minor); - vv_destructor(29,&vvmsp[-5].minor); - vv_destructor(48,&vvmsp[-4].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(57,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_User_Plugin) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\User, Plugin, phalcon, mvc_user_plugin, phalcon_di_injectable_ce, NULL, 0); + + return SUCCESS; + } -// 1960 "parser.php7.c" - break; - case 60: -// 451 "parser.php7.lemon" -{ - phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Engine, phalcon, mvc_view_engine, phalcon_di_injectable_ce, phalcon_mvc_view_engine_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_mvc_view_engine_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_ce TSRMLS_CC, 1, phalcon_mvc_view_engineinterface_ce); + return SUCCESS; + } -// 1969 "parser.php7.c" - break; - case 61: -// 459 "parser.php7.lemon" -{ - phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(58,&vvmsp[-2].minor); - vv_destructor(59,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, __construct) { + + zval *view, *dependencyInjector = NULL; + + zephir_fetch_params(0, 1, 1, &view, &dependencyInjector); + + if (!dependencyInjector) { + dependencyInjector = ZEPHIR_GLOBAL(global_null); + } + + + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 1978 "parser.php7.c" - break; - case 62: -// 467 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(60,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { + + zval *_0; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "getcontent", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } -// 1991 "parser.php7.c" - break; - case 63: -// 471 "parser.php7.lemon" -{ - phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(60,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-3].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(61,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *_0; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_RETURN_CALL_METHOD(_0, "partial", NULL, 0, partialPath, params); + zephir_check_call_status(); + RETURN_MM(); + } -// 2004 "parser.php7.c" - break; - case 64: -// 479 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(62,&vvmsp[-6].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine, getView) { + + + + RETURN_MEMBER(this_ptr, "_view"); + } -// 2017 "parser.php7.c" - break; - case 65: -// 483 "parser.php7.lemon" -{ - phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-8].minor); - vv_destructor(62,&vvmsp[-7].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(63,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_EngineInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\View, EngineInterface, phalcon, mvc_view_engineinterface, phalcon_mvc_view_engineinterface_method_entry); + + return SUCCESS; + } -// 2030 "parser.php7.c" - break; - case 68: -// 503 "parser.php7.lemon" -{ - phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-6].minor); - vv_destructor(64,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(65,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, getContent); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, partial); + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_View_EngineInterface, render); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Exception, phalcon, mvc_view_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; + } -// 2043 "parser.php7.c" - break; - case 69: -// 511 "parser.php7.lemon" -{ - phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(66,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Simple) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View, Simple, phalcon, mvc_view_simple, phalcon_di_injectable_ce, phalcon_mvc_view_simple_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_partialsDir"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_viewParams"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_engines"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_registeredEngines"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_activeRenderPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_content"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_simple_ce, SL("_cache"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_simple_ce, SL("_cacheOptions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_simple_ce TSRMLS_CC, 1, phalcon_mvc_viewbaseinterface_ce); + return SUCCESS; + } -// 2053 "parser.php7.c" - break; - case 70: -// 519 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(67,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getRegisteredEngines) { + + + + RETURN_MEMBER(this_ptr, "_registeredEngines"); + } -// 2063 "parser.php7.c" - break; - case 71: -// 523 "parser.php7.lemon" -{ - phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-5].minor); - vv_destructor(67,&vvmsp[-4].minor); - vv_destructor(68,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __construct) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &options_param); + + if (!options_param) { + ZEPHIR_INIT_VAR(options); + array_init(options); + } else { + zephir_get_arrval(options, options_param); + } + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2074 "parser.php7.c" - break; - case 72: -// 531 "parser.php7.lemon" -{ - phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(69,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) { + + zval *viewsDir_param = NULL; + zval *viewsDir = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewsDir_param); + + if (unlikely(Z_TYPE_P(viewsDir_param) != IS_STRING && Z_TYPE_P(viewsDir_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewsDir' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewsDir_param) == IS_STRING)) { + zephir_get_strval(viewsDir, viewsDir_param); + } else { + ZEPHIR_INIT_VAR(viewsDir); + ZVAL_EMPTY_STRING(viewsDir); + } + + + zephir_update_property_this(this_ptr, SL("_viewsDir"), viewsDir TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2084 "parser.php7.c" - break; - case 73: -// 539 "parser.php7.lemon" -{ - phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-3].minor); - vv_destructor(70,&vvmsp[-2].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getViewsDir) { + + + + RETURN_MEMBER(this_ptr, "_viewsDir"); + } -// 2094 "parser.php7.c" - break; - case 74: -// 547 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(54,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, registerEngines) { + + zval *engines_param = NULL; + zval *engines = NULL; + + zephir_fetch_params(0, 1, 0, &engines_param); + + engines = engines_param; + + + zephir_update_property_this(this_ptr, SL("_registeredEngines"), engines TSRMLS_CC); + } -// 2108 "parser.php7.c" - break; - case 75: -// 551 "parser.php7.lemon" -{ - phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-7].minor); - vv_destructor(71,&vvmsp[-6].minor); - vv_destructor(55,&vvmsp[-5].minor); - vv_destructor(32,&vvmsp[-4].minor); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(72,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { + + HashTable *_2$$5; + HashPosition _1$$5; + zval *engines = NULL, *dependencyInjector = NULL, *registeredEngines = NULL, *arguments = NULL, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0$$4, **_3$$5, *_5$$13 = NULL, *_6$$13 = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_INIT_NVAR(engines); + array_init(engines); + ZEPHIR_OBS_VAR(registeredEngines); + zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); + if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_php_ce); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 351, this_ptr, dependencyInjector); + zephir_check_call_status(); + zephir_array_update_string(&engines, SL(".phtml"), &_0$$4, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 159); + return; + } + ZEPHIR_INIT_VAR(arguments); + zephir_create_array(arguments, 2, 0 TSRMLS_CC); + zephir_array_fast_append(arguments, this_ptr); + zephir_array_fast_append(arguments, dependencyInjector); + zephir_is_iterable(registeredEngines, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/view/simple.zep", 191); + for ( + ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) + ) { + ZEPHIR_GET_HMKEY(extension, _2$$5, _1$$5); + ZEPHIR_GET_HVALUE(engineService, _3$$5); + if (Z_TYPE_P(engineService) == IS_OBJECT) { + if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_NVAR(engineObject); + ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(engineObject, engineService); + } + } else { + if (Z_TYPE_P(engineService) == IS_STRING) { + ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_5$$13); + object_init_ex(_5$$13, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_LNVAR(_6$$13); + ZEPHIR_CONCAT_SV(_6$$13, "Invalid template engine registration for extension: ", extension); + ZEPHIR_CALL_METHOD(NULL, _5$$13, "__construct", &_7, 9, _6$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(_5$$13, "phalcon/mvc/view/simple.zep", 185 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); + } + } + zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); + } else { + ZEPHIR_OBS_NVAR(engines); + zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); + } + RETURN_CCTOR(engines); + } -// 2122 "parser.php7.c" - break; - case 76: -// 559 "parser.php7.lemon" -{ - phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(73,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { + + HashTable *_4; + HashPosition _3; + zend_bool notExists = 0, mustClean = 0, _7$$8, _10$$8; + zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params, *eventsManager = NULL, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath = NULL, *_2, **_5, *_0$$4 = NULL, *_1$$4, *_6$$6 = NULL, _8$$8 = zval_used_for_init, *_9$$8 = NULL, *_11$$12 = NULL, *_12$$12 = NULL, *_14$$11 = NULL, *_15$$14 = NULL, *_17$$15, *_18$$15, *_19$$16; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + + + ZEPHIR_OBS_VAR(eventsManager); + zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_STRING(_1$$4, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_0$$4, eventsManager, "fire", NULL, 0, _1$$4, this_ptr); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$4)) { + RETURN_MM_NULL(); + } + } + notExists = 1; + mustClean = 1; + _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(viewsDirPath); + ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); + ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 282); + for ( + ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS + ; zephir_hash_move_forward_ex(_4, &_3) + ) { + ZEPHIR_GET_HMKEY(extension, _4, _3); + ZEPHIR_GET_HVALUE(engine, _5); + ZEPHIR_INIT_LNVAR(_6$$6); + ZEPHIR_CONCAT_VV(_6$$6, viewsDirPath, extension); + if ((zephir_file_exists(_6$$6 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); + } else { + _7$$8 = zephir_is_true(extension); + if (_7$$8) { + ZEPHIR_SINIT_NVAR(_8$$8); + ZVAL_LONG(&_8$$8, -zephir_fast_strlen_ev(extension)); + ZEPHIR_INIT_NVAR(_9$$8); + zephir_substr(_9$$8, viewsDirPath, zephir_get_intval(&_8$$8), 0, ZEPHIR_SUBSTR_NO_LENGTH); + _7$$8 = ZEPHIR_IS_EQUAL(_9$$8, extension); + } + _10$$8 = _7$$8; + if (_10$$8) { + _10$$8 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); + } + if (_10$$8) { + ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); + } else { + ZEPHIR_INIT_NVAR(viewEnginePath); + ZVAL_STRING(viewEnginePath, "", 1); + } + } + if (zephir_is_true(viewEnginePath)) { + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_12$$12); + ZVAL_STRING(_12$$12, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&_11$$12, eventsManager, "fire", &_13, 0, _12$$12, this_ptr, viewEnginePath); + zephir_check_temp_parameter(_12$$12); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_11$$12)) { + continue; + } + } + ZEPHIR_INIT_NVAR(_14$$11); + if (mustClean) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, _14$$11); + zephir_check_call_status(); + notExists = 0; + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(_15$$14); + ZVAL_STRING(_15$$14, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_16, 0, _15$$14, this_ptr); + zephir_check_temp_parameter(_15$$14); + zephir_check_call_status(); + } + break; + } + } + if (notExists == 1) { + ZEPHIR_INIT_VAR(_17$$15); + object_init_ex(_17$$15, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_18$$15); + ZEPHIR_CONCAT_SVS(_18$$15, "View '", viewsDirPath, "' was not found in the views directory"); + ZEPHIR_CALL_METHOD(NULL, _17$$15, "__construct", NULL, 9, _18$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(_17$$15, "phalcon/mvc/view/simple.zep", 283 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(_19$$16); + ZVAL_STRING(_19$$16, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _19$$16, this_ptr); + zephir_check_temp_parameter(_19$$16); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2132 "parser.php7.c" - break; - case 77: -// 567 "parser.php7.lemon" -{ - phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); - vv_destructor(1,&vvmsp[-2].minor); - vv_destructor(74,&vvmsp[-1].minor); - vv_destructor(32,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, render) { + + zend_bool _3$$12; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &path_param, ¶ms); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) { + ZEPHIR_INIT_VAR(key); + ZVAL_NULL(key); + ZEPHIR_INIT_VAR(lifetime); + ZVAL_NULL(lifetime); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(key); + zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC); + } + if (Z_TYPE_P(key) == IS_NULL) { + ZEPHIR_INIT_NVAR(key); + zephir_md5(key, path); + } + ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime); + zephir_check_call_status(); + if (Z_TYPE_P(content) != IS_NULL) { + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_CCTOR(content); + } + } + } + ZEPHIR_INIT_VAR(_1); + zephir_create_symbol_table(TSRMLS_C); + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(params) == IS_ARRAY) { + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + } else { + ZEPHIR_CPY_WRT(mergedParams, viewParams); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, path, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(cache) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_2$$12); + if (_3$$12) { + ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0); + zephir_check_call_status(); + _3$$12 = zephir_is_true(_4$$12); + } + if (_3$$12) { + ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + RETURN_MM_MEMBER(this_ptr, "_content"); + +} + +static PHP_METHOD(Phalcon_Mvc_View_Simple, partial) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3; + zval *partialPath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + + if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(partialPath); + ZVAL_EMPTY_STRING(partialPath); + } + if (!params) { + params = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 129); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + ZEPHIR_OBS_VAR(viewParams); + zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (Z_TYPE_P(viewParams) == IS_ARRAY) { + ZEPHIR_INIT_VAR(mergedParams); + zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_INIT_VAR(_0$$3); + zephir_create_symbol_table(TSRMLS_C); + + } else { + ZEPHIR_CPY_WRT(mergedParams, params); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 371, partialPath, mergedParams); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC); + } + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 131); + zephir_check_call_status(); + _1 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC); + zend_print_zval(_1, 0); + ZEPHIR_MM_RESTORE(); + } -// 2142 "parser.php7.c" - break; - case 78: -// 575 "parser.php7.lemon" -{ - phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setCacheOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &options_param); + + zephir_get_arrval(options, options_param); + + + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + RETURN_THIS(); + } -// 2149 "parser.php7.c" - break; - case 79: -// 583 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCacheOptions) { + + + + RETURN_MEMBER(this_ptr, "_cacheOptions"); + } -// 2157 "parser.php7.c" - break; - case 80: -// 587 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, _createCache) { + + zval *dependencyInjector = NULL, *cacheService = NULL, *cacheOptions = NULL, *viewCache = NULL, *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the view cache services", "phalcon/mvc/view/simple.zep", 493); + return; + } + ZEPHIR_INIT_VAR(cacheService); + ZVAL_STRING(cacheService, "viewCache", 1); + ZEPHIR_OBS_VAR(cacheOptions); + zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC); + if (Z_TYPE_P(cacheOptions) == IS_ARRAY) { + if (zephir_array_isset_string(cacheOptions, SS("service"))) { + ZEPHIR_OBS_NVAR(cacheService); + zephir_array_isset_string_fetch(&cacheService, cacheOptions, SS("service"), 0 TSRMLS_CC); + } + } + ZEPHIR_CALL_METHOD(&_0, dependencyInjector, "getshared", NULL, 0, cacheService); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(viewCache, _0); + if (Z_TYPE_P(viewCache) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "The injected caching service is invalid", "phalcon/mvc/view/simple.zep", 510); + return; + } + RETURN_CCTOR(viewCache); + } -// 2165 "parser.php7.c" - break; - case 81: -// 591 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(22,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getCache) { + + zend_bool _1; + zval *_0, *_2, *_3$$3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = zephir_is_true(_0); + if (_1) { + ZEPHIR_OBS_VAR(_2); + zephir_read_property_this(&_2, this_ptr, SL("_cache"), PH_NOISY_CC); + _1 = Z_TYPE_P(_2) != IS_OBJECT; + } + if (_1) { + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "_createcache", NULL, 0); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_cache"), _3$$3 TSRMLS_CC); + } + RETURN_MM_MEMBER(this_ptr, "_cache"); + } -// 2173 "parser.php7.c" - break; - case 82: -// 595 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(21,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, cache) { + + zval *options = NULL; + + zephir_fetch_params(0, 0, 1, &options); + + if (!options) { + options = ZEPHIR_GLOBAL(global_true); + } + + + if (Z_TYPE_P(options) == IS_ARRAY) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_cacheOptions"), options TSRMLS_CC); + } else { + if (zephir_is_true(options)) { + if (1) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } else { + if (0) { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_cache"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + } + } + RETURN_THISW(); + } -// 2181 "parser.php7.c" - break; - case 83: -// 599 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setParamToView) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2189 "parser.php7.c" - break; - case 84: -// 603 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(19,&vvmsp[-2].minor); - vv_destructor(19,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) { + + zend_bool merge, _0; + zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3; + zval *params = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); + + params = params_param; + if (!merge_param) { + merge = 1; + } else { + merge = zephir_get_boolval(merge_param); + } + + + _0 = merge; + if (_0) { + ZEPHIR_OBS_VAR(_1); + zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC); + _0 = Z_TYPE_P(_1) == IS_ARRAY; + } + if (_0) { + ZEPHIR_INIT_VAR(_2$$3); + _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_viewParams"), _2$$3 TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC); + } + RETURN_THIS(); + } -// 2198 "parser.php7.c" - break; - case 85: -// 607 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setVar) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + RETURN_THIS(); + } -// 2206 "parser.php7.c" - break; - case 86: -// 611 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(18,&vvmsp[-2].minor); - vv_destructor(18,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getVar) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2215 "parser.php7.c" - break; - case 87: -// 615 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(20,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getParamsToView) { + + + + RETURN_MEMBER(this_ptr, "_viewParams"); + } -// 2223 "parser.php7.c" - break; - case 88: -// 619 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(7,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, setContent) { + + zval *content_param = NULL; + zval *content = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &content_param); + + if (unlikely(Z_TYPE_P(content_param) != IS_STRING && Z_TYPE_P(content_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'content' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(content_param) == IS_STRING)) { + zephir_get_strval(content, content_param); + } else { + ZEPHIR_INIT_VAR(content); + ZVAL_EMPTY_STRING(content); + } + + + zephir_update_property_this(this_ptr, SL("_content"), content TSRMLS_CC); + RETURN_THIS(); + } -// 2231 "parser.php7.c" - break; - case 89: -// 623 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(8,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getContent) { + + + + RETURN_MEMBER(this_ptr, "_content"); + } -// 2239 "parser.php7.c" - break; - case 90: -// 627 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(23,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, getActiveRenderPath) { + + + + RETURN_MEMBER(this_ptr, "_activeRenderPath"); + } -// 2247 "parser.php7.c" - break; - case 91: -// 631 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(25,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __set) { + + zval *key_param = NULL, *value; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + zephir_update_property_array(this_ptr, SL("_viewParams"), key, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2255 "parser.php7.c" - break; - case 92: -// 635 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(6,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Simple, __get) { + + zval *key_param = NULL, *value = NULL, *_0; + zval *key = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + + if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(key, key_param); + } else { + ZEPHIR_INIT_VAR(key); + ZVAL_EMPTY_STRING(key); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, key, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2263 "parser.php7.c" - break; - case 93: -// 639 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(10,&vvmsp[-1].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Php) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Php, phalcon, mvc_view_engine_php, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_php_method_entry, 0); + + return SUCCESS; + } -// 2271 "parser.php7.c" - break; - case 94: -// 643 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *path_param = NULL, *params, *mustClean_param = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *path = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean == 1) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/php.zep", 50); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean == 1) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2280 "parser.php7.c" - break; - case 95: -// 647 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(76,&vvmsp[0].minor); + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine, Volt, phalcon, mvc_view_engine_volt, phalcon_mvc_view_engine_ce, phalcon_mvc_view_engine_volt_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_compiler"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + return SUCCESS; + } -// 2289 "parser.php7.c" - break; - case 96: -// 651 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2298 "parser.php7.c" - break; - case 97: -// 655 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(77,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2307 "parser.php7.c" - break; - case 98: -// 659 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, getCompiler) { + + zval *compiler = NULL, *dependencyInjector = NULL, *options = NULL, *_0$$3, *_1$$3; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(compiler); + zephir_read_property_this(&compiler, this_ptr, SL("_compiler"), PH_NOISY_CC); + if (Z_TYPE_P(compiler) != IS_OBJECT) { + ZEPHIR_INIT_NVAR(compiler); + object_init_ex(compiler, phalcon_mvc_view_engine_volt_compiler_ce); + _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(NULL, compiler, "__construct", NULL, 354, _0$$3); + zephir_check_call_status(); + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(dependencyInjector, _1$$3); + if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setdi", NULL, 355, dependencyInjector); + zephir_check_call_status(); + } + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, compiler, "setoptions", NULL, 356, options); + zephir_check_call_status(); + } + zephir_update_property_this(this_ptr, SL("_compiler"), compiler TSRMLS_CC); + } + RETURN_CCTOR(compiler); + } -// 2316 "parser.php7.c" - break; - case 99: -// 663 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(78,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, render) { + + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool mustClean; + zval *templatePath_param = NULL, *params, *mustClean_param = NULL, *compiler = NULL, *compiledTemplatePath = NULL, *key = NULL, *value = NULL, **_2$$4, *_3$$5 = NULL, *_4$$6, *_5$$6 = NULL; + zval *templatePath = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &templatePath_param, ¶ms, &mustClean_param); + + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!mustClean_param) { + mustClean = 0; + } else { + mustClean = zephir_get_boolval(mustClean_param); + } + + + if (mustClean) { + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 353); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&compiler, this_ptr, "getcompiler", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, compiler, "compile", NULL, 0, templatePath); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&compiledTemplatePath, compiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_is_iterable(params, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt.zep", 116); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); + ZEPHIR_GET_HVALUE(value, _2$$4); + ZEPHIR_CPY_WRT(_3$$5, value); + if (zephir_set_symbol(key, _3$$5 TSRMLS_CC) == FAILURE) { + return; + } + } + } + if (zephir_require_zval(compiledTemplatePath TSRMLS_CC) == FAILURE) { + RETURN_MM_NULL(); + } + if (mustClean) { + _4$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_view"), PH_NOISY_CC); + ZEPHIR_CALL_FUNCTION(&_5$$6, "ob_get_contents", NULL, 130); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, _4$$6, "setcontent", NULL, 0, _5$$6); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + } -// 2325 "parser.php7.c" - break; - case 100: -// 667 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { + + zend_bool _0; + int ZEPHIR_LAST_CALL_STATUS; + zval *item; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &item); + + + + _0 = Z_TYPE_P(item) == IS_OBJECT; + if (!(_0)) { + _0 = Z_TYPE_P(item) == IS_ARRAY; + } + if (_0) { + RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); + } + if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 347, item); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_MM_LONG(zephir_fast_strlen_ev(item)); + } -// 2334 "parser.php7.c" - break; - case 101: -// 671 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(79,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *needle, *haystack, *_0$$5 = NULL, *_1$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &needle, &haystack); + + + + if (Z_TYPE_P(haystack) == IS_ARRAY) { + RETURN_MM_BOOL(zephir_fast_in_array(needle, haystack TSRMLS_CC)); + } + if (Z_TYPE_P(haystack) == IS_STRING) { + if ((zephir_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_FUNCTION(&_0$$5, "mb_strpos", NULL, 357, haystack, needle); + zephir_check_call_status(); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_0$$5)); + } + ZEPHIR_INIT_VAR(_1$$4); + zephir_fast_strpos(_1$$4, haystack, needle, 0 ); + RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Invalid haystack", "phalcon/mvc/view/engine/volt.zep", 158); + return; + } -// 2343 "parser.php7.c" - break; - case 102: -// 675 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) { + + zend_bool _0, _1; + int ZEPHIR_LAST_CALL_STATUS; + zval *text_param = NULL, *from_param = NULL, *to_param = NULL; + zval *text = NULL, *from = NULL, *to = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param); + + zephir_get_strval(text, text_param); + if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(from_param) == IS_STRING)) { + zephir_get_strval(from, from_param); + } else { + ZEPHIR_INIT_VAR(from); + ZVAL_EMPTY_STRING(from); + } + if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(to_param) == IS_STRING)) { + zephir_get_strval(to, to_param); + } else { + ZEPHIR_INIT_VAR(to); + ZVAL_EMPTY_STRING(to); + } + + + _0 = ZEPHIR_IS_STRING(from, "latin1"); + if (!(_0)) { + _0 = ZEPHIR_IS_STRING(to, "utf8"); + } + if (_0) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 358, text); + zephir_check_call_status(); + RETURN_MM(); + } + _1 = ZEPHIR_IS_STRING(to, "latin1"); + if (!(_1)) { + _1 = ZEPHIR_IS_STRING(from, "utf8"); + } + if (_1) { + ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 359, text); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 190, text, from, to); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 360, from, to, text); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 197); + return; + } -// 2352 "parser.php7.c" - break; - case 103: -// 679 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(80,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { + + zend_bool _1$$5; + zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; + int start, ZEPHIR_LAST_CALL_STATUS, position = 0; + zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &value, &start_param, &end); + + if (!start_param) { + start = 0; + } else { + start = zephir_get_intval(start_param); + } + if (!end) { + ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); + } else { + ZEPHIR_SEPARATE_PARAM(end); + } + + + if (Z_TYPE_P(value) == IS_OBJECT) { + if (Z_TYPE_P(end) == IS_NULL) { + ZEPHIR_INIT_NVAR(end); + ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); + } + position = 0; + ZEPHIR_INIT_VAR(slice); + array_init(slice); + ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(_0$$3))) { + break; + } + _1$$5 = position >= start; + if (_1$$5) { + _1$$5 = ZEPHIR_GE_LONG(end, position); + } + if (_1$$5) { + ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); + zephir_check_call_status(); + zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); + } + ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); + zephir_check_call_status(); + position++; + } + RETURN_CCTOR(slice); + } + ZEPHIR_INIT_VAR(length); + if (Z_TYPE_P(end) != IS_NULL) { + ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); + } else { + ZVAL_NULL(length); + } + if (Z_TYPE_P(value) == IS_ARRAY) { + ZEPHIR_SINIT_VAR(_5$$9); + ZVAL_LONG(&_5$$9, start); + ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 361, value, &_5$$9, length); + zephir_check_call_status(); + RETURN_MM(); + } + if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_6$$11); + ZVAL_LONG(&_6$$11, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_6$$11, length); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_8$$10); + ZVAL_LONG(&_8$$10, start); + ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 362, value, &_8$$10); + zephir_check_call_status(); + RETURN_MM(); + } + if (Z_TYPE_P(length) != IS_NULL) { + ZEPHIR_SINIT_VAR(_9$$12); + ZVAL_LONG(&_9$$12, start); + zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); + RETURN_MM(); + } + ZEPHIR_SINIT_VAR(_10); + ZVAL_LONG(&_10, start); + zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); + RETURN_MM(); + } -// 2361 "parser.php7.c" - break; - case 104: -// 683 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *value_param = NULL; + zval *value = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &value_param); + + zephir_get_arrval(value, value_param); + + + ZEPHIR_MAKE_REF(value); + ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 363, value); + ZEPHIR_UNREF(value); + zephir_check_call_status(); + RETURN_CTOR(value); + } -// 2370 "parser.php7.c" - break; - case 105: -// 687 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(81,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, callMacro) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *arguments = NULL; + zval *name_param = NULL, *arguments_param = NULL, *macro = NULL, *_0, *_1$$3; + zval *name = NULL, *_2$$3; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments_param); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments_param) { + ZEPHIR_INIT_VAR(arguments); + array_init(arguments); + } else { + zephir_get_arrval(arguments, arguments_param); + } + + + ZEPHIR_OBS_VAR(macro); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (!(zephir_array_isset_fetch(¯o, _0, name, 0 TSRMLS_CC))) { + ZEPHIR_INIT_VAR(_1$$3); + object_init_ex(_1$$3, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(_2$$3); + ZEPHIR_CONCAT_SVS(_2$$3, "Macro '", name, "' does not exist"); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$3, "phalcon/mvc/view/engine/volt.zep", 287 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 364, macro, arguments); + zephir_check_call_status(); + RETURN_MM(); + +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Compiler) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\View\\Engine\\Volt, Compiler, phalcon, mvc_view_engine_volt_compiler, phalcon_mvc_view_engine_volt_compiler_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_dependencyInjector"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_view"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_arrayHelpers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_level"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_foreachLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blockLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_long(phalcon_mvc_view_engine_volt_compiler_ce, SL("_exprLevel"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extended"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_bool(phalcon_mvc_view_engine_volt_compiler_ce, SL("_autoescape"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extendedBlocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentBlock"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_blocks"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_forElsePointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_loopPointers"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_extensions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_functions"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_filters"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_macros"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_prefix"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_currentPath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(phalcon_mvc_view_engine_volt_compiler_ce, SL("_compiledTemplatePath"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(phalcon_mvc_view_engine_volt_compiler_ce TSRMLS_CC, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -// 2379 "parser.php7.c" - break; - case 106: -// 691 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, __construct) { + + zval *view = NULL; + + zephir_fetch_params(0, 0, 1, &view); + + if (!view) { + view = ZEPHIR_GLOBAL(global_null); + } + + + if (Z_TYPE_P(view) == IS_OBJECT) { + zephir_update_property_this(this_ptr, SL("_view"), view TSRMLS_CC); + } + } -// 2388 "parser.php7.c" - break; - case 107: -// 695 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); - vv_destructor(82,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setDI) { + + zval *dependencyInjector; + + zephir_fetch_params(0, 1, 0, &dependencyInjector); + + + + zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC); + } -// 2397 "parser.php7.c" - break; - case 108: -// 699 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(9,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getDI) { + + + + RETURN_MEMBER(this_ptr, "_dependencyInjector"); + } -// 2405 "parser.php7.c" - break; - case 109: -// 703 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(11,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOptions) { + + zval *options_param = NULL; + zval *options = NULL; + + zephir_fetch_params(0, 1, 0, &options_param); + + options = options_param; + + + zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); + } -// 2413 "parser.php7.c" - break; - case 110: -// 707 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(16,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setOption) { + + zval *option_param = NULL, *value; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &option_param, &value); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + zephir_update_property_array(this_ptr, SL("_options"), option, value TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + } -// 2421 "parser.php7.c" - break; - case 111: -// 711 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(17,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOption) { + + zval *option_param = NULL, *value = NULL, *_0; + zval *option = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &option_param); + + if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(option_param) == IS_STRING)) { + zephir_get_strval(option, option_param); + } else { + ZEPHIR_INIT_VAR(option); + ZVAL_EMPTY_STRING(option); + } + + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&value, _0, option, 1 TSRMLS_CC)) { + RETURN_CTOR(value); + } + RETURN_MM_NULL(); + } -// 2429 "parser.php7.c" - break; - case 112: -// 715 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(12,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getOptions) { + + + + RETURN_MEMBER(this_ptr, "_options"); + } -// 2437 "parser.php7.c" - break; - case 113: -// 719 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(13,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, fireExtensionEvent) { + + zval *_3$$6 = NULL, *_4$$7 = NULL; + HashTable *_1$$3; + HashPosition _0$$3; + int ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *arguments = NULL, *extensions = NULL, *extension = NULL, *status = NULL, **_2$$3; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &name_param, &arguments); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + if (!arguments) { + arguments = ZEPHIR_GLOBAL(global_null); + } + + + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + zephir_is_iterable(extensions, &_1$$3, &_0$$3, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 189); + for ( + ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) + ) { + ZEPHIR_GET_HVALUE(extension, _2$$3); + if ((zephir_method_exists(extension, name TSRMLS_CC) == SUCCESS)) { + if (Z_TYPE_P(arguments) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_3$$6); + zephir_create_array(_3$$6, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$6, extension); + zephir_array_fast_append(_3$$6, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC_ARRAY(status, _3$$6, arguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(_4$$7); + zephir_create_array(_4$$7, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_4$$7, extension); + zephir_array_fast_append(_4$$7, name); + ZEPHIR_INIT_NVAR(status); + ZEPHIR_CALL_USER_FUNC(status, _4$$7); + zephir_check_call_status(); + } + if (Z_TYPE_P(status) == IS_STRING) { + RETURN_CCTOR(status); + } + } + } + } + ZEPHIR_MM_RESTORE(); + } -// 2445 "parser.php7.c" - break; - case 114: -// 723 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(14,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addExtension) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *extension; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &extension); + + + + if (Z_TYPE_P(extension) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The extension is not valid", "phalcon/mvc/view/engine/volt/compiler.zep", 198); + return; + } + if ((zephir_method_exists_ex(extension, SS("initialize") TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, extension, "initialize", NULL, 0, this_ptr); + zephir_check_call_status(); + } + zephir_update_property_array_append(this_ptr, SL("_extensions"), extension TSRMLS_CC); + RETURN_THIS(); + } -// 2453 "parser.php7.c" - break; - case 115: -// 727 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(15,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getExtensions) { + + + + RETURN_MEMBER(this_ptr, "_extensions"); + } -// 2461 "parser.php7.c" - break; - case 117: -// 735 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFunction) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_functions"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2469 "parser.php7.c" - break; - case 118: -// 739 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-2].minor); - vv_destructor(3,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFunctions) { + + + + RETURN_MEMBER(this_ptr, "_functions"); + } -// 2478 "parser.php7.c" - break; - case 119: -// 743 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); - vv_destructor(26,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, addFilter) { + + zval *name_param = NULL, *definition; + zval *name = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &definition); + + if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(name, name_param); + } else { + ZEPHIR_INIT_VAR(name); + ZVAL_EMPTY_STRING(name); + } + + + zephir_update_property_array(this_ptr, SL("_filters"), name, definition TSRMLS_CC); + RETURN_THIS(); + } -// 2486 "parser.php7.c" - break; - case 120: -// 747 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(27,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFilters) { + + + + RETURN_MEMBER(this_ptr, "_filters"); + } -// 2494 "parser.php7.c" - break; - case 121: -// 751 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(28,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, setUniquePrefix) { + + zval *prefix_param = NULL; + zval *prefix = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + + if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(prefix, prefix_param); + } else { + ZEPHIR_INIT_VAR(prefix); + ZVAL_EMPTY_STRING(prefix); + } + + + zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC); + RETURN_THIS(); + } -// 2502 "parser.php7.c" - break; - case 122: -// 755 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getUniquePrefix) { + + zval *_7$$5; + zval *_0, *_3, *_8, *_1$$3, *_2$$3, *_4$$4, *_5$$5, *_6$$5; + int ZEPHIR_LAST_CALL_STATUS; + + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + if (!(zephir_is_true(_0))) { + ZEPHIR_INIT_VAR(_1$$3); + _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_currentPath"), PH_NOISY_CC); + zephir_unique_path_key(_1$$3, _2$$3 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_prefix"), _1$$3 TSRMLS_CC); + } + ZEPHIR_OBS_VAR(_3); + zephir_read_property_this(&_3, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_3) == IS_OBJECT) { + ZEPHIR_OBS_VAR(_4$$4); + zephir_read_property_this(&_4$$4, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (zephir_instance_of_ev(_4$$4, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_5$$5); + _6$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(_7$$5); + zephir_create_array(_7$$5, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_7$$5, this_ptr); + ZEPHIR_CALL_USER_FUNC_ARRAY(_5$$5, _6$$5, _7$$5); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_prefix"), _5$$5 TSRMLS_CC); + } + } + ZEPHIR_OBS_VAR(_8); + zephir_read_property_this(&_8, this_ptr, SL("_prefix"), PH_NOISY_CC); + if (Z_TYPE_P(_8) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "The unique compilation prefix is invalid", "phalcon/mvc/view/engine/volt/compiler.zep", 285); + return; + } + RETURN_MM_MEMBER(this_ptr, "_prefix"); + } -// 2511 "parser.php7.c" - break; - case 123: -// 759 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, attributeReader) { + + zend_bool _3$$5, _8$$8; + zephir_fcall_cache_entry *_7 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *left = NULL, *leftType = NULL, *variable = NULL, *level = NULL, *dependencyInjector = NULL, *leftCode = NULL, *right = NULL, *_0, *_9, *_1$$4 = NULL, *_2$$4, *_4$$5 = NULL, *_5$$6, *_6$$7, *_10$$11, *_11$$12 = NULL; + zval *expr = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + ZEPHIR_OBS_VAR(left); + zephir_array_fetch_string(&left, expr, SL("left"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 301 TSRMLS_CC); + zephir_array_fetch_string(&_0, left, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 303 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 265)) { + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, left, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 305 TSRMLS_CC); + if (ZEPHIR_IS_STRING(variable, "loop")) { + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVVS(_2$$4, "$", _1$$4, level, "loop"); + zephir_concat_self(&exprCode, _2$$4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("_loopPointers"), level, level TSRMLS_CC); + } else { + ZEPHIR_OBS_VAR(dependencyInjector); + zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + _3$$5 = Z_TYPE_P(dependencyInjector) == IS_OBJECT; + if (_3$$5) { + ZEPHIR_CALL_METHOD(&_4$$5, dependencyInjector, "has", NULL, 0, variable); + zephir_check_call_status(); + _3$$5 = zephir_is_true(_4$$5); + } + if (_3$$5) { + ZEPHIR_INIT_VAR(_5$$6); + ZEPHIR_CONCAT_SV(_5$$6, "$this->", variable); + zephir_concat_self(&exprCode, _5$$6 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_6$$7); + ZEPHIR_CONCAT_SV(_6$$7, "$", variable); + zephir_concat_self(&exprCode, _6$$7 TSRMLS_CC); + } + } + } else { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(leftType); + zephir_array_fetch_string(&leftType, left, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 328 TSRMLS_CC); + _8$$8 = !ZEPHIR_IS_LONG(leftType, '.'); + if (_8$$8) { + _8$$8 = !ZEPHIR_IS_LONG(leftType, 350); + } + if (_8$$8) { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } else { + zephir_concat_self(&exprCode, leftCode TSRMLS_CC); + } + } + zephir_concat_self_str(&exprCode, SL("->") TSRMLS_CC); + ZEPHIR_OBS_VAR(right); + zephir_array_fetch_string(&right, expr, SL("right"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 338 TSRMLS_CC); + zephir_array_fetch_string(&_9, right, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 340 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_9, 265)) { + zephir_array_fetch_string(&_10$$11, right, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 341 TSRMLS_CC); + zephir_concat_self(&exprCode, _10$$11 TSRMLS_CC); + } else { + ZEPHIR_CALL_METHOD(&_11$$12, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + zephir_concat_self(&exprCode, _11$$12 TSRMLS_CC); + } + RETURN_CCTOR(exprCode); + } -// 2520 "parser.php7.c" - break; - case 124: -// 763 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) { + + zend_bool _8$$5; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *code = NULL, *funcArguments = NULL, *arguments = NULL, *nameExpr = NULL, *nameType = NULL, *name = NULL, *extensions = NULL, *functions = NULL, *definition = NULL, *extendedBlocks = NULL, *block = NULL, *currentBlock = NULL, *exprLevel = NULL, *escapedCode = NULL, *method = NULL, *arrayHelpers = NULL, *className = NULL, *_10 = NULL, *_2$$6, *_4$$9, *_5$$9, *_6$$9, *_7$$9, *_9$$5; + zval *expr = NULL, *_1$$6, *_3$$12; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, expr, SS("arguments"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", &_0, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(arguments); + ZVAL_STRING(arguments, "", 1); + } + ZEPHIR_OBS_VAR(nameExpr); + zephir_array_fetch_string(&nameExpr, expr, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + ZEPHIR_OBS_VAR(nameType); + zephir_array_fetch_string(&nameType, nameExpr, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 368 TSRMLS_CC); + if (ZEPHIR_IS_LONG(nameType, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, nameExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 375 TSRMLS_CC); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_1$$6); + zephir_create_array(_1$$6, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_1$$6, name); + zephir_array_fast_append(_1$$6, arguments); + zephir_array_fast_append(_1$$6, funcArguments); + ZEPHIR_INIT_VAR(_2$$6); + ZVAL_STRING(_2$$6, "compileFunction", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _2$$6, _1$$6); + zephir_check_temp_parameter(_2$$6); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(functions); + zephir_read_property_this(&functions, this_ptr, SL("_functions"), PH_NOISY_CC); + if (Z_TYPE_P(functions) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, functions, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_3$$12); + zephir_create_array(_3$$12, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_3$$12, arguments); + zephir_array_fast_append(_3$$12, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _3$$12); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_4$$9); + object_init_ex(_4$$9, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$9, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 417 TSRMLS_CC); + zephir_array_fetch_string(&_6$$9, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$9); + ZEPHIR_CONCAT_SVSVSV(_7$$9, "Invalid definition for user function '", name, "' in ", _5$$9, " on line ", _6$$9); + ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 9, _7$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$9, "phalcon/mvc/view/engine/volt/compiler.zep", 418 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + _8$$5 = ZEPHIR_IS_STRING(name, "get_content"); + if (!(_8$$5)) { + _8$$5 = ZEPHIR_IS_STRING(name, "content"); + } + if (_8$$5) { + RETURN_MM_STRING("$this->getContent()", 1); + } + if (ZEPHIR_IS_STRING(name, "partial")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->partial(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "super")) { + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + if (Z_TYPE_P(extendedBlocks) == IS_ARRAY) { + ZEPHIR_OBS_VAR(currentBlock); + zephir_read_property_this(¤tBlock, this_ptr, SL("_currentBlock"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(block); + if (zephir_array_isset_fetch(&block, extendedBlocks, currentBlock, 0 TSRMLS_CC)) { + ZEPHIR_OBS_VAR(exprLevel); + zephir_read_property_this(&exprLevel, this_ptr, SL("_exprLevel"), PH_NOISY_CC); + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlistorextends", NULL, 367, block); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, code); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, code TSRMLS_CC); + } + } else { + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + ZEPHIR_CPY_WRT(escapedCode, block); + } else { + ZEPHIR_INIT_NVAR(escapedCode); + zephir_addslashes(escapedCode, block TSRMLS_CC); + } + } + if (ZEPHIR_IS_LONG(exprLevel, 1)) { + RETURN_CCTOR(escapedCode); + } + ZEPHIR_CONCAT_SVS(return_value, "'", escapedCode, "'"); + RETURN_MM(); + } + } + RETURN_MM_STRING("''", 1); + } + ZEPHIR_INIT_VAR(_9$$5); + zephir_camelize(_9$$5, name, NULL ); + ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 68, _9$$5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(className); + ZVAL_STRING(className, "Phalcon\\Tag", 1); + if ((zephir_method_exists(className, method TSRMLS_CC) == SUCCESS)) { + ZEPHIR_OBS_VAR(arrayHelpers); + zephir_read_property_this(&arrayHelpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); + if (Z_TYPE_P(arrayHelpers) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(arrayHelpers); + zephir_create_array(arrayHelpers, 18, 0 TSRMLS_CC); + zephir_array_update_string(&arrayHelpers, SL("link_to"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("form"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("select_static"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("submit_button"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("radio_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("check_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("file_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("hidden_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("password_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_area"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("text_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("email_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("date_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("tel_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("numeric_field"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_array_update_string(&arrayHelpers, SL("image_input"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_arrayHelpers"), arrayHelpers TSRMLS_CC); + } + if (zephir_array_isset(arrayHelpers, name)) { + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "([", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->tag->", method, "(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->get(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "static_url")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->url->getStatic(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "date")) { + ZEPHIR_CONCAT_SVS(return_value, "date(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "time")) { + RETURN_MM_STRING("time()", 1); + } + if (ZEPHIR_IS_STRING(name, "dump")) { + ZEPHIR_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "version")) { + RETURN_MM_STRING("Phalcon\\Version::get()", 1); + } + if (ZEPHIR_IS_STRING(name, "version_id")) { + RETURN_MM_STRING("Phalcon\\Version::getId()", 1); + } + if (ZEPHIR_IS_STRING(name, "constant")) { + ZEPHIR_CONCAT_SVS(return_value, "constant(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVSVS(return_value, "$this->callMacro('", name, "', [", arguments, "])"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "expression", &_0, 365, nameExpr); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSVS(return_value, _10, "(", arguments, ")"); + RETURN_MM(); + } -// 2529 "parser.php7.c" - break; - case 125: -// 767 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-1].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) { + + zephir_fcall_cache_entry *_2 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *test_param = NULL, *left_param = NULL, *type = NULL, *name = NULL, *testName = NULL, *_7 = NULL, *_0$$12 = NULL, *_1$$12, *_3$$13 = NULL, *_4$$13, *_5$$14 = NULL, *_6$$14; + zval *test = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &test_param, &left_param); + + test = test_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, test, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 570 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, test, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 577 TSRMLS_CC); + if (ZEPHIR_IS_STRING(name, "empty")) { + ZEPHIR_CONCAT_SVS(return_value, "empty(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "even")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "odd")) { + ZEPHIR_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "numeric")) { + ZEPHIR_CONCAT_SVS(return_value, "is_numeric(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "scalar")) { + ZEPHIR_CONCAT_SVS(return_value, "is_scalar(", left, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "iterable")) { + ZEPHIR_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); + RETURN_MM(); + } + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_OBS_VAR(testName); + zephir_array_fetch_string(&testName, test, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 628 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, testName, SS("value"), 0 TSRMLS_CC)) { + if (ZEPHIR_IS_STRING(name, "divisibleby")) { + zephir_array_fetch_string(&_1$$12, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 632 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", &_2, 365, _1$$12); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(((", left, ") % (", _0$$12, ")) == 0)"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sameas")) { + zephir_array_fetch_string(&_4$$13, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 639 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_3$$13, this_ptr, "expression", &_2, 365, _4$$13); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "(", left, ") === (", _3$$13, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "type")) { + zephir_array_fetch_string(&_6$$14, test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 646 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_5$$14, this_ptr, "expression", &_2, 365, _6$$14); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", _5$$14, ")"); + RETURN_MM(); + } + } + } + ZEPHIR_CALL_METHOD(&_7, this_ptr, "expression", &_2, 365, test); + zephir_check_call_status(); + ZEPHIR_CONCAT_VSV(return_value, left, " == ", _7); + RETURN_MM(); + } -// 2538 "parser.php7.c" - break; - case 126: -// 771 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); - vv_destructor(83,&vvmsp[-2].minor); - vv_destructor(84,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) { + + zend_bool _13, _14, _15; + int ZEPHIR_LAST_CALL_STATUS; + zval *left = NULL; + zval *filter_param = NULL, *left_param = NULL, *code = NULL, *type = NULL, *functionName = NULL, *name = NULL, *file = NULL, *line = NULL, *extensions = NULL, *filters = NULL, *funcArguments = NULL, *arguments = NULL, *definition = NULL, *_16, *_17, *_18, *_19, *_0$$5, *_1$$5, *_2$$5, *_3$$5, *_7$$9, *_9$$12, *_10$$12, *_11$$12, *_12$$12; + zval *filter = NULL, *_4$$7, *_5$$7, *_6$$9, *_8$$15; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &filter_param, &left_param); + + filter = filter_param; + zephir_get_strval(left, left_param); + + + ZEPHIR_INIT_VAR(code); + ZVAL_NULL(code); + ZEPHIR_OBS_VAR(type); + zephir_array_fetch_string(&type, filter, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 665 TSRMLS_CC); + if (ZEPHIR_IS_LONG(type, 265)) { + ZEPHIR_OBS_VAR(name); + zephir_array_fetch_string(&name, filter, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 671 TSRMLS_CC); + } else { + if (!ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_INIT_VAR(_0$$5); + object_init_ex(_0$$5, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_1$$5, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + zephir_array_fetch_string(&_2$$5, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVSV(_3$$5, "Unknown filter type in ", _1$$5, " on line ", _2$$5); + ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 679 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_VAR(functionName); + zephir_array_fetch_string(&functionName, filter, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 682 TSRMLS_CC); + ZEPHIR_OBS_NVAR(name); + zephir_array_fetch_string(&name, functionName, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 683 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(funcArguments); + ZVAL_NULL(funcArguments); + ZEPHIR_INIT_VAR(arguments); + ZVAL_NULL(arguments); + ZEPHIR_OBS_NVAR(funcArguments); + if (zephir_array_isset_string_fetch(&funcArguments, filter, SS("arguments"), 0 TSRMLS_CC)) { + if (!ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_OBS_VAR(file); + zephir_array_fetch_string(&file, filter, SL("file"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_OBS_VAR(line); + zephir_array_fetch_string(&line, filter, SL("line"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 698 TSRMLS_CC); + ZEPHIR_INIT_VAR(_4$$7); + zephir_create_array(_4$$7, 3, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$7); + zephir_create_array(_5$$7, 4, 0 TSRMLS_CC); + add_assoc_long_ex(_5$$7, SS("type"), 364); + zephir_array_update_string(&_5$$7, SL("value"), &left, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_5$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("expr"), &_5$$7, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); + ZEPHIR_MAKE_REF(funcArguments); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, funcArguments, _4$$7); + ZEPHIR_UNREF(funcArguments); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 365, funcArguments); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(arguments, left); + } + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_VAR(_6$$9); + zephir_create_array(_6$$9, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_6$$9, name); + zephir_array_fast_append(_6$$9, arguments); + zephir_array_fast_append(_6$$9, funcArguments); + ZEPHIR_INIT_VAR(_7$$9); + ZVAL_STRING(_7$$9, "compileFilter", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 366, _7$$9, _6$$9); + zephir_check_temp_parameter(_7$$9); + zephir_check_call_status(); + if (Z_TYPE_P(code) == IS_STRING) { + RETURN_CCTOR(code); + } + } + ZEPHIR_OBS_VAR(filters); + zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); + if (Z_TYPE_P(filters) == IS_ARRAY) { + ZEPHIR_OBS_VAR(definition); + if (zephir_array_isset_fetch(&definition, filters, name, 0 TSRMLS_CC)) { + if (Z_TYPE_P(definition) == IS_STRING) { + ZEPHIR_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(definition) == IS_OBJECT) { + if (zephir_instance_of_ev(definition, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_8$$15); + zephir_create_array(_8$$15, 2, 0 TSRMLS_CC); + zephir_array_fast_append(_8$$15, arguments); + zephir_array_fast_append(_8$$15, funcArguments); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, definition, _8$$15); + zephir_check_call_status(); + RETURN_MM(); + } + } + ZEPHIR_INIT_VAR(_9$$12); + object_init_ex(_9$$12, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_10$$12, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 762 TSRMLS_CC); + zephir_array_fetch_string(&_11$$12, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$12); + ZEPHIR_CONCAT_SVSVSV(_12$$12, "Invalid definition for user filter '", name, "' in ", _10$$12, " on line ", _11$$12); + ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _12$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(_9$$12, "phalcon/mvc/view/engine/volt/compiler.zep", 763 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + if (ZEPHIR_IS_STRING(name, "length")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); + RETURN_MM(); + } + _13 = ZEPHIR_IS_STRING(name, "e"); + if (!(_13)) { + _13 = ZEPHIR_IS_STRING(name, "escape"); + } + if (_13) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_css")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_js")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "escape_attr")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "trim")) { + ZEPHIR_CONCAT_SVS(return_value, "trim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "left_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "right_trim")) { + ZEPHIR_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "striptags")) { + ZEPHIR_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "url_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slashes")) { + ZEPHIR_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "stripslashes")) { + ZEPHIR_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "nl2br")) { + ZEPHIR_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "keys")) { + ZEPHIR_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "join")) { + ZEPHIR_CONCAT_SVS(return_value, "join(", arguments, ")"); + RETURN_MM(); + } + _14 = ZEPHIR_IS_STRING(name, "lower"); + if (!(_14)) { + _14 = ZEPHIR_IS_STRING(name, "lowercase"); + } + if (_14) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); + RETURN_MM(); + } + _15 = ZEPHIR_IS_STRING(name, "upper"); + if (!(_15)) { + _15 = ZEPHIR_IS_STRING(name, "uppercase"); + } + if (_15) { + ZEPHIR_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "capitalize")) { + ZEPHIR_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "sort")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_encode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "json_decode")) { + ZEPHIR_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "format")) { + ZEPHIR_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "abs")) { + ZEPHIR_CONCAT_SVS(return_value, "abs(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "slice")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "default")) { + ZEPHIR_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(name, "convert_encoding")) { + ZEPHIR_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_16); + object_init_ex(_16, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_17, filter, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + zephir_array_fetch_string(&_18, filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_INIT_VAR(_19); + ZEPHIR_CONCAT_SVSVSV(_19, "Unknown filter \"", name, "\" in ", _17, " on line ", _18); + ZEPHIR_CALL_METHOD(NULL, _16, "__construct", NULL, 9, _19); + zephir_check_call_status(); + zephir_throw_exception_debug(_16, "phalcon/mvc/view/engine/volt/compiler.zep", 952 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } -// 2547 "parser.php7.c" - break; - case 128: -// 779 "parser.php7.lemon" -{ - phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); - vv_destructor(4,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) { + + HashTable *_4$$6; + HashPosition _3$$6; + zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL, *_13 = NULL, *_19 = NULL, *_26 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *exprCode = NULL, *extensions = NULL, *items = NULL, *singleExpr = NULL, *singleExprCode = NULL, *name = NULL, *left = NULL, *leftCode = NULL, *right = NULL, *rightCode = NULL, *type = NULL, *startCode = NULL, *endCode = NULL, *start = NULL, *end = NULL, *_1$$4 = NULL, **_5$$6, *_6$$7, *_8$$8 = NULL, *_10$$12, *_12$$13, *_14$$31 = NULL, *_15$$31, _16$$31 = zval_used_for_init, _17$$31 = zval_used_for_init, *_18$$35, *_20$$69 = NULL, *_21$$69, *_22$$73 = NULL, *_23$$73, *_24$$73, *_25$$73 = NULL; + zval *expr = NULL, *_0$$4 = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &expr_param); + + expr = expr_param; + + + ZEPHIR_INIT_VAR(exprCode); + ZVAL_NULL(exprCode); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + while (1) { + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_0$$4); + zephir_create_array(_0$$4, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_0$$4, expr); + ZEPHIR_INIT_NVAR(_1$$4); + ZVAL_STRING(_1$$4, "resolveExpression", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_2, 366, _1$$4, _0$$4); + zephir_check_temp_parameter(_1$$4); + zephir_check_call_status(); + if (Z_TYPE_P(exprCode) == IS_STRING) { + break; + } + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, expr, SS("type"), 0 TSRMLS_CC))) { + ZEPHIR_INIT_NVAR(items); + array_init(items); + zephir_is_iterable(expr, &_4$$6, &_3$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 993); + for ( + ; zephir_hash_get_current_data_ex(_4$$6, (void**) &_5$$6, &_3$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_4$$6, &_3$$6) + ) { + ZEPHIR_GET_HVALUE(singleExpr, _5$$6); + zephir_array_fetch_string(&_6$$7, singleExpr, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 986 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_7, 365, _6$$7); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(name); + if (zephir_array_isset_string_fetch(&name, singleExpr, SS("name"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_LNVAR(_8$$8); + ZEPHIR_CONCAT_SVSV(_8$$8, "'", name, "' => ", singleExprCode); + zephir_array_append(&items, _8$$8, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 988); + } else { + zephir_array_append(&items, singleExprCode, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 990); + } + } + ZEPHIR_INIT_NVAR(exprCode); + zephir_fast_join_str(exprCode, SL(", "), items TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, '.')) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "attributereader", &_9, 0, expr); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(left); + if (zephir_array_isset_string_fetch(&left, expr, SS("left"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_7, 365, left); + zephir_check_call_status(); + } + if (ZEPHIR_IS_LONG(type, 311)) { + zephir_array_fetch_string(&_10$$12, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1016 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvetest", &_11, 0, _10$$12, leftCode); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 124)) { + zephir_array_fetch_string(&_12$$13, expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1024 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_13, 369, _12$$13, leftCode); + zephir_check_call_status(); + break; + } + ZEPHIR_OBS_NVAR(right); + if (zephir_array_isset_string_fetch(&right, expr, SS("right"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_7, 365, right); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_NULL(exprCode); + do { + if (ZEPHIR_IS_LONG(type, '!')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "!", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '*')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " * ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '+')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " + ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '-')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " - ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '/')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " / ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 37)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " % ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, '<')) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " < ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 61)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 62)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " > ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 126)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " . ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 278)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "pow(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 360)) { + ZEPHIR_INIT_NVAR(exprCode); + if (zephir_array_isset_string(expr, SS("left"))) { + ZEPHIR_CONCAT_SVS(exprCode, "[", leftCode, "]"); + } else { + ZVAL_STRING(exprCode, "[]", 1); + } + break; + } + if (ZEPHIR_IS_LONG(type, 258)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1091 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 259)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1095 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 260)) { + ZEPHIR_INIT_NVAR(_14$$31); + zephir_array_fetch_string(&_15$$31, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1099 TSRMLS_CC); + ZEPHIR_SINIT_NVAR(_16$$31); + ZVAL_STRING(&_16$$31, "'", 0); + ZEPHIR_SINIT_NVAR(_17$$31); + ZVAL_STRING(&_17$$31, "\\'", 0); + zephir_fast_str_replace(&_14$$31, &_16$$31, &_17$$31, _15$$31 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "'", _14$$31, "'"); + break; + } + if (ZEPHIR_IS_LONG(type, 261)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "null", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 262)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "false", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 263)) { + ZEPHIR_INIT_NVAR(exprCode); + ZVAL_STRING(exprCode, "true", 1); + break; + } + if (ZEPHIR_IS_LONG(type, 265)) { + zephir_array_fetch_string(&_18$$35, expr, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1115 TSRMLS_CC); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "$", _18$$35); + break; + } + if (ZEPHIR_IS_LONG(type, 266)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " && ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 267)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " || ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 270)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " <= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 271)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " >= ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 272)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " == ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 273)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " != ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 274)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " === ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 275)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSV(exprCode, leftCode, " !== ", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 276)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "range(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 350)) { + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "functioncall", &_19, 0, expr); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(type, 356)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 361)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_VSVS(exprCode, leftCode, "[", rightCode, "]"); + break; + } + if (ZEPHIR_IS_LONG(type, 365)) { + ZEPHIR_OBS_NVAR(start); + if (zephir_array_isset_string_fetch(&start, expr, SS("start"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_7, 365, start); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(startCode); + ZVAL_STRING(startCode, "null", 1); + } + ZEPHIR_OBS_NVAR(end); + if (zephir_array_isset_string_fetch(&end, expr, SS("end"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_7, 365, end); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(endCode); + ZVAL_STRING(endCode, "null", 1); + } + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "$this->slice(", leftCode, ", ", startCode, ", ", endCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 362)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 363)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "isset(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 392)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 386)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "empty(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 393)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 387)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) == 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 394)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 388)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "(((", leftCode, ") % 2) != 0)"); + break; + } + if (ZEPHIR_IS_LONG(type, 395)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 389)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_numeric(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 396)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "!is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 390)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVS(exprCode, "is_scalar(", leftCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 397)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 391)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "(is_array(", leftCode, ") || (", leftCode, ") instanceof Traversable)"); + break; + } + if (ZEPHIR_IS_LONG(type, 309)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 367)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVS(exprCode, "!$this->isIncluded(", leftCode, ", ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 366)) { + zephir_array_fetch_string(&_21$$69, expr, SL("ternary"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1254 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&_20$$69, this_ptr, "expression", &_7, 365, _21$$69); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SVSVSVS(exprCode, "(", _20$$69, " ? ", leftCode, " : ", rightCode, ")"); + break; + } + if (ZEPHIR_IS_LONG(type, 368)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "-", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 369)) { + ZEPHIR_INIT_NVAR(exprCode); + ZEPHIR_CONCAT_SV(exprCode, "+", rightCode); + break; + } + if (ZEPHIR_IS_LONG(type, 364)) { + ZEPHIR_OBS_NVAR(exprCode); + zephir_array_fetch_string(&exprCode, expr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1266 TSRMLS_CC); + break; + } + ZEPHIR_INIT_NVAR(_22$$73); + object_init_ex(_22$$73, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_23$$73, expr, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + zephir_array_fetch_string(&_24$$73, expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_25$$73); + ZEPHIR_CONCAT_SVSVSV(_25$$73, "Unknown expression ", type, " in ", _23$$73, " on line ", _24$$73); + ZEPHIR_CALL_METHOD(NULL, _22$$73, "__construct", &_26, 9, _25$$73); + zephir_check_call_status(); + zephir_throw_exception_debug(_22$$73, "phalcon/mvc/view/engine/volt/compiler.zep", 1270 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); + + break; + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_exprLevel") TSRMLS_CC)); + RETURN_CCTOR(exprCode); + } -// 2556 "parser.php7.c" - break; - case 129: -// 783 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementListOrExtends) { + + HashTable *_1$$4; + HashPosition _0$$4; + zend_bool isStatementList = 0; + int ZEPHIR_LAST_CALL_STATUS; + zval *statements, *statement = NULL, **_2$$4; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statements); + + + + if (Z_TYPE_P(statements) != IS_ARRAY) { + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } + isStatementList = 1; + if (!(zephir_array_isset_string(statements, SS("type")))) { + zephir_is_iterable(statements, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1310); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(statement, _2$$4); + if (Z_TYPE_P(statement) != IS_ARRAY) { + isStatementList = 0; + break; + } + } + } + if (isStatementList == 1) { + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_statementlist", NULL, 370, statements); + zephir_check_call_status(); + RETURN_MM(); + } + RETVAL_ZVAL(statements, 1, 0); + RETURN_MM(); + } -// 2566 "parser.php7.c" - break; - case 130: -// 787 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(24,&vvmsp[-3].minor); - vv_destructor(5,&vvmsp[-1].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) { + + HashTable *_2$$4; + HashPosition _1$$4; + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *prefix = NULL, *level = NULL, *prefixLevel = NULL, *expr = NULL, *exprCode = NULL, *bstatement = NULL, *type = NULL, *blockStatements = NULL, *forElse = NULL, *code = NULL, *loopContext = NULL, *iterator = NULL, *key = NULL, *ifExpr = NULL, *variable = NULL, *_5, **_3$$4, *_4$$8 = NULL, *_6$$9, *_7$$9, *_8$$9, *_9$$9, *_10$$9, *_11$$9, *_12$$9, *_13$$9, *_14$$9, *_15$$11, *_16$$12, *_17$$13 = NULL, *_18$$13, *_19$$15, *_20$$15, *_21$$15, *_22$$15, *_23$$15, *_24$$15, *_25$$16, *_26$$20; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + if (!(zephir_array_isset_string(statement, SS("expr")))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1338); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "", 1); + ZEPHIR_INIT_VAR(forElse); + ZVAL_NULL(forElse); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + ZEPHIR_CALL_METHOD(&prefix, this_ptr, "getuniqueprefix", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(level); + zephir_read_property_this(&level, this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(prefixLevel); + ZEPHIR_CONCAT_VV(prefixLevel, prefix, level); + ZEPHIR_OBS_VAR(expr); + zephir_array_fetch_string(&expr, statement, SL("expr"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1356 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(blockStatements); + zephir_array_fetch_string(&blockStatements, statement, SL("block_statements"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1362 TSRMLS_CC); + ZEPHIR_INIT_NVAR(forElse); + ZVAL_BOOL(forElse, 0); + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + zephir_is_iterable(blockStatements, &_2$$4, &_1$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1388); + for ( + ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) + ) { + ZEPHIR_GET_HVALUE(bstatement, _3$$4); + if (Z_TYPE_P(bstatement) != IS_ARRAY) { + break; + } + ZEPHIR_OBS_NVAR(type); + if (!(zephir_array_isset_string_fetch(&type, bstatement, SS("type"), 0 TSRMLS_CC))) { + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_INIT_LNVAR(_4$$8); + ZEPHIR_CONCAT_SVS(_4$$8, ""); + zephir_concat_self(&compilation, _4$$8 TSRMLS_CC); + ZEPHIR_CPY_WRT(forElse, prefixLevel); + zephir_update_property_array(this_ptr, SL("_forElsePointers"), level, forElse TSRMLS_CC); + break; + } + } + } + ZEPHIR_INIT_VAR(_5); + if (extendsMode) { + ZVAL_BOOL(_5, 1); + } else { + ZVAL_BOOL(_5, 0); + } + ZEPHIR_CALL_METHOD(&code, this_ptr, "_statementlist", NULL, 370, blockStatements, _5); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(loopContext); + zephir_read_property_this(&loopContext, this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_6$$9); + ZEPHIR_CONCAT_SVSVS(_6$$9, "self = &$", prefixLevel, "loop; "); + zephir_concat_self(&compilation, _9$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_10$$9); + ZEPHIR_CONCAT_SVSVS(_10$$9, "$", prefixLevel, "loop->length = count($", prefixLevel, "iterator); "); + zephir_concat_self(&compilation, _10$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_11$$9); + ZEPHIR_CONCAT_SVS(_11$$9, "$", prefixLevel, "loop->index = 1; "); + zephir_concat_self(&compilation, _11$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12$$9); + ZEPHIR_CONCAT_SVS(_12$$9, "$", prefixLevel, "loop->index0 = 1; "); + zephir_concat_self(&compilation, _12$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_13$$9); + ZEPHIR_CONCAT_SVSVS(_13$$9, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length; "); + zephir_concat_self(&compilation, _13$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(_14$$9); + ZEPHIR_CONCAT_SVSVS(_14$$9, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - 1; ?>"); + zephir_concat_self(&compilation, _14$$9 TSRMLS_CC); + ZEPHIR_INIT_VAR(iterator); + ZEPHIR_CONCAT_SVS(iterator, "$", prefixLevel, "iterator"); + } else { + ZEPHIR_CPY_WRT(iterator, exprCode); + } + ZEPHIR_OBS_VAR(variable); + zephir_array_fetch_string(&variable, statement, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1418 TSRMLS_CC); + ZEPHIR_OBS_VAR(key); + if (zephir_array_isset_string_fetch(&key, statement, SS("key"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_15$$11); + ZEPHIR_CONCAT_SVSVSVS(_15$$11, " $", variable, ") { "); + zephir_concat_self(&compilation, _15$$11 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_16$$12); + ZEPHIR_CONCAT_SVSVS(_16$$12, ""); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("?>") TSRMLS_CC); + } + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_19$$15); + ZEPHIR_CONCAT_SVSVS(_19$$15, "first = ($", prefixLevel, "incr == 0); "); + zephir_concat_self(&compilation, _19$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_20$$15); + ZEPHIR_CONCAT_SVSVS(_20$$15, "$", prefixLevel, "loop->index = $", prefixLevel, "incr + 1; "); + zephir_concat_self(&compilation, _20$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_21$$15); + ZEPHIR_CONCAT_SVSVS(_21$$15, "$", prefixLevel, "loop->index0 = $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _21$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_22$$15); + ZEPHIR_CONCAT_SVSVSVS(_22$$15, "$", prefixLevel, "loop->revindex = $", prefixLevel, "loop->length - $", prefixLevel, "incr; "); + zephir_concat_self(&compilation, _22$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_23$$15); + ZEPHIR_CONCAT_SVSVSVS(_23$$15, "$", prefixLevel, "loop->revindex0 = $", prefixLevel, "loop->length - ($", prefixLevel, "incr + 1); "); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + ZEPHIR_INIT_VAR(_24$$15); + ZEPHIR_CONCAT_SVSVSVS(_24$$15, "$", prefixLevel, "loop->last = ($", prefixLevel, "incr == ($", prefixLevel, "loop->length - 1)); ?>"); + zephir_concat_self(&compilation, _24$$15 TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + ZEPHIR_INIT_VAR(_25$$16); + ZEPHIR_CONCAT_SVS(_25$$16, ""); + zephir_concat_self(&compilation, _25$$16 TSRMLS_CC); + } + zephir_concat_self(&compilation, code TSRMLS_CC); + if (zephir_array_isset_string(statement, SS("if_expr"))) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + if (Z_TYPE_P(forElse) == IS_STRING) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } else { + if (zephir_array_isset(loopContext, level)) { + ZEPHIR_INIT_VAR(_26$$20); + ZEPHIR_CONCAT_SVS(_26$$20, ""); + zephir_concat_self(&compilation, _26$$20 TSRMLS_CC); + } else { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_foreachLevel") TSRMLS_CC)); + RETURN_CCTOR(compilation); + } -// 2576 "parser.php7.c" - break; - case 131: -// 791 "parser.php7.lemon" -{ - phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(24,&vvmsp[-4].minor); - vv_destructor(5,&vvmsp[-2].minor); - vv_destructor(46,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForElse) { + + zval *level = NULL, *prefix = NULL, *_0, *_1$$3; + + + level = zephir_fetch_nproperty_this(this_ptr, SL("_foreachLevel"), PH_NOISY_CC); + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forElsePointers"), PH_NOISY_CC); + if (zephir_array_isset_fetch(&prefix, _0, level, 1 TSRMLS_CC)) { + _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_loopPointers"), PH_NOISY_CC); + if (zephir_array_isset(_1$$3, level)) { + ZEPHIR_CONCAT_SVSVS(return_value, ""); + return; + } + ZEPHIR_CONCAT_SVS(return_value, ""); + return; + } + RETURN_STRING("", 1); + } -// 2586 "parser.php7.c" - break; - case 136: - case 144: -// 823 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); - vv_destructor(5,&vvmsp[-1].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) { + + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *blockStatements = NULL, *expr = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3, *_5$$4 = NULL, *_6$$4, *_7$$4; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1509); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_2, statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1515 TSRMLS_CC); + ZEPHIR_INIT_VAR(_3); + if (extendsMode) { + ZVAL_BOOL(_3, 1); + } else { + ZVAL_BOOL(_3, 0); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "_statementlist", &_4, 370, _2, _3); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVSV(compilation, "", _1); + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("false_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_6$$4); + if (extendsMode) { + ZVAL_BOOL(_6$$4, 1); + } else { + ZVAL_BOOL(_6$$4, 0); + } + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "_statementlist", &_4, 370, blockStatements, _6$$4); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_7$$4); + ZEPHIR_CONCAT_SV(_7$$4, "", _5$$4); + zephir_concat_self(&compilation, _7$$4 TSRMLS_CC); + } + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2595 "parser.php7.c" - break; - case 137: - case 143: -// 827 "parser.php7.lemon" -{ - phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1544); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -// 2603 "parser.php7.c" - break; - case 139: -// 839 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); - vv_destructor(29,&vvmsp[-2].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCache) { + + zephir_fcall_cache_entry *_0 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *compilation = NULL, *expr = NULL, *exprCode = NULL, *lifetime = NULL, *_1 = NULL, *_9, *_10 = NULL, *_11, *_12, *_2$$4, *_3$$4, *_4$$5, *_5$$5, *_6$$6, *_7$$6, *_8$$7, *_13$$8, *_18$$8, *_14$$9, *_15$$9, *_16$$10, *_17$$10, *_19$$11; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &extendsMode_param); + + statement = statement_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1564); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "expression", &_0, 365, expr); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(compilation); + ZEPHIR_CONCAT_SVS(compilation, "di->get('viewCache'); "); + ZEPHIR_OBS_VAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "$_cacheKey[", exprCode, "]"); + zephir_concat_self(&compilation, _2$$4 TSRMLS_CC); + zephir_array_fetch_string(&_3$$4, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1574 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_3$$4, 265)) { + zephir_array_fetch_string(&_4$$5, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1575 TSRMLS_CC); + ZEPHIR_INIT_VAR(_5$$5); + ZEPHIR_CONCAT_SVSVSVS(_5$$5, " = $_cache[", exprCode, "]->start(", exprCode, ", $", _4$$5, "); "); + zephir_concat_self(&compilation, _5$$5 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_6$$6, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1577 TSRMLS_CC); + ZEPHIR_INIT_VAR(_7$$6); + ZEPHIR_CONCAT_SVSVSVS(_7$$6, " = $_cache[", exprCode, "]->start(", exprCode, ", ", _6$$6, "); "); + zephir_concat_self(&compilation, _7$$6 TSRMLS_CC); + } + } else { + ZEPHIR_INIT_VAR(_8$$7); + ZEPHIR_CONCAT_SVSVSVS(_8$$7, "$_cacheKey[", exprCode, "] = $_cache[", exprCode, "]->start(", exprCode, "); "); + zephir_concat_self(&compilation, _8$$7 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_9); + ZEPHIR_CONCAT_SVS(_9, "if ($_cacheKey[", exprCode, "] === null) { ?>"); + zephir_concat_self(&compilation, _9 TSRMLS_CC); + zephir_array_fetch_string(&_11, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1587 TSRMLS_CC); + ZEPHIR_INIT_VAR(_12); + if (extendsMode) { + ZVAL_BOOL(_12, 1); + } else { + ZVAL_BOOL(_12, 0); + } + ZEPHIR_CALL_METHOD(&_10, this_ptr, "_statementlist", NULL, 370, _11, _12); + zephir_check_call_status(); + zephir_concat_self(&compilation, _10 TSRMLS_CC); + ZEPHIR_OBS_NVAR(lifetime); + if (zephir_array_isset_string_fetch(&lifetime, statement, SS("lifetime"), 0 TSRMLS_CC)) { + zephir_array_fetch_string(&_13$$8, lifetime, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1593 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_13$$8, 265)) { + zephir_array_fetch_string(&_14$$9, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1594 TSRMLS_CC); + ZEPHIR_INIT_VAR(_15$$9); + ZEPHIR_CONCAT_SVSVSVS(_15$$9, "save(", exprCode, ", null, $", _14$$9, "); "); + zephir_concat_self(&compilation, _15$$9 TSRMLS_CC); + } else { + zephir_array_fetch_string(&_16$$10, lifetime, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1596 TSRMLS_CC); + ZEPHIR_INIT_VAR(_17$$10); + ZEPHIR_CONCAT_SVSVSVS(_17$$10, "save(", exprCode, ", null, ", _16$$10, "); "); + zephir_concat_self(&compilation, _17$$10 TSRMLS_CC); + } + ZEPHIR_INIT_VAR(_18$$8); + ZEPHIR_CONCAT_SVS(_18$$8, "} else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _18$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_19$$11); + ZEPHIR_CONCAT_SVSVSVS(_19$$11, "save(", exprCode, "); } else { echo $_cacheKey[", exprCode, "]; } ?>"); + zephir_concat_self(&compilation, _19$$11 TSRMLS_CC); + } + RETURN_CCTOR(compilation); + } -// 2612 "parser.php7.c" - break; - case 140: -// 843 "parser.php7.lemon" -{ - phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); - vv_destructor(29,&vvmsp[-1].minor); - vv_destructor(48,&vvmsp[0].minor); + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) { + + HashTable *_1; + HashPosition _0; + zephir_fcall_cache_entry *_4 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *assignments = NULL, *assignment = NULL, *exprCode = NULL, *target = NULL, *compilation = NULL, **_2, *_3$$4, *_5$$4, *_6$$4, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$8 = NULL, *_11$$9 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(assignments); + if (!(zephir_array_isset_string_fetch(&assignments, statement, SS("assignments"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1617); + return; + } + ZEPHIR_INIT_VAR(compilation); + ZVAL_STRING(compilation, "") TSRMLS_CC); + RETURN_CCTOR(compilation); + } -// 2621 "parser.php7.c" - break; - }; - vvgoto = vvRuleInfo[vvruleno].lhs; - vvsize = vvRuleInfo[vvruleno].nrhs; - vvpParser->vvidx -= vvsize; - vvact = vv_find_reduce_action(vvpParser,vvgoto); - if( vvact < VVNSTATE ){ - vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); - }else if( vvact == VVNSTATE + VVNRULE + 1 ){ - vv_accept(vvpParser); - } + +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1678); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_parse_failed( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn) { + + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *_0 = NULL; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1698); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); + } -static void vv_syntax_error( - vvParser *vvpParser, /* The parser */ - int vvmajor, /* The major type of the error token */ - VVMINORTYPE vvminor /* The minor type of the error token */ -){ - phvolt_ARG_FETCH; -#define VTOKEN (vvminor.vv0) -// 46 "parser.php7.lemon" +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileAutoEscape) { - { + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *autoescape = NULL, *oldAutoescape = NULL, *compilation = NULL, *_0, *_1; + zval *statement = NULL; - smart_str error_str = {0}; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); - char *token_name = NULL; - const phvolt_token_names *tokens = phvolt_tokens; - int token_len = 0; - int active_token = status->scanner_state->active_token; + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); - if (status->scanner_state->start_length) { - if (active_token) { + ZEPHIR_OBS_VAR(autoescape); + if (!(zephir_array_isset_string_fetch(&autoescape, statement, SS("enable"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1718); + return; + } + ZEPHIR_OBS_VAR(oldAutoescape); + zephir_read_property_this(&oldAutoescape, this_ptr, SL("_autoescape"), PH_NOISY_CC); + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + zephir_array_fetch_string(&_0, statement, SL("block_statements"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1727 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", NULL, 370, _0, _1); + zephir_check_call_status(); + zephir_update_property_this(this_ptr, SL("_autoescape"), oldAutoescape TSRMLS_CC); + RETURN_CCTOR(compilation); - do { - if (tokens->code == active_token) { - token_name = tokens->name; - token_len = tokens->len; - break; - } - ++tokens; - } while (tokens[0].code != 0); +} - } +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) { - smart_str_appendl(&error_str, "Syntax error, unexpected token ", sizeof("Syntax error, unexpected token ") - 1); - if (!token_name) { - smart_str_appendl(&error_str, "UNKNOWN", sizeof("UNKNOWN") - 1); - } else { - smart_str_appendl(&error_str, token_name, token_len); - } + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *expr = NULL, *exprCode = NULL, *name = NULL, *_0, *_3, *_1$$4, *_2$$5; + zval *statement = NULL; - if (status->token->value) { - smart_str_appendc(&error_str, '('); - smart_str_appendl(&error_str, status->token->value, status->token->len); - smart_str_appendc(&error_str, ')'); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); - smart_str_appendl(&error_str, " in ", sizeof(" in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); - smart_str_appendl(&error_str, " on line ", sizeof(" on line ") - 1); + statement = statement_param; - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->active_line); - smart_str_appendl(&error_str, stmp, str_len); + + ZEPHIR_OBS_VAR(expr); + if (!(zephir_array_isset_string_fetch(&expr, statement, SS("expr"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupt statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1748); + return; + } + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 365, expr); + zephir_check_call_status(); + zephir_array_fetch_string(&_0, expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1756 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 350)) { + zephir_array_fetch_string(&name, expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1758 TSRMLS_CC); + zephir_array_fetch_string(&_1$$4, name, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1760 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_1$$4, 265)) { + zephir_array_fetch_string(&_2$$5, name, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1765 TSRMLS_CC); + if (ZEPHIR_IS_STRING(_2$$5, "super")) { + RETURN_CCTOR(exprCode); } + } + } + _3 = zephir_fetch_nproperty_this(this_ptr, SL("_autoescape"), PH_NOISY_CC); + if (zephir_is_true(_3)) { + ZEPHIR_CONCAT_SVS(return_value, "escaper->escapeHtml(", exprCode, ") ?>"); + RETURN_MM(); + } + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); - } else { +} - smart_str_appendl(&error_str, "Syntax error, unexpected EOF in ", sizeof("Syntax error, unexpected EOF in ") - 1); - smart_str_appendl(&error_str, Z_STRVAL_P(status->scanner_state->active_file), Z_STRLEN_P(status->scanner_state->active_file)); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) { - /* Report unclosed 'if' blocks */ - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) > 0) { - if ((status->scanner_state->if_level + status->scanner_state->old_if_level) == 1) { - smart_str_appendl(&error_str, ", there is one 'if' block without close", sizeof(", there is one 'if' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level + status->scanner_state->old_if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'if' blocks without close", sizeof(" 'if' blocks without close") - 1); - } - } + zephir_fcall_cache_entry *_3 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zval *statement_param = NULL, *pathExpr = NULL, *path = NULL, *subCompiler = NULL, *finalPath = NULL, *compilation = NULL, *params = NULL, *_0, *_4 = NULL, *_1$$5, *_2$$6 = NULL; + zval *statement = NULL; - /* Report unclosed 'for' blocks */ - if (status->scanner_state->for_level > 0) { - if (status->scanner_state->for_level == 1) { - smart_str_appendl(&error_str, ", there is one 'for' block without close", sizeof(", there is one 'for' block without close") - 1); - } else { - smart_str_appendl(&error_str, ", there are ", sizeof(", there are ") - 1); - { - char stmp[MAX_LENGTH_OF_LONG + 1]; - int str_len; - str_len = slprintf(stmp, sizeof(stmp), "%ld", status->scanner_state->if_level); - smart_str_appendl(&error_str, stmp, str_len); - } - smart_str_appendl(&error_str, " 'for' blocks without close", sizeof(" 'for' blocks without close") - 1); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &statement_param); + + statement = statement_param; + + + ZEPHIR_OBS_VAR(pathExpr); + if (!(zephir_array_isset_string_fetch(&pathExpr, statement, SS("path"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1793); + return; + } + zephir_array_fetch_string(&_0, pathExpr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1800 TSRMLS_CC); + if (ZEPHIR_IS_LONG(_0, 260)) { + if (!(zephir_array_isset_string(statement, SS("params")))) { + ZEPHIR_OBS_VAR(path); + zephir_array_fetch_string(&path, pathExpr, SL("value"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1810 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", NULL, 0, path); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_INIT_VAR(_1$$5); + ZVAL_BOOL(_1$$5, 0); + ZEPHIR_CALL_METHOD(&compilation, subCompiler, "compile", NULL, 0, finalPath, _1$$5); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_2$$6, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(compilation); + zephir_file_get_contents(compilation, _2$$6 TSRMLS_CC); } + RETURN_CCTOR(compilation); } + } + ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", &_3, 365, pathExpr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(params); + if (!(zephir_array_isset_string_fetch(¶ms, statement, SS("params"), 0 TSRMLS_CC))) { + ZEPHIR_CONCAT_SVS(return_value, "partial(", path, "); ?>"); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_4, this_ptr, "expression", &_3, 365, params); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVS(return_value, "partial(", path, ", ", _4, "); ?>"); + RETURN_MM(); - smart_str_0(&error_str); +} - if (error_str.s) { - status->syntax_error = estrndup(ZSTR_VAL(error_str.s), ZSTR_LEN(error_str.s)); - status->syntax_error_len = ZSTR_LEN(error_str.s); +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) { + + HashTable *_6$$6; + HashPosition _5$$6; + zephir_fcall_cache_entry *_13 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL, *code = NULL, *name = NULL, *defaultValue = NULL, *macroName = NULL, *parameters = NULL, *position = NULL, *parameter = NULL, *variableName = NULL, *blockStatements = NULL, *_0, *_19, *_1$$4, *_2$$4, *_3$$5, *_4$$6, **_7$$6, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_14$$8 = NULL, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$10, *_18$$10; + zval *statement = NULL; + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &statement_param, &extendsMode_param); + + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); + + + ZEPHIR_OBS_VAR(name); + if (!(zephir_array_isset_string_fetch(&name, statement, SS("name"), 0 TSRMLS_CC))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1860); + return; + } + _0 = zephir_fetch_nproperty_this(this_ptr, SL("_macros"), PH_NOISY_CC); + if (zephir_array_isset(_0, name)) { + ZEPHIR_INIT_VAR(_1$$4); + object_init_ex(_1$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_2$$4); + ZEPHIR_CONCAT_SVS(_2$$4, "Macro '", name, "' is already defined"); + ZEPHIR_CALL_METHOD(NULL, _1$$4, "__construct", NULL, 9, _2$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_1$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 1867 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_array(this_ptr, SL("_macros"), name, name TSRMLS_CC); + ZEPHIR_INIT_VAR(macroName); + ZEPHIR_CONCAT_SVS(macroName, "$this->_macros['", name, "']"); + ZEPHIR_INIT_VAR(code); + ZVAL_STRING(code, ""); + zephir_concat_self(&code, _3$$5 TSRMLS_CC); + } else { + ZEPHIR_INIT_VAR(_4$$6); + ZEPHIR_CONCAT_VS(_4$$6, macroName, " = function($__p = null) { "); + zephir_concat_self(&code, _4$$6 TSRMLS_CC); + zephir_is_iterable(parameters, &_6$$6, &_5$$6, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 1905); + for ( + ; zephir_hash_get_current_data_ex(_6$$6, (void**) &_7$$6, &_5$$6) == SUCCESS + ; zephir_hash_move_forward_ex(_6$$6, &_5$$6) + ) { + ZEPHIR_GET_HMKEY(position, _6$$6, _5$$6); + ZEPHIR_GET_HVALUE(parameter, _7$$6); + ZEPHIR_OBS_NVAR(variableName); + zephir_array_fetch_string(&variableName, parameter, SL("variable"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 1889 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_8$$7); + ZEPHIR_CONCAT_SVS(_8$$7, "if (isset($__p[", position, "])) { "); + zephir_concat_self(&code, _8$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_9$$7); + ZEPHIR_CONCAT_SVSVS(_9$$7, "$", variableName, " = $__p[", position, "];"); + zephir_concat_self(&code, _9$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_10$$7); + ZEPHIR_CONCAT_SVS(_10$$7, "if (isset($__p[\"", variableName, "\"])) { "); + zephir_concat_self(&code, _10$$7 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_11$$7); + ZEPHIR_CONCAT_SVSVS(_11$$7, "$", variableName, " = $__p[\"", variableName, "\"];"); + zephir_concat_self(&code, _11$$7 TSRMLS_CC); + zephir_concat_self_str(&code, SL(" } else { ") TSRMLS_CC); + ZEPHIR_OBS_NVAR(defaultValue); + if (zephir_array_isset_string_fetch(&defaultValue, parameter, SS("default"), 0 TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(&_12$$8, this_ptr, "expression", &_13, 365, defaultValue); + zephir_check_call_status(); + ZEPHIR_INIT_LNVAR(_14$$8); + ZEPHIR_CONCAT_SVSVS(_14$$8, "$", variableName, " = ", _12$$8, ";"); + zephir_concat_self(&code, _14$$8 TSRMLS_CC); + } else { + ZEPHIR_INIT_LNVAR(_15$$9); + ZEPHIR_CONCAT_SVSVS(_15$$9, " throw new \\Phalcon\\Mvc\\View\\Exception(\"Macro '", name, "' was called without parameter: ", variableName, "\"); "); + zephir_concat_self(&code, _15$$9 TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" } } ") TSRMLS_CC); + } + zephir_concat_self_str(&code, SL(" ?>") TSRMLS_CC); + } + ZEPHIR_OBS_VAR(blockStatements); + if (zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_17$$10); + if (extendsMode) { + ZVAL_BOOL(_17$$10, 1); } else { - status->syntax_error = NULL; + ZVAL_BOOL(_17$$10, 0); } + ZEPHIR_CALL_METHOD(&_16$$10, this_ptr, "_statementlist", NULL, 370, blockStatements, _17$$10); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(_18$$10); + ZEPHIR_CONCAT_VS(_18$$10, _16$$10, ""); + zephir_concat_self(&code, _19 TSRMLS_CC); + RETURN_CCTOR(code); - status->status = PHVOLT_PARSING_FAILED; - -// 2763 "parser.php7.c" - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -static void vv_accept( - vvParser *vvpParser /* The parser */ -){ - phvolt_ARG_FETCH; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); - } -#endif - while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phvolt_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phvolt_( - void *vvp, /* The parser */ - int vvmajor, /* The major token code number */ - phvolt_TOKENTYPE vvminor /* The value for the token */ - phvolt_ARG_PDECL /* Optional %extra_argument parameter */ -){ - VVMINORTYPE vvminorunion; - int vvact; /* The parser action. */ - int vvendofinput; /* True if we are at the end of input */ - int vverrorhit = 0; /* True if vvmajor has invoked an error */ - vvParser *vvpParser; /* The parser */ +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileCall) { - /* (re)initialize the parser, if necessary */ - vvpParser = (vvParser*)vvp; - if( vvpParser->vvidx<0 ){ - if( vvmajor==0 ) return; - vvpParser->vvidx = 0; - vvpParser->vverrcnt = -1; - vvpParser->vvstack[0].stateno = 0; - vvpParser->vvstack[0].major = 0; - } - vvminorunion.vv0 = vvminor; - vvendofinput = (vvmajor==0); - phvolt_ARG_STORE; + zend_bool extendsMode; + zval *statement_param = NULL, *extendsMode_param = NULL; + zval *statement = NULL; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); - } -#endif + zephir_fetch_params(0, 2, 0, &statement_param, &extendsMode_param); - do{ - vvact = vv_find_shift_action(vvpParser,vvmajor); - if( vvactvverrcnt--; - if( vvendofinput && vvpParser->vvidx>=0 ){ - vvmajor = 0; - }else{ - vvmajor = VVNOCODE; - } - }else if( vvact < VVNSTATE + VVNRULE ){ - vv_reduce(vvpParser,vvact-VVNSTATE); - }else if( vvact == VV_ERROR_ACTION ){ - int vvmx; -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); - } -#endif -#ifdef VVERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( vvpParser->vverrcnt<0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvmx = vvpParser->vvstack[vvpParser->vvidx].major; - if( vvmx==VVERRORSYMBOL || vverrorhit ){ -#ifndef NDEBUG - if( vvTraceFILE ){ - fprintf(vvTraceFILE,"%sDiscard input token %s\n", - vvTracePrompt,vvTokenName[vvmajor]); - } -#endif - vv_destructor(vvmajor,&vvminorunion); - vvmajor = VVNOCODE; - }else{ - while( - vvpParser->vvidx >= 0 && - vvmx != VVERRORSYMBOL && - (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE - ){ - vv_pop_parser_stack(vvpParser); - } - if( vvpParser->vvidx < 0 || vvmajor==0 ){ - vv_destructor(vvmajor,&vvminorunion); - vv_parse_failed(vvpParser); - vvmajor = VVNOCODE; - }else if( vvmx!=VVERRORSYMBOL ){ - VVMINORTYPE u2; - u2.VVERRSYMDT = 0; - vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); - } - } - vvpParser->vverrcnt = 3; - vverrorhit = 1; -#else /* VVERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( vvpParser->vverrcnt<=0 ){ - vv_syntax_error(vvpParser,vvmajor,vvminorunion); - } - vvpParser->vverrcnt = 3; - vv_destructor(vvmajor,&vvminorunion); - if( vvendofinput ){ - vv_parse_failed(vvpParser); - } - vvmajor = VVNOCODE; -#endif - }else{ - vv_accept(vvpParser); - vvmajor = VVNOCODE; - } - }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); - return; -} -#endif + statement = statement_param; + extendsMode = zephir_get_boolval(extendsMode_param); -const phvolt_token_names phvolt_tokens[] = -{ - { SL("INTEGER"), PHVOLT_T_INTEGER }, - { SL("DOUBLE"), PHVOLT_T_DOUBLE }, - { SL("STRING"), PHVOLT_T_STRING }, - { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, - { SL("MINUS"), PHVOLT_T_MINUS }, - { SL("+"), PHVOLT_T_ADD }, - { SL("-"), PHVOLT_T_SUB }, - { SL("*"), PHVOLT_T_MUL }, - { SL("/"), PHVOLT_T_DIV }, - { SL("%%"), PHVOLT_T_MOD }, - { SL("!"), PHVOLT_T_NOT }, - { SL("~"), PHVOLT_T_CONCAT }, - { SL("AND"), PHVOLT_T_AND }, - { SL("OR"), PHVOLT_T_OR }, - { SL("DOT"), PHVOLT_T_DOT }, - { SL("COMMA"), PHVOLT_T_COMMA }, - { SL("EQUALS"), PHVOLT_T_EQUALS }, - { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, - { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, - { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, - { SL("NOT"), PHVOLT_T_NOT }, - { SL("RANGE"), PHVOLT_T_RANGE }, - { SL("COLON"), PHVOLT_T_COLON }, - { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, - { SL("<"), PHVOLT_T_LESS }, - { SL("<="), PHVOLT_T_LESSEQUAL }, - { SL(">"), PHVOLT_T_GREATER }, - { SL(">="), PHVOLT_T_GREATEREQUAL }, - { SL("("), PHVOLT_T_PARENTHESES_OPEN }, - { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, - { SL("["), PHVOLT_T_SBRACKET_OPEN }, - { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, - { SL("{"), PHVOLT_T_CBRACKET_OPEN }, - { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, - { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, - { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, - { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, - { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, - { SL("IF"), PHVOLT_T_IF }, - { SL("ELSE"), PHVOLT_T_ELSE }, - { SL("ELSEIF"), PHVOLT_T_ELSEIF }, - { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, - { SL("ENDIF"), PHVOLT_T_ENDIF }, - { SL("FOR"), PHVOLT_T_FOR }, - { SL("IN"), PHVOLT_T_IN }, - { SL("ENDFOR"), PHVOLT_T_ENDFOR }, - { SL("SET"), PHVOLT_T_SET }, - { SL("ASSIGN"), PHVOLT_T_ASSIGN }, - { SL("+="), PHVOLT_T_ADD_ASSIGN }, - { SL("-="), PHVOLT_T_SUB_ASSIGN }, - { SL("*="), PHVOLT_T_MUL_ASSIGN }, - { SL("/="), PHVOLT_T_DIV_ASSIGN }, - { SL("++"), PHVOLT_T_INCR }, - { SL("--"), PHVOLT_T_DECR }, - { SL("BLOCK"), PHVOLT_T_BLOCK }, - { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, - { SL("CACHE"), PHVOLT_T_CACHE }, - { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, - { SL("EXTENDS"), PHVOLT_T_EXTENDS }, - { SL("IS"), PHVOLT_T_IS }, - { SL("DEFINED"), PHVOLT_T_DEFINED }, - { SL("EMPTY"), PHVOLT_T_EMPTY }, - { SL("EVEN"), PHVOLT_T_EVEN }, - { SL("ODD"), PHVOLT_T_ODD }, - { SL("NUMERIC"), PHVOLT_T_NUMERIC }, - { SL("SCALAR"), PHVOLT_T_SCALAR }, - { SL("ITERABLE"), PHVOLT_T_ITERABLE }, - { SL("INCLUDE"), PHVOLT_T_INCLUDE }, - { SL("DO"), PHVOLT_T_DO }, - { SL("WHITESPACE"), PHVOLT_T_IGNORE }, - { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, - { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, - { SL("CONTINUE"), PHVOLT_T_CONTINUE }, - { SL("BREAK"), PHVOLT_T_BREAK }, - { SL("WITH"), PHVOLT_T_WITH }, - { SL("RETURN"), PHVOLT_T_RETURN }, - { SL("MACRO"), PHVOLT_T_MACRO }, - { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, - { SL("CALL"), PHVOLT_T_CALL }, - { SL("WITH"), PHVOLT_T_WITH }, - { NULL, 0, 0 } -}; -static void *phvolt_wrapper_alloc(size_t bytes){ - return emalloc(bytes); } -static void phvolt_wrapper_free(void *pointer){ - efree(pointer); -} +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _statementList) { -static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + HashTable *_2; + HashPosition _1; + zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_15 = NULL, *_17 = NULL, *_20 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_32 = NULL, *_35 = NULL, *_37 = NULL, *_39 = NULL, *_42 = NULL, *_44 = NULL, *_47 = NULL, *_50 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode, _0; + zval *statements_param = NULL, *extendsMode_param = NULL, *extended = NULL, *blockMode = NULL, *compilation = NULL, *extensions = NULL, *statement = NULL, *tempCompilation = NULL, *type = NULL, *blockName = NULL, *blockStatements = NULL, *blocks = NULL, *path = NULL, *finalPath = NULL, *subCompiler = NULL, *level = NULL, **_3, *_4$$7 = NULL, *_5$$7, *_6$$7, *_7$$7 = NULL, *_10$$8 = NULL, *_12$$10, *_13$$11 = NULL, *_14$$11 = NULL, *_16$$12 = NULL, *_18$$13 = NULL, *_19$$13 = NULL, *_21$$14 = NULL, *_23$$15 = NULL, *_25$$21 = NULL, *_26$$21 = NULL, *_28$$22, *_30$$23 = NULL, *_31$$24 = NULL, *_33$$25 = NULL, *_34$$25 = NULL, *_36$$26 = NULL, *_38$$27 = NULL, *_40$$28 = NULL, *_41$$28 = NULL, *_43$$31 = NULL, *_45$$32 = NULL, *_46$$32 = NULL, *_48$$33 = NULL, *_49$$33 = NULL, *_51$$35 = NULL, *_52$$35, *_53$$35, *_54$$35 = NULL; + zval *statements = NULL, *_9$$8 = NULL; - phvolt_parser_token *pToken; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statements_param, &extendsMode_param); - pToken = emalloc(sizeof(phvolt_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; + statements = statements_param; + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - phvolt_(phvolt_parser, parsercode, pToken, parser_status); - token->value = NULL; - token->len = 0; -} + if (!(zephir_fast_count_int(statements TSRMLS_CC))) { + RETURN_MM_STRING("", 1); + } + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + _0 = zephir_is_true(extended); + if (!(_0)) { + _0 = extendsMode; + } + ZEPHIR_INIT_VAR(blockMode); + ZVAL_BOOL(blockMode, _0); + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_level") TSRMLS_CC)); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(extensions); + zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); + zephir_is_iterable(statements, &_2, &_1, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2172); + for ( + ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS + ; zephir_hash_move_forward_ex(_2, &_1) + ) { + ZEPHIR_GET_HVALUE(statement, _3); + if (Z_TYPE_P(statement) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/mvc/view/engine/volt/compiler.zep", 1977); + return; + } + if (!(zephir_array_isset_string(statement, SS("type")))) { + ZEPHIR_INIT_NVAR(_4$$7); + object_init_ex(_4$$7, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_5$$7, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + zephir_array_fetch_string(&_6$$7, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_7$$7); + ZEPHIR_CONCAT_SVSV(_7$$7, "Invalid statement in ", _5$$7, " on line ", _6$$7); + ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", &_8, 9, _7$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(_4$$7, "phalcon/mvc/view/engine/volt/compiler.zep", 1984 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(extensions) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_9$$8); + zephir_create_array(_9$$8, 1, 0 TSRMLS_CC); + zephir_array_fast_append(_9$$8, statement); + ZEPHIR_INIT_NVAR(_10$$8); + ZVAL_STRING(_10$$8, "compileStatement", ZEPHIR_TEMP_PARAM_COPY); + ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 366, _10$$8, _9$$8); + zephir_check_temp_parameter(_10$$8); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_STRING) { + zephir_concat_self(&compilation, tempCompilation TSRMLS_CC); + continue; + } + } + ZEPHIR_OBS_NVAR(type); + zephir_array_fetch_string(&type, statement, SL("type"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2005 TSRMLS_CC); + do { + if (ZEPHIR_IS_LONG(type, 357)) { + zephir_array_fetch_string(&_12$$10, statement, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2013 TSRMLS_CC); + zephir_concat_self(&compilation, _12$$10 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 300)) { + ZEPHIR_INIT_NVAR(_14$$11); + if (extendsMode) { + ZVAL_BOOL(_14$$11, 1); + } else { + ZVAL_BOOL(_14$$11, 0); + } + ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "compileif", &_15, 0, statement, _14$$11); + zephir_check_call_status(); + zephir_concat_self(&compilation, _13$$11 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 302)) { + ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "compileelseif", &_17, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _16$$12 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 304)) { + ZEPHIR_INIT_NVAR(_19$$13); + if (extendsMode) { + ZVAL_BOOL(_19$$13, 1); + } else { + ZVAL_BOOL(_19$$13, 0); + } + ZEPHIR_CALL_METHOD(&_18$$13, this_ptr, "compileforeach", &_20, 0, statement, _19$$13); + zephir_check_call_status(); + zephir_concat_self(&compilation, _18$$13 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 306)) { + ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "compileset", &_22, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _21$$14 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 359)) { + ZEPHIR_CALL_METHOD(&_23$$15, this_ptr, "compileecho", &_24, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _23$$15 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 307)) { + ZEPHIR_OBS_NVAR(blockName); + zephir_array_fetch_string(&blockName, statement, SL("name"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2041 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blockStatements); + zephir_array_isset_string_fetch(&blockStatements, statement, SS("block_statements"), 0 TSRMLS_CC); + ZEPHIR_OBS_NVAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + if (zephir_is_true(blockMode)) { + if (Z_TYPE_P(blocks) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(blocks); + array_init(blocks); + } + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_array_append(&blocks, compilation, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2056); + ZEPHIR_INIT_NVAR(compilation); + ZVAL_NULL(compilation); + } + zephir_array_update_zval(&blocks, blockName, &blockStatements, PH_COPY | PH_SEPARATE); + zephir_update_property_this(this_ptr, SL("_blocks"), blocks TSRMLS_CC); + } else { + if (Z_TYPE_P(blockStatements) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(_26$$21); + if (extendsMode) { + ZVAL_BOOL(_26$$21, 1); + } else { + ZVAL_BOOL(_26$$21, 0); + } + ZEPHIR_CALL_METHOD(&_25$$21, this_ptr, "_statementlist", &_27, 370, blockStatements, _26$$21); + zephir_check_call_status(); + zephir_concat_self(&compilation, _25$$21 TSRMLS_CC); + } + } + break; + } + if (ZEPHIR_IS_LONG(type, 310)) { + ZEPHIR_OBS_NVAR(path); + zephir_array_fetch_string(&path, statement, SL("path"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2078 TSRMLS_CC); + zephir_array_fetch_string(&_28$$22, path, SL("value"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2080 TSRMLS_CC); + ZEPHIR_CALL_METHOD(&finalPath, this_ptr, "getfinalpath", &_29, 0, _28$$22); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(extended); + ZVAL_BOOL(extended, 1); + ZEPHIR_INIT_NVAR(subCompiler); + if (zephir_clone(subCompiler, this_ptr TSRMLS_CC) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&tempCompilation, subCompiler, "compile", NULL, 0, finalPath, extended); + zephir_check_call_status(); + if (Z_TYPE_P(tempCompilation) == IS_NULL) { + ZEPHIR_CALL_METHOD(&_30$$23, subCompiler, "getcompiledtemplatepath", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(tempCompilation); + zephir_file_get_contents(tempCompilation, _30$$23 TSRMLS_CC); + } + if (1) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), tempCompilation TSRMLS_CC); + ZEPHIR_CPY_WRT(blockMode, extended); + break; + } + if (ZEPHIR_IS_LONG(type, 313)) { + ZEPHIR_CALL_METHOD(&_31$$24, this_ptr, "compileinclude", &_32, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _31$$24 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 314)) { + ZEPHIR_INIT_NVAR(_34$$25); + if (extendsMode) { + ZVAL_BOOL(_34$$25, 1); + } else { + ZVAL_BOOL(_34$$25, 0); + } + ZEPHIR_CALL_METHOD(&_33$$25, this_ptr, "compilecache", &_35, 0, statement, _34$$25); + zephir_check_call_status(); + zephir_concat_self(&compilation, _33$$25 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 316)) { + ZEPHIR_CALL_METHOD(&_36$$26, this_ptr, "compiledo", &_37, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _36$$26 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 327)) { + ZEPHIR_CALL_METHOD(&_38$$27, this_ptr, "compilereturn", &_39, 0, statement); + zephir_check_call_status(); + zephir_concat_self(&compilation, _38$$27 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 317)) { + ZEPHIR_INIT_NVAR(_41$$28); + if (extendsMode) { + ZVAL_BOOL(_41$$28, 1); + } else { + ZVAL_BOOL(_41$$28, 0); + } + ZEPHIR_CALL_METHOD(&_40$$28, this_ptr, "compileautoescape", &_42, 0, statement, _41$$28); + zephir_check_call_status(); + zephir_concat_self(&compilation, _40$$28 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 319)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 320)) { + zephir_concat_self_str(&compilation, SL("") TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 321)) { + ZEPHIR_CALL_METHOD(&_43$$31, this_ptr, "compileforelse", &_44, 0); + zephir_check_call_status(); + zephir_concat_self(&compilation, _43$$31 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 322)) { + ZEPHIR_INIT_NVAR(_46$$32); + if (extendsMode) { + ZVAL_BOOL(_46$$32, 1); + } else { + ZVAL_BOOL(_46$$32, 0); + } + ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "compilemacro", &_47, 0, statement, _46$$32); + zephir_check_call_status(); + zephir_concat_self(&compilation, _45$$32 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 325)) { + ZEPHIR_INIT_NVAR(_49$$33); + if (extendsMode) { + ZVAL_BOOL(_49$$33, 1); + } else { + ZVAL_BOOL(_49$$33, 0); + } + ZEPHIR_CALL_METHOD(&_48$$33, this_ptr, "compilecall", &_50, 0, statement, _49$$33); + zephir_check_call_status(); + zephir_concat_self(&compilation, _48$$33 TSRMLS_CC); + break; + } + if (ZEPHIR_IS_LONG(type, 358)) { + break; + } + ZEPHIR_INIT_NVAR(_51$$35); + object_init_ex(_51$$35, phalcon_mvc_view_engine_volt_exception_ce); + zephir_array_fetch_string(&_52$$35, statement, SL("file"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + zephir_array_fetch_string(&_53$$35, statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_INIT_LNVAR(_54$$35); + ZEPHIR_CONCAT_SVSVSV(_54$$35, "Unknown statement ", type, " in ", _52$$35, " on line ", _53$$35); + ZEPHIR_CALL_METHOD(NULL, _51$$35, "__construct", &_8, 9, _54$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(_51$$35, "phalcon/mvc/view/engine/volt/compiler.zep", 2164 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } while(0); -static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + } + if (ZEPHIR_IS_TRUE_IDENTICAL(blockMode)) { + level = zephir_fetch_nproperty_this(this_ptr, SL("_blockLevel"), PH_NOISY_CC); + if (ZEPHIR_IS_LONG(level, 1)) { + if (Z_TYPE_P(compilation) != IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("_blocks"), compilation TSRMLS_CC); + } + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_blockLevel") TSRMLS_CC)); + } + RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_level") TSRMLS_CC)); + RETURN_CCTOR(compilation); - unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); - char *str = emalloc(sizeof(char) * length); +} - snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); - str[length - 1] = '\0'; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource) { - parser_status->syntax_error = estrndup(str, strlen(str)); - efree(str); -} + HashTable *_3$$7; + HashPosition _2$$7; + zephir_fcall_cache_entry *_1 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *currentPath = NULL, *intermediate = NULL, *extended = NULL, *finalCompilation = NULL, *blocks = NULL, *extendedBlocks = NULL, *name = NULL, *block = NULL, *blockCompilation = NULL, *localBlock = NULL, *compilation = NULL, *options = NULL, *autoescape = NULL, *_0, **_4$$7; + zval *viewCode = NULL; -static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - char *error, *error_part; - int length; - phvolt_scanner_state *state = parser_status->scanner_state; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); -#else - ZVAL_NULL(*error_msg); -#endif - if (state->start) { - error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); - if (state->start_length > 16) { - length = 72 + Z_STRLEN_P(state->active_file); - error_part = estrndup(state->start, 16); - snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); - error[length - 1] = '\0'; - efree(error_part); + ZEPHIR_OBS_VAR(currentPath); + zephir_read_property_this(¤tPath, this_ptr, SL("_currentPath"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + ZEPHIR_OBS_VAR(autoescape); + if (zephir_array_isset_string_fetch(&autoescape, options, SS("autoescape"), 0 TSRMLS_CC)) { + if (Z_TYPE_P(autoescape) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'autoescape' must be boolean", "phalcon/mvc/view/engine/volt/compiler.zep", 2209); + return; + } + zephir_update_property_this(this_ptr, SL("_autoescape"), autoescape TSRMLS_CC); + } + } + ZEPHIR_INIT_VAR(intermediate); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(intermediate, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + if (Z_TYPE_P(intermediate) != IS_ARRAY) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Invalid intermediate representation", "phalcon/mvc/view/engine/volt/compiler.zep", 2221); + return; + } + ZEPHIR_INIT_VAR(_0); + if (extendsMode) { + ZVAL_BOOL(_0, 1); + } else { + ZVAL_BOOL(_0, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_statementlist", &_1, 370, intermediate, _0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(extended); + zephir_read_property_this(&extended, this_ptr, SL("_extended"), PH_NOISY_CC); + if (ZEPHIR_IS_TRUE_IDENTICAL(extended)) { + ZEPHIR_INIT_VAR(finalCompilation); + if (extendsMode == 1) { + array_init(finalCompilation); } else { - length = 48 + state->start_length + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + ZVAL_NULL(finalCompilation); + } + ZEPHIR_OBS_VAR(blocks); + zephir_read_property_this(&blocks, this_ptr, SL("_blocks"), PH_NOISY_CC); + ZEPHIR_OBS_VAR(extendedBlocks); + zephir_read_property_this(&extendedBlocks, this_ptr, SL("_extendedBlocks"), PH_NOISY_CC); + zephir_is_iterable(extendedBlocks, &_3$$7, &_2$$7, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2287); + for ( + ; zephir_hash_get_current_data_ex(_3$$7, (void**) &_4$$7, &_2$$7) == SUCCESS + ; zephir_hash_move_forward_ex(_3$$7, &_2$$7) + ) { + ZEPHIR_GET_HMKEY(name, _3$$7, _2$$7); + ZEPHIR_GET_HVALUE(block, _4$$7); + if (Z_TYPE_P(name) == IS_STRING) { + if (zephir_array_isset(blocks, name)) { + ZEPHIR_OBS_NVAR(localBlock); + zephir_array_fetch(&localBlock, blocks, name, PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2255 TSRMLS_CC); + zephir_update_property_this(this_ptr, SL("_currentBlock"), name TSRMLS_CC); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, localBlock); + zephir_check_call_status(); + } else { + if (Z_TYPE_P(block) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "_statementlist", &_1, 370, block); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(blockCompilation, block); + } + } + if (extendsMode == 1) { + zephir_array_update_zval(&finalCompilation, name, &blockCompilation, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self(&finalCompilation, blockCompilation TSRMLS_CC); + } + } else { + if (extendsMode == 1) { + zephir_array_append(&finalCompilation, block, PH_SEPARATE, "phalcon/mvc/view/engine/volt/compiler.zep", 2280); + } else { + zephir_concat_self(&finalCompilation, block TSRMLS_CC); + } + } } - } else { - error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); - length = 32 + Z_STRLEN_P(state->active_file); - snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + RETURN_CCTOR(finalCompilation); } + if (extendsMode == 1) { + RETURN_MM_MEMBER(this_ptr, "_blocks"); + } + RETURN_CCTOR(compilation); - error[length - 1] = '\0'; -#if PHP_VERSION_ID < 70000 - ZVAL_STRING(*error_msg, error, 1); -#else - ZVAL_STRING(*error_msg, error); -#endif - - efree(error); } -static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ - -#if PHP_VERSION_ID < 70000 - zval *error_msg = NULL; -#else - zval em, *error_msg = &em; -#endif +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString) { - ZVAL_NULL(result); + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *viewCode_param = NULL, *extendsMode_param = NULL, *_0, *_1; + zval *viewCode = NULL; -#if PHP_VERSION_ID >= 70000 - ZVAL_NULL(error_msg); -#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &viewCode_param, &extendsMode_param); - if (Z_TYPE_P(view_code) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); - return FAILURE; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { - ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); -#if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&error_msg); -#else - zval_dtor(error_msg); -#endif - return FAILURE; + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - return SUCCESS; -} - -static int phvolt_is_blank_string(phvolt_scanner_token *token){ - - char *marker = token->value; - unsigned int ch, i; - for (i = 0; i < token->len; i++) { - ch = *marker; - if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { - return 0; - } - marker++; + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_STRING(_0, "eval code", 1); + zephir_update_property_this(this_ptr, SL("_currentPath"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(_1); + if (extendsMode) { + ZVAL_BOOL(_1, 1); + } else { + ZVAL_BOOL(_1, 0); } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_compilesource", NULL, 0, viewCode, _1); + zephir_check_call_status(); + RETURN_MM(); - return 1; } -static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) { - char *error; - phvolt_scanner_state *state; - phvolt_scanner_token token; - int scanner_status, status = SUCCESS; - phvolt_parser_status *parser_status = NULL; - void* phvolt_parser; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *path_param = NULL, *compiledPath_param = NULL, *extendsMode_param = NULL, *viewCode = NULL, *compilation = NULL, *finalCompilation = NULL, *_4, *_5, *_0$$4, *_2$$5; + zval *path = NULL, *compiledPath = NULL, *_1$$4, *_3$$5; - /** Check if the view has code */ - if (!Z_STRVAL_P(view_code)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "View code cannot be null", 1); -#else - ZVAL_STRING(*error_msg, "View code cannot be null"); -#endif - return FAILURE; - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &path_param, &compiledPath_param, &extendsMode_param); - if (!Z_STRLEN_P(view_code)) { - array_init(*result); - return SUCCESS; + if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); } - - /** Start the reentrant parser */ - phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); - if (unlikely(!phvolt_parser)) { -#if PHP_VERSION_ID < 70000 - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, "Memory allocation error", 1); -#else - ZVAL_STRING(*error_msg, "Memory allocation error"); -#endif - return FAILURE; + if (likely(Z_TYPE_P(path_param) == IS_STRING)) { + zephir_get_strval(path, path_param); + } else { + ZEPHIR_INIT_VAR(path); + ZVAL_EMPTY_STRING(path); + } + if (unlikely(Z_TYPE_P(compiledPath_param) != IS_STRING && Z_TYPE_P(compiledPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'compiledPath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(compiledPath_param) == IS_STRING)) { + zephir_get_strval(compiledPath, compiledPath_param); + } else { + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_EMPTY_STRING(compiledPath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); } - parser_status = emalloc(sizeof(phvolt_parser_status)); - state = emalloc(sizeof(phvolt_scanner_state)); - - parser_status->status = PHVOLT_PARSING_OK; - parser_status->scanner_state = state; -#if PHP_VERSION_ID < 70000 - parser_status->ret = NULL; -#else - ZVAL_UNDEF(&parser_status->ret); -#endif - parser_status->token = &token; - parser_status->syntax_error = NULL; - - /** Initialize the scanner state */ - state->active_token = 0; - state->start = Z_STRVAL_P(view_code); - state->mode = PHVOLT_MODE_RAW; - state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); - state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; - state->raw_buffer_cursor = 0; - state->active_file = template_path; - state->active_line = 1; - state->statement_position = 0; - state->extends_mode = 0; - state->block_level = 0; - state->macro_level = 0; - state->start_length = 0; - state->old_if_level = 0; - state->if_level = 0; - state->for_level = 0; - state->whitespace_control = 0; - state->forced_raw_state = 0; - - state->end = state->start; - - token.value = NULL; - token.len = 0; - - while (0 <= (scanner_status = phvolt_get_token(state, &token))) { - - state->active_token = token.opcode; - - state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); - - switch (token.opcode) { - - case PHVOLT_T_IGNORE: - break; - case PHVOLT_T_ADD: - phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); - break; - case PHVOLT_T_SUB: - phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); - break; - case PHVOLT_T_MUL: - phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); - break; - case PHVOLT_T_DIV: - phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); - break; - case PHVOLT_T_MOD: - phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); - break; - case PHVOLT_T_AND: - phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); - break; - case PHVOLT_T_OR: - phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); - break; - case PHVOLT_T_IS: - phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); - break; - case PHVOLT_T_EQUALS: - phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); - break; - case PHVOLT_T_NOTEQUALS: - phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); - break; - case PHVOLT_T_LESS: - phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); - break; - case PHVOLT_T_GREATER: - phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); - break; - case PHVOLT_T_GREATEREQUAL: - phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); - break; - case PHVOLT_T_LESSEQUAL: - phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); - break; - case PHVOLT_T_IDENTICAL: - phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOTIDENTICAL: - phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); - break; - case PHVOLT_T_NOT: - phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); - break; - case PHVOLT_T_DOT: - phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); - break; - case PHVOLT_T_CONCAT: - phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); - break; - case PHVOLT_T_RANGE: - phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); - break; - case PHVOLT_T_PIPE: - phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); - break; - case PHVOLT_T_COMMA: - phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); - break; - case PHVOLT_T_COLON: - phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); - break; - case PHVOLT_T_QUESTION: - phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); - break; + if (ZEPHIR_IS_EQUAL(path, compiledPath)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Template path and compilation template path cannot be the same", "phalcon/mvc/view/engine/volt/compiler.zep", 2329); + return; + } + if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_0$$4); + object_init_ex(_0$$4, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_1$$4); + ZEPHIR_CONCAT_SVS(_1$$4, "Template file ", path, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _1$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(_0$$4, "phalcon/mvc/view/engine/volt/compiler.zep", 2336 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(viewCode); + zephir_file_get_contents(viewCode, path TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(viewCode)) { + ZEPHIR_INIT_VAR(_2$$5); + object_init_ex(_2$$5, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_3$$5); + ZEPHIR_CONCAT_SVS(_3$$5, "Template file ", path, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _2$$5, "__construct", NULL, 9, _3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(_2$$5, "phalcon/mvc/view/engine/volt/compiler.zep", 2344 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_this(this_ptr, SL("_currentPath"), path TSRMLS_CC); + ZEPHIR_INIT_VAR(_4); + if (extendsMode) { + ZVAL_BOOL(_4, 1); + } else { + ZVAL_BOOL(_4, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "_compilesource", NULL, 0, viewCode, _4); + zephir_check_call_status(); + if (Z_TYPE_P(compilation) == IS_ARRAY) { + ZEPHIR_CALL_FUNCTION(&finalCompilation, "serialize", NULL, 65, compilation); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(finalCompilation, compilation); + } + ZEPHIR_INIT_VAR(_5); + zephir_file_put_contents(_5, compiledPath, finalCompilation TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(_5)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Volt directory can't be written", "phalcon/mvc/view/engine/volt/compiler.zep", 2364); + return; + } + RETURN_CCTOR(compilation); - case PHVOLT_T_PARENTHESES_OPEN: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHVOLT_T_PARENTHESES_CLOSE: - phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_SBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_OPEN: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); - break; - case PHVOLT_T_CBRACKET_CLOSE: - phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); - break; +} - case PHVOLT_T_OPEN_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_DELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compile) { - case PHVOLT_T_OPEN_EDELIMITER: - if (state->extends_mode == 1 && state->block_level == 0) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); - break; - case PHVOLT_T_CLOSE_EDELIMITER: - phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); - break; + zval *_2$$23; + zephir_fcall_cache_entry *_5 = NULL; + int ZEPHIR_LAST_CALL_STATUS; + zend_bool extendsMode; + zval *templatePath_param = NULL, *extendsMode_param = NULL, *stat = NULL, *compileAlways = NULL, *prefix = NULL, *compiledPath = NULL, *compiledSeparator = NULL, *blocksCode = NULL, *compiledExtension = NULL, *compilation = NULL, *options = NULL, *realCompiledPath = NULL, *compiledTemplatePath = NULL, *templateSepPath = NULL, *_0, *_1$$17 = NULL, *_3$$23, *_4$$26, *_6$$29, *_7$$30, *_8$$33, *_9$$33, *_10$$36, *_11$$38, *_12$$38; + zval *templatePath = NULL; - case PHVOLT_T_NULL: - phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); - break; - case PHVOLT_T_TRUE: - phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); - break; - case PHVOLT_T_FALSE: - phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &templatePath_param, &extendsMode_param); - case PHVOLT_T_INTEGER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); - break; - case PHVOLT_T_DOUBLE: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); - break; - case PHVOLT_T_STRING: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); - break; - case PHVOLT_T_IDENTIFIER: - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); - break; + if (unlikely(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(templatePath_param) == IS_STRING)) { + zephir_get_strval(templatePath, templatePath_param); + } else { + ZEPHIR_INIT_VAR(templatePath); + ZVAL_EMPTY_STRING(templatePath); + } + if (!extendsMode_param) { + extendsMode = 0; + } else { + extendsMode = zephir_get_boolval(extendsMode_param); + } - case PHVOLT_T_IF: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->if_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); - break; - case PHVOLT_T_ELSE: - if (state->if_level == 0 && state->for_level > 0) { - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - } else { - phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + if (0) { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extended"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + if (0) { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); + } else { + zephir_update_property_this(this_ptr, SL("_extendedBlocks"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); + } + zephir_update_property_this(this_ptr, SL("_blocks"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_level"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_foreachLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_blockLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(_0, 0); + zephir_update_property_this(this_ptr, SL("_exprLevel"), _0 TSRMLS_CC); + ZEPHIR_INIT_VAR(stat); + ZVAL_BOOL(stat, 1); + ZEPHIR_INIT_VAR(compileAlways); + ZVAL_BOOL(compileAlways, 0); + ZEPHIR_INIT_VAR(compiledPath); + ZVAL_STRING(compiledPath, "", 1); + ZEPHIR_INIT_VAR(prefix); + ZVAL_NULL(prefix); + ZEPHIR_INIT_VAR(compiledSeparator); + ZVAL_STRING(compiledSeparator, "%%", 1); + ZEPHIR_INIT_VAR(compiledExtension); + ZVAL_STRING(compiledExtension, ".php", 1); + ZEPHIR_INIT_VAR(compilation); + ZVAL_NULL(compilation); + ZEPHIR_OBS_VAR(options); + zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); + if (Z_TYPE_P(options) == IS_ARRAY) { + if (zephir_array_isset_string(options, SS("compileAlways"))) { + ZEPHIR_OBS_NVAR(compileAlways); + zephir_array_fetch_string(&compileAlways, options, SL("compileAlways"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2412 TSRMLS_CC); + if (Z_TYPE_P(compileAlways) != IS_BOOL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compileAlways' must be a bool value", "phalcon/mvc/view/engine/volt/compiler.zep", 2414); + return; + } + } + if (zephir_array_isset_string(options, SS("prefix"))) { + ZEPHIR_OBS_NVAR(prefix); + zephir_array_fetch_string(&prefix, options, SL("prefix"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2422 TSRMLS_CC); + if (Z_TYPE_P(prefix) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'prefix' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2424); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledPath"))) { + ZEPHIR_OBS_NVAR(compiledPath); + zephir_array_fetch_string(&compiledPath, options, SL("compiledPath"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2432 TSRMLS_CC); + if (Z_TYPE_P(compiledPath) != IS_STRING) { + if (Z_TYPE_P(compiledPath) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledPath' must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2435); + return; } - break; - - case PHVOLT_T_ELSEFOR: - phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); - break; - - case PHVOLT_T_ELSEIF: - if (state->if_level == 0) { - phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } + } + if (zephir_array_isset_string(options, SS("compiledSeparator"))) { + ZEPHIR_OBS_NVAR(compiledSeparator); + zephir_array_fetch_string(&compiledSeparator, options, SL("compiledSeparator"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2444 TSRMLS_CC); + if (Z_TYPE_P(compiledSeparator) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledSeparator' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2446); + return; + } + } + if (zephir_array_isset_string(options, SS("compiledExtension"))) { + ZEPHIR_OBS_NVAR(compiledExtension); + zephir_array_fetch_string(&compiledExtension, options, SL("compiledExtension"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2454 TSRMLS_CC); + if (Z_TYPE_P(compiledExtension) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "'compiledExtension' must be a string", "phalcon/mvc/view/engine/volt/compiler.zep", 2456); + return; + } + } + if (zephir_array_isset_string(options, SS("stat"))) { + ZEPHIR_OBS_NVAR(stat); + zephir_array_fetch_string(&stat, options, SL("stat"), PH_NOISY, "phalcon/mvc/view/engine/volt/compiler.zep", 2464 TSRMLS_CC); + } + } + if (Z_TYPE_P(compiledPath) == IS_STRING) { + if (!(ZEPHIR_IS_EMPTY(compiledPath))) { + ZEPHIR_CALL_FUNCTION(&_1$$17, "realpath", NULL, 64, templatePath); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(templateSepPath); + zephir_prepare_virtual_path(templateSepPath, _1$$17, compiledSeparator TSRMLS_CC); + } else { + ZEPHIR_CPY_WRT(templateSepPath, templatePath); + } + ZEPHIR_INIT_VAR(compiledTemplatePath); + if (extendsMode == 1) { + ZEPHIR_CONCAT_VVVVSVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledSeparator, "e", compiledSeparator, compiledExtension); + } else { + ZEPHIR_CONCAT_VVVV(compiledTemplatePath, compiledPath, prefix, templateSepPath, compiledExtension); + } + } else { + if (Z_TYPE_P(compiledPath) == IS_OBJECT) { + if (zephir_instance_of_ev(compiledPath, zend_ce_closure TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_2$$23); + zephir_create_array(_2$$23, 3, 0 TSRMLS_CC); + zephir_array_fast_append(_2$$23, templatePath); + zephir_array_fast_append(_2$$23, options); + ZEPHIR_INIT_VAR(_3$$23); + ZVAL_BOOL(_3$$23, extendsMode); + zephir_array_fast_append(_2$$23, _3$$23); + ZEPHIR_INIT_NVAR(compiledTemplatePath); + ZEPHIR_CALL_USER_FUNC_ARRAY(compiledTemplatePath, compiledPath, _2$$23); + zephir_check_call_status(); + if (Z_TYPE_P(compiledTemplatePath) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath closure didn't return a valid string", "phalcon/mvc/view/engine/volt/compiler.zep", 2509); + return; } - phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); - break; - - case PHVOLT_T_ENDIF: - state->block_level--; - state->if_level--; - phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); - break; - - case PHVOLT_T_FOR: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; + } else { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "compiledPath must be a string or a closure", "phalcon/mvc/view/engine/volt/compiler.zep", 2512); + return; + } + } + } + ZEPHIR_CPY_WRT(realCompiledPath, compiledTemplatePath); + if (zephir_is_true(compileAlways)) { + ZEPHIR_INIT_VAR(_4$$26); + if (extendsMode) { + ZVAL_BOOL(_4$$26, 1); + } else { + ZVAL_BOOL(_4$$26, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _4$$26); + zephir_check_call_status(); + } else { + if (ZEPHIR_IS_TRUE_IDENTICAL(stat)) { + if ((zephir_file_exists(compiledTemplatePath TSRMLS_CC) == SUCCESS)) { + ZEPHIR_INIT_VAR(_6$$29); + if (zephir_compare_mtime(templatePath, realCompiledPath TSRMLS_CC)) { + ZEPHIR_INIT_VAR(_7$$30); + if (extendsMode) { + ZVAL_BOOL(_7$$30, 1); + } else { + ZVAL_BOOL(_7$$30, 0); + } + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _7$$30); + zephir_check_call_status(); } else { - state->old_if_level = state->if_level; - state->if_level = 0; - state->for_level++; - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); - break; - - case PHVOLT_T_IN: - phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); - break; - - case PHVOLT_T_ENDFOR: - state->block_level--; - state->for_level--; - state->if_level = state->old_if_level; - phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); - break; - - case PHVOLT_T_RAW_FRAGMENT: - if (token.len > 0) { - if (state->extends_mode == 1 && state->block_level == 0){ - if (!phvolt_is_blank_string(&token)) { - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; + if (extendsMode == 1) { + ZEPHIR_INIT_VAR(blocksCode); + zephir_file_get_contents(blocksCode, realCompiledPath TSRMLS_CC); + if (ZEPHIR_IS_FALSE_IDENTICAL(blocksCode)) { + ZEPHIR_INIT_VAR(_8$$33); + object_init_ex(_8$$33, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_9$$33); + ZEPHIR_CONCAT_SVS(_9$$33, "Extends compilation file ", realCompiledPath, " could not be opened"); + ZEPHIR_CALL_METHOD(NULL, _8$$33, "__construct", NULL, 9, _9$$33); + zephir_check_call_status(); + zephir_throw_exception_debug(_8$$33, "phalcon/mvc/view/engine/volt/compiler.zep", 2546 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; } - efree(token.value); - break; - } else { - if (!phvolt_is_blank_string(&token)) { - state->statement_position++; + if (zephir_is_true(blocksCode)) { + ZEPHIR_CALL_FUNCTION(&compilation, "unserialize", NULL, 66, blocksCode); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(compilation); + array_init(compilation); } } - phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } + } else { + ZEPHIR_INIT_VAR(_10$$36); + if (extendsMode) { + ZVAL_BOOL(_10$$36, 1); } else { - efree(token.value); + ZVAL_BOOL(_10$$36, 0); } - break; + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "compilefile", &_5, 0, templatePath, realCompiledPath, _10$$36); + zephir_check_call_status(); + } + } else { + if (!((zephir_file_exists(realCompiledPath TSRMLS_CC) == SUCCESS))) { + ZEPHIR_INIT_VAR(_11$$38); + object_init_ex(_11$$38, phalcon_mvc_view_engine_volt_exception_ce); + ZEPHIR_INIT_VAR(_12$$38); + ZEPHIR_CONCAT_SVS(_12$$38, "Compiled template file ", realCompiledPath, " does not exist"); + ZEPHIR_CALL_METHOD(NULL, _11$$38, "__construct", NULL, 9, _12$$38); + zephir_check_call_status(); + zephir_throw_exception_debug(_11$$38, "phalcon/mvc/view/engine/volt/compiler.zep", 2572 TSRMLS_CC); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + zephir_update_property_this(this_ptr, SL("_compiledTemplatePath"), realCompiledPath TSRMLS_CC); + RETURN_CCTOR(compilation); - case PHVOLT_T_SET: - if (state->extends_mode == 1 && state->block_level == 0){ - phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } - phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); - break; - case PHVOLT_T_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_ADD_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_SUB_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_MUL_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); - break; - case PHVOLT_T_DIV_ASSIGN: - phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); - break; +} - case PHVOLT_T_INCR: - phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); - break; - case PHVOLT_T_DECR: - phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getTemplatePath) { - case PHVOLT_T_BLOCK: - if (state->block_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->block_level++; - } - phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); - break; - case PHVOLT_T_ENDBLOCK: - state->block_level--; - phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); - break; + - case PHVOLT_T_MACRO: - if (state->macro_level > 0) { - phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->macro_level++; - } - phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); - break; - case PHVOLT_T_ENDMACRO: - state->macro_level--; - phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_currentPath"); - case PHVOLT_T_CALL: - phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); - break; - case PHVOLT_T_ENDCALL: - phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); - break; +} - case PHVOLT_T_CACHE: - phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); - break; - case PHVOLT_T_ENDCACHE: - phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath) { - case PHVOLT_T_RAW: - phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); - state->forced_raw_state++; - break; - case PHVOLT_T_ENDRAW: - phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); - state->forced_raw_state--; - break; + - case PHVOLT_T_INCLUDE: - phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); - break; + RETURN_MEMBER(this_ptr, "_compiledTemplatePath"); - case PHVOLT_T_WITH: - phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); - break; +} - case PHVOLT_T_DEFINED: - phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse) { - case PHVOLT_T_EMPTY: - phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); - break; + int ZEPHIR_LAST_CALL_STATUS; + zval *viewCode_param = NULL, *currentPath = NULL; + zval *viewCode = NULL; - case PHVOLT_T_EVEN: - phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewCode_param); - case PHVOLT_T_ODD: - phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); - break; + if (unlikely(Z_TYPE_P(viewCode_param) != IS_STRING && Z_TYPE_P(viewCode_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewCode' must be a string") TSRMLS_CC); + RETURN_MM_NULL(); + } + if (likely(Z_TYPE_P(viewCode_param) == IS_STRING)) { + zephir_get_strval(viewCode, viewCode_param); + } else { + ZEPHIR_INIT_VAR(viewCode); + ZVAL_EMPTY_STRING(viewCode); + } - case PHVOLT_T_NUMERIC: - phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); - break; - case PHVOLT_T_SCALAR: - phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); - break; + ZEPHIR_INIT_VAR(currentPath); + ZVAL_STRING(currentPath, "eval code", 1); + ZEPHIR_LAST_CALL_STATUS = phvolt_parse_view(return_value, viewCode, currentPath TSRMLS_CC); + zephir_check_call_status(); + RETURN_MM(); - case PHVOLT_T_ITERABLE: - phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); - break; +} - case PHVOLT_T_DO: - phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); - break; - case PHVOLT_T_RETURN: - phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getFinalPath) { - case PHVOLT_T_AUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); - break; + HashTable *_1$$4; + HashPosition _0$$4; + int ZEPHIR_LAST_CALL_STATUS; + zval *path_param = NULL, *view = NULL, *viewsDirs = NULL, *viewsDir = NULL, **_2$$4, *_3$$5 = NULL; + zval *path = NULL; - case PHVOLT_T_ENDAUTOESCAPE: - phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); - break; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &path_param); - case PHVOLT_T_BREAK: - phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); - break; + zephir_get_strval(path, path_param); - case PHVOLT_T_CONTINUE: - phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); - break; - case PHVOLT_T_EXTENDS: - if (state->statement_position != 1) { - phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); - parser_status->status = PHVOLT_PARSING_FAILED; - break; - } else { - state->extends_mode = 1; + ZEPHIR_OBS_VAR(view); + zephir_read_property_this(&view, this_ptr, SL("_view"), PH_NOISY_CC); + if (Z_TYPE_P(view) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&viewsDirs, view, "getviewsdir", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(viewsDirs) == IS_ARRAY) { + zephir_is_iterable(viewsDirs, &_1$$4, &_0$$4, 0, 0, "phalcon/mvc/view/engine/volt/compiler.zep", 2636); + for ( + ; zephir_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS + ; zephir_hash_move_forward_ex(_1$$4, &_0$$4) + ) { + ZEPHIR_GET_HVALUE(viewsDir, _2$$4); + ZEPHIR_INIT_LNVAR(_3$$5); + ZEPHIR_CONCAT_VV(_3$$5, viewsDir, path); + if ((zephir_file_exists(_3$$5 TSRMLS_CC) == SUCCESS)) { + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); } - phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); - break; - - default: - parser_status->status = PHVOLT_PARSING_FAILED; - error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); - snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, error, 1); - } -#else - if (Z_TYPE_P(*error_msg) == IS_NULL) { - ZVAL_STRING((*error_msg), error); - } -#endif - efree(error); - break; + } + ZEPHIR_CONCAT_VV(return_value, viewsDir, path); + RETURN_MM(); + } else { + ZEPHIR_CONCAT_VV(return_value, viewsDirs, path); + RETURN_MM(); } + } + RETURN_CTOR(path); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - break; - } +} - state->end = state->start; - } - if (status != FAILURE) { - switch (scanner_status) { - case PHVOLT_SCANNER_RETCODE_ERR: - case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } else { - if (Z_TYPE_P(*error_msg) == IS_NULL) { - phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - } - status = FAILURE; - break; - default: - phvolt_(phvolt_parser, 0, NULL, parser_status); - } - } - state->active_token = 0; - state->start = NULL; - efree(state->raw_buffer); - if (parser_status->status != PHVOLT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { -#if PHP_VERSION_ID < 70000 - if (!*error_msg) { - MAKE_STD_ZVAL(*error_msg); - ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); - } -#else - ZVAL_STRING(*error_msg, parser_status->syntax_error); +#ifdef HAVE_CONFIG_H #endif - efree(parser_status->syntax_error); - } - } - phvolt_Free(phvolt_parser, phvolt_wrapper_free); - if (status != FAILURE) { - if (parser_status->status == PHVOLT_PARSING_OK) { -#if PHP_VERSION_ID < 70000 - if (parser_status->ret) { - ZVAL_ZVAL(*result, parser_status->ret, 0, 0); - ZVAL_NULL(parser_status->ret); - zval_ptr_dtor(&parser_status->ret); - } else { - array_init(*result); - } -#else - if (Z_TYPE(parser_status->ret) != IS_UNDEF) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } else { - array_init(*result); - } -#endif - } - } - efree(parser_status); - efree(state); - return status; + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_Volt_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\View\\Engine\\Volt, Exception, phalcon, mvc_view_engine_volt_exception, phalcon_mvc_view_exception_ce, NULL, 0); + + return SUCCESS; + } + +#if PHP_VERSION_ID < 70000 /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php5.lemon" +// 12 "parser.php5.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -157009,58 +126883,58 @@ static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *temp #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval* yy40; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval* vv40; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -157070,46 +126944,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -157342,7 +127216,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -157575,8 +127449,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -157613,8 +127487,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -157651,7 +127525,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -157688,7 +127562,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -157700,10 +127574,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -157717,43 +127591,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -157791,7 +127665,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -157949,8 +127823,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -157960,21 +127834,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -158069,14 +127943,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 155 "parser.php5.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php5.c" break; case 88: case 89: @@ -158112,136 +127988,138 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 172 "parser.php5.lemon" { #if PHP_VERSION_ID < 70000 - zval_ptr_dtor(&(yypminor->yy40)); + zval_ptr_dtor(&(vvpminor->vv40)); #endif } +// 1175 "parser.php5.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -158250,9 +128128,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -158407,40 +128285,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 164 "parser.php5.lemon" { - status->ret = yymsp[0].minor.yy40; + status->ret = vvmsp[0].minor.vv40; } +// 1544 "parser.php5.c" break; case 1: case 4: @@ -158464,881 +128344,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 168 "parser.php5.lemon" { - yygotominor.yy40 = yymsp[0].minor.yy40; + vvgotominor.vv40 = vvmsp[0].minor.vv40; } +// 1572 "parser.php5.c" break; case 2: +// 178 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-1].minor.yy40, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-1].minor.vv40, vvmsp[0].minor.vv40); } +// 1579 "parser.php5.c" break; case 3: case 37: case 49: case 135: case 142: +// 182 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(NULL, yymsp[0].minor.yy40); + vvgotominor.vv40 = phvolt_ret_zval_list(NULL, vvmsp[0].minor.vv40); } +// 1590 "parser.php5.c" break; case 24: +// 278 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1603 "parser.php5.c" break; case 25: +// 282 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-4].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-4].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1616 "parser.php5.c" break; case 26: +// 286 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-9].minor.yy40, yymsp[-7].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-9].minor.vv40, vvmsp[-7].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1632 "parser.php5.c" break; case 27: +// 290 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1648 "parser.php5.c" break; case 28: +// 294 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_if_statement(yymsp[-7].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_if_statement(vvmsp[-7].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1664 "parser.php5.c" break; case 29: +// 304 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elseif_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elseif_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1674 "parser.php5.c" break; case 30: +// 314 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_elsefor_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_elsefor_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1684 "parser.php5.c" break; case 31: +// 324 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, NULL, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1698 "parser.php5.c" break; case 32: +// 328 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, NULL, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, NULL, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1713 "parser.php5.c" break; case 33: +// 332 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1728 "parser.php5.c" break; case 34: +// 336 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_for_statement(yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, yymsp[-7].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_for_statement(vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, vvmsp[-7].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1744 "parser.php5.c" break; case 35: +// 346 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_statement(yymsp[-1].minor.yy40); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_set_statement(vvmsp[-1].minor.vv40); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1754 "parser.php5.c" break; case 36: case 48: case 134: case 141: +// 356 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_zval_list(yymsp[-2].minor.yy40, yymsp[0].minor.yy40); - yy_destructor(2,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_zval_list(vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40); + vv_destructor(2,&vvmsp[-1].minor); } +// 1765 "parser.php5.c" break; case 38: +// 370 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1773 "parser.php5.c" break; case 39: +// 374 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_ADD_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_ADD_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1781 "parser.php5.c" break; case 40: +// 378 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_SUB_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_SUB_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1789 "parser.php5.c" break; case 41: +// 382 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_MUL_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_MUL_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1797 "parser.php5.c" break; case 42: +// 386 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_set_assignment(yymsp[-2].minor.yy40, PHVOLT_T_DIV_ASSIGN, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_set_assignment(vvmsp[-2].minor.vv40, PHVOLT_T_DIV_ASSIGN, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1805 "parser.php5.c" break; case 43: case 67: case 133: case 145: +// 390 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1815 "parser.php5.c" break; case 44: case 127: +// 394 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAYACCESS, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1825 "parser.php5.c" break; case 45: case 116: +// 398 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DOT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DOT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1834 "parser.php5.c" break; case 46: +// 408 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-7].minor.yy0, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-7].minor.vv0, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1849 "parser.php5.c" break; case 47: +// 412 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_statement(yymsp[-8].minor.yy0, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_statement(vvmsp[-8].minor.vv0, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1864 "parser.php5.c" break; case 50: +// 436 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[0].minor.yy0, NULL, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1871 "parser.php5.c" break; case 51: +// 440 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_parameter(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_macro_parameter(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1879 "parser.php5.c" break; case 52: case 66: case 132: case 146: +// 444 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1889 "parser.php5.c" break; case 53: case 147: +// 448 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1897 "parser.php5.c" break; case 54: case 148: +// 452 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1905 "parser.php5.c" break; case 55: case 149: +// 456 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1914 "parser.php5.c" break; case 56: case 150: +// 460 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1923 "parser.php5.c" break; case 57: case 151: +// 464 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1932 "parser.php5.c" break; case 58: +// 474 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-8].minor.yy40, yymsp[-6].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-8].minor.vv40, vvmsp[-6].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1947 "parser.php5.c" break; case 59: +// 478 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_macro_call_statement(yymsp[-6].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_macro_call_statement(vvmsp[-6].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1962 "parser.php5.c" break; case 60: +// 488 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_empty_statement(status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_empty_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1971 "parser.php5.c" break; case 61: +// 498 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_echo_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_echo_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1980 "parser.php5.c" break; case 62: +// 508 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-5].minor.yy0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-5].minor.vv0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1993 "parser.php5.c" break; case 63: +// 512 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_block_statement(yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_block_statement(vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2006 "parser.php5.c" break; case 64: +// 522 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-5].minor.yy40, NULL, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-5].minor.vv40, NULL, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2019 "parser.php5.c" break; case 65: +// 526 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_cache_statement(yymsp[-6].minor.yy40, yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_cache_statement(vvmsp[-6].minor.vv40, vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2032 "parser.php5.c" break; case 68: +// 550 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_raw_statement(yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_raw_statement(vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2045 "parser.php5.c" break; case 69: +// 560 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_extends_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_extends_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2055 "parser.php5.c" break; case 70: +// 570 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-1].minor.yy40, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-1].minor.vv40, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2065 "parser.php5.c" break; case 71: +// 574 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_include_statement(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_include_statement(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2076 "parser.php5.c" break; case 72: +// 584 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_do_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_do_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2086 "parser.php5.c" break; case 73: +// 594 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_return_statement(yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_return_statement(vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2096 "parser.php5.c" break; case 74: +// 604 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(0, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(0, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2110 "parser.php5.c" break; case 75: +// 608 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_autoescape_statement(1, yymsp[-3].minor.yy40, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_autoescape_statement(1, vvmsp[-3].minor.vv40, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2124 "parser.php5.c" break; case 76: +// 618 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_break_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_break_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2134 "parser.php5.c" break; case 77: +// 628 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_continue_statement(status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_continue_statement(status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2144 "parser.php5.c" break; case 78: +// 638 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_literal_zval(PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2151 "parser.php5.c" break; case 79: +// 648 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MINUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2159 "parser.php5.c" break; case 80: +// 652 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PLUS, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2167 "parser.php5.c" break; case 81: +// 656 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_SUB, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_SUB, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2175 "parser.php5.c" break; case 82: +// 660 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ADD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ADD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2183 "parser.php5.c" break; case 83: +// 664 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MUL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MUL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2191 "parser.php5.c" break; case 84: +// 668 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_POW, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_POW, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2200 "parser.php5.c" break; case 85: +// 672 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DIV, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DIV, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2208 "parser.php5.c" break; case 86: +// 676 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2217 "parser.php5.c" break; case 87: +// 680 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_MOD, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_MOD, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2225 "parser.php5.c" break; case 88: +// 684 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_AND, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_AND, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2233 "parser.php5.c" break; case 89: +// 688 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_OR, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_OR, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2241 "parser.php5.c" break; case 90: +// 692 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_CONCAT, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_CONCAT, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2249 "parser.php5.c" break; case 91: +// 696 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_PIPE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_PIPE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2257 "parser.php5.c" break; case 92: +// 700 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_RANGE, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_RANGE, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2265 "parser.php5.c" break; case 93: +// 704 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_EQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_EQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2273 "parser.php5.c" break; case 94: +// 708 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2282 "parser.php5.c" break; case 95: +// 712 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSET, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSET, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2291 "parser.php5.c" break; case 96: +// 716 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2300 "parser.php5.c" break; case 97: +// 720 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEMPTY, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2309 "parser.php5.c" break; case 98: +// 724 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2318 "parser.php5.c" break; case 99: +// 728 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISEVEN, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2327 "parser.php5.c" break; case 100: +// 732 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2336 "parser.php5.c" break; case 101: +// 736 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISODD, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISODD, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2345 "parser.php5.c" break; case 102: +// 740 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2354 "parser.php5.c" break; case 103: +// 744 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISNUMERIC, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2363 "parser.php5.c" break; case 104: +// 748 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2372 "parser.php5.c" break; case 105: +// 752 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISSCALAR, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2381 "parser.php5.c" break; case 106: +// 756 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2390 "parser.php5.c" break; case 107: +// 760 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, yymsp[-2].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ISITERABLE, vvmsp[-2].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2399 "parser.php5.c" break; case 108: +// 764 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2407 "parser.php5.c" break; case 109: +// 768 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTEQUALS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2415 "parser.php5.c" break; case 110: +// 772 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2423 "parser.php5.c" break; case 111: +// 776 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOTIDENTICAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2431 "parser.php5.c" break; case 112: +// 780 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESS, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESS, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2439 "parser.php5.c" break; case 113: +// 784 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATER, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATER, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2447 "parser.php5.c" break; case 114: +// 788 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_GREATEREQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2455 "parser.php5.c" break; case 115: +// 792 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_LESSEQUAL, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2463 "parser.php5.c" break; case 117: +// 800 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_IN, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_IN, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2471 "parser.php5.c" break; case 118: +// 804 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, yymsp[-3].minor.yy40, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT_IN, vvmsp[-3].minor.vv40, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2480 "parser.php5.c" break; case 119: +// 808 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, yymsp[0].minor.yy40, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_NOT, NULL, vvmsp[0].minor.vv40, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2488 "parser.php5.c" break; case 120: +// 812 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_INCR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_INCR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2496 "parser.php5.c" break; case 121: +// 816 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_DECR, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_DECR, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2504 "parser.php5.c" break; case 122: +// 820 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ENCLOSED, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2513 "parser.php5.c" break; case 123: +// 824 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2522 "parser.php5.c" break; case 124: +// 828 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2531 "parser.php5.c" break; case 125: +// 832 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2540 "parser.php5.c" break; case 126: +// 836 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_ARRAY, yymsp[-1].minor.yy40, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_ARRAY, vvmsp[-1].minor.vv40, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2549 "parser.php5.c" break; case 128: +// 844 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_expr(PHVOLT_T_TERNARY, yymsp[-2].minor.yy40, yymsp[0].minor.yy40, yymsp[-4].minor.yy40, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_expr(PHVOLT_T_TERNARY, vvmsp[-2].minor.vv40, vvmsp[0].minor.vv40, vvmsp[-4].minor.vv40, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2558 "parser.php5.c" break; case 129: +// 848 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, NULL, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, NULL, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2568 "parser.php5.c" break; case 130: +// 852 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-4].minor.yy40, yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-4].minor.vv40, vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2578 "parser.php5.c" break; case 131: +// 856 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_slice(yymsp[-5].minor.yy40, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_slice(vvmsp[-5].minor.vv40, vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2588 "parser.php5.c" break; case 136: case 144: +// 894 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy40, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + vvgotominor.vv40 = phvolt_ret_named_item(vvmsp[-2].minor.vv0, vvmsp[0].minor.vv40, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2597 "parser.php5.c" break; case 137: case 143: +// 898 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_named_item(NULL, yymsp[0].minor.yy40, status->scanner_state); + vvgotominor.vv40 = phvolt_ret_named_item(NULL, vvmsp[0].minor.vv40, status->scanner_state); } +// 2605 "parser.php5.c" break; case 139: +// 912 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-3].minor.vv40, vvmsp[-1].minor.vv40, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2614 "parser.php5.c" break; case 140: +// 916 "parser.php5.lemon" { - yygotominor.yy40 = phvolt_ret_func_call(yymsp[-2].minor.yy40, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + vvgotominor.vv40 = phvolt_ret_func_call(vvmsp[-2].minor.vv40, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2623 "parser.php5.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php5.lemon" { @@ -159447,19 +129544,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2774 "parser.php5.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -159485,56 +129583,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -159554,40 +129652,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -159597,32 +129695,33 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } - - +#else /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ +// 42 "parser.php7.lemon" +// 12 "parser.php7.c" /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ @@ -159633,58 +129732,58 @@ static void phvolt_( #endif /* The next thing included is series of defines which control ** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal +** VVCODETYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 terminals ** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds +** VVNOCODE is a number of type VVCODETYPE which corresponds ** to no legal terminal or nonterminal number. This ** number is used to fill in empty slots of the hash ** table. -** YYFALLBACK If defined, this indicates that one or more tokens +** VVFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the ** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal +** VVACTIONTYPE is the data type used for storing terminal ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. ** phvolt_TOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. +** VVMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of ** which is phvolt_TOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. +** for base tokens is called "vv0". +** VVSTACKDEPTH is the maximum depth of the parser's stack. ** phvolt_ARG_SDECL A static variable declaration for the %extra_argument ** phvolt_ARG_PDECL A parameter declaration for the %extra_argument -** phvolt_ARG_STORE Code to store %extra_argument into yypParser -** phvolt_ARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not +** phvolt_ARG_STORE Code to store %extra_argument into vvpParser +** phvolt_ARG_FETCH Code to extract %extra_argument from vvpParser +** VVNSTATE the combined number of states. +** VVNRULE the number of rules in the grammar +** VVERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ -#define YYCODETYPE unsigned char -#define YYNOCODE 125 -#define YYACTIONTYPE unsigned short int +#define VVCODETYPE unsigned char +#define VVNOCODE 125 +#define VVACTIONTYPE unsigned short int #define phvolt_TOKENTYPE phvolt_parser_token* typedef union { - phvolt_TOKENTYPE yy0; - zval yy146; - int yy249; -} YYMINORTYPE; -#define YYSTACKDEPTH 100 + phvolt_TOKENTYPE vv0; + zval vv146; + int vv249; +} VVMINORTYPE; +#define VVSTACKDEPTH 100 #define phvolt_ARG_SDECL phvolt_parser_status *status; #define phvolt_ARG_PDECL ,phvolt_parser_status *status -#define phvolt_ARG_FETCH phvolt_parser_status *status = yypParser->status -#define phvolt_ARG_STORE yypParser->status = status -#define YYNSTATE 348 -#define YYNRULE 152 -#define YYERRORSYMBOL 85 -#define YYERRSYMDT yy249 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) +#define phvolt_ARG_FETCH phvolt_parser_status *status = vvpParser->status +#define phvolt_ARG_STORE vvpParser->status = status +#define VVNSTATE 348 +#define VVNRULE 152 +#define VVERRORSYMBOL 85 +#define VVERRSYMDT vv249 +#define VV_NO_ACTION (VVNSTATE+VVNRULE+2) +#define VV_ACCEPT_ACTION (VVNSTATE+VVNRULE+1) +#define VV_ERROR_ACTION (VVNSTATE+VVNRULE) /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -159694,46 +129793,46 @@ typedef union { ** Suppose the action integer is N. Then the action is determined as ** follows ** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** 0 <= N < VVNSTATE Shift N. That is, push the lookahead ** token onto the stack and goto state N. ** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** VVNSTATE <= N < VVNSTATE+VVNRULE Reduce by rule N-VVNSTATE. ** -** N == YYNSTATE+YYNRULE A syntax error has occurred. +** N == VVNSTATE+VVNRULE A syntax error has occurred. ** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** N == VVNSTATE+VVNRULE+1 The parser accepts its input. ** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. +** N == VVNSTATE+VVNRULE+2 No such action. Denotes unused +** slots in the vv_action[] table. ** -** The action table is constructed as a single large table named yy_action[]. +** The action table is constructed as a single large table named vv_action[]. ** Given state S and lookahead X, the action is computed as ** -** yy_action[ yy_shift_ofst[S] + X ] +** vv_action[ vv_shift_ofst[S] + X ] ** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** If the index value vv_shift_ofst[S]+X is out of range or if the value +** vv_lookahead[vv_shift_ofst[S]+X] is not equal to X or if vv_shift_ofst[S] +** is equal to VV_SHIFT_USE_DFLT, it means that the action is not in the table +** and that vv_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. +** a reduce action) then the vv_reduce_ofst[] array is used in place of +** the vv_shift_ofst[] array and VV_REDUCE_USE_DFLT is used in place of +** VV_SHIFT_USE_DFLT. ** ** The following are the tables generated in this section: ** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for +** vv_action[] A single table containing all actions. +** vv_lookahead[] A table containing the lookahead for each entry in +** vv_action. Used to detect hash collisions. +** vv_shift_ofst[] For each state, the offset into vv_action for ** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for +** vv_reduce_ofst[] For each state, the offset into vv_action for ** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. +** vv_default[] Default action for each state. */ -static YYACTIONTYPE yy_action[] = { +static VVACTIONTYPE vv_action[] = { /* 0 */ 83, 93, 109, 61, 53, 55, 67, 63, 65, 73, /* 10 */ 75, 77, 79, 69, 71, 49, 47, 51, 44, 41, /* 20 */ 57, 90, 59, 85, 88, 89, 97, 81, 86, 231, @@ -159966,7 +130065,7 @@ static YYACTIONTYPE yy_action[] = { /* 2290 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 2300 */ 278, 110, }; -static YYCODETYPE yy_lookahead[] = { +static VVCODETYPE vv_lookahead[] = { /* 0 */ 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* 20 */ 23, 24, 25, 26, 27, 28, 29, 30, 3, 32, @@ -160199,8 +130298,8 @@ static YYCODETYPE yy_lookahead[] = { /* 2290 */ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, /* 2300 */ 124, 83, }; -#define YY_SHIFT_USE_DFLT (-4) -static short yy_shift_ofst[] = { +#define VV_SHIFT_USE_DFLT (-4) +static short vv_shift_ofst[] = { /* 0 */ 1128, 1244, 1121, -4, -4, -4, -4, -4, -4, -4, /* 10 */ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, /* 20 */ -4, -4, -4, -4, 1968, 2175, 402, 1136, 1164, 1200, @@ -160237,8 +130336,8 @@ static short yy_shift_ofst[] = { /* 330 */ 2175, 460, 1128, 1395, 1392, 1148, -4, 1584, 549, -4, /* 340 */ 1080, 1220, -4, 335, 1209, 216, 1291, -4, }; -#define YY_REDUCE_USE_DFLT (-64) -static short yy_reduce_ofst[] = { +#define VV_REDUCE_USE_DFLT (-64) +static short vv_reduce_ofst[] = { /* 0 */ 629, -64, 980, -64, -64, -64, -64, -64, -64, -64, /* 10 */ -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, /* 20 */ -64, -64, -64, -64, -64, 1033, -64, 651, 980, -64, @@ -160275,7 +130374,7 @@ static short yy_reduce_ofst[] = { /* 330 */ 1412, -64, 827, 980, -64, -64, -64, -64, -64, -64, /* 340 */ -64, -64, -64, -64, -64, -64, -64, -64, }; -static YYACTIONTYPE yy_default[] = { +static VVACTIONTYPE vv_default[] = { /* 0 */ 500, 500, 500, 350, 352, 353, 354, 355, 356, 357, /* 10 */ 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, /* 20 */ 368, 369, 370, 371, 500, 500, 500, 500, 500, 500, @@ -160312,7 +130411,7 @@ static YYACTIONTYPE yy_default[] = { /* 330 */ 500, 500, 500, 500, 500, 500, 382, 500, 500, 375, /* 340 */ 500, 500, 373, 500, 500, 500, 500, 376, }; -#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) +#define VV_SZ_ACTTAB (sizeof(vv_action)/sizeof(vv_action[0])) /* The next table maps tokens into fallback tokens. If a construct ** like the following: @@ -160324,10 +130423,10 @@ static YYACTIONTYPE yy_default[] = { ** but it does not parse, the type of the token is changed to ID and ** the parse is retried before an error is thrown. */ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { +#ifdef VVFALLBACK +static const VVCODETYPE vvFallback[] = { }; -#endif /* YYFALLBACK */ +#endif /* VVFALLBACK */ /* The following structure represents a single element of the ** parser's stack. Information stored includes: @@ -160341,43 +130440,43 @@ static const YYCODETYPE yyFallback[] = { ** the information used by the action routines in the grammar. ** It is sometimes called the "minor" token. */ -struct yyStackEntry { +struct vvStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This + VVMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */ }; -typedef struct yyStackEntry yyStackEntry; +typedef struct vvStackEntry vvStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ - int yyerrcnt; /* Shifts left before out of the error */ +struct vvParser { + int vvidx; /* Index of top element in stack */ + int vverrcnt; /* Shifts left before out of the error */ phvolt_ARG_SDECL /* A place to hold %extra_argument */ - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + vvStackEntry vvstack[VVSTACKDEPTH]; /* The parser's stack */ }; -typedef struct yyParser yyParser; +typedef struct vvParser vvParser; #ifndef NDEBUG -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; +static FILE *vvTraceFILE = 0; +static char *vvTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG static void phvolt_Trace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; + vvTraceFILE = TraceFILE; + vvTracePrompt = zTracePrompt; + if( vvTraceFILE==0 ) vvTracePrompt = 0; + else if( vvTracePrompt==0 ) vvTraceFILE = 0; } #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static const char *yyTokenName[] = { +static const char *vvTokenName[] = { "$", "OPEN_DELIMITER", "COMMA", "IN", "QUESTION", "COLON", "RANGE", "AND", "OR", "IS", "EQUALS", "NOTEQUALS", @@ -160415,7 +130514,7 @@ static const char *yyTokenName[] = { #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ -static const char *yyRuleName[] = { +static const char *vvRuleName[] = { /* 0 */ "program ::= volt_language", /* 1 */ "volt_language ::= statement_list", /* 2 */ "statement_list ::= statement_list statement", @@ -160573,8 +130672,8 @@ static const char *yyRuleName[] = { const char *phvolt_TokenName(int tokenType){ #ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ - return yyTokenName[tokenType]; + if( tokenType>0 && tokenType<(sizeof(vvTokenName)/sizeof(vvTokenName[0])) ){ + return vvTokenName[tokenType]; }else{ return "Unknown"; } @@ -160584,21 +130683,21 @@ const char *phvolt_TokenName(int tokenType){ } void *phvolt_Alloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + vvParser *pParser; + pParser = (vvParser*)(*mallocProc)( (size_t)sizeof(vvParser) ); if( pParser ){ - pParser->yyidx = -1; + pParser->vvidx = -1; } return pParser; } /* The following function deletes the value associated with a ** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to +** "vvmajor" is the symbol code, and "vvpminor" is a pointer to ** the value. */ -static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ - switch( yymajor ){ +static void vv_destructor(VVCODETYPE vvmajor, VVMINORTYPE *vvpminor){ + switch( vvmajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a @@ -160693,14 +130792,16 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 82: case 83: case 84: +// 146 "parser.php7.lemon" { - if ((yypminor->yy0)) { - if ((yypminor->yy0)->free_flag) { - efree((yypminor->yy0)->token); + if ((vvpminor->vv0)) { + if ((vvpminor->vv0)->free_flag) { + efree((vvpminor->vv0)->token); } - efree((yypminor->yy0)); + efree((vvpminor->vv0)); } } +// 1133 "parser.php7.c" break; case 88: case 89: @@ -160736,134 +130837,136 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ case 121: case 122: case 123: +// 163 "parser.php7.lemon" { - zval_ptr_dtor(&(yypminor->yy146)); + zval_ptr_dtor(&(vvpminor->vv146)); } +// 1173 "parser.php7.c" break; default: break; /* If no destructor action specified: do nothing */ } } -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; +static int vv_pop_parser_stack(vvParser *pParser){ + VVCODETYPE vvmajor; + vvStackEntry *vvtos = &pParser->vvstack[pParser->vvidx]; - if( pParser->yyidx<0 ) return 0; + if( pParser->vvidx<0 ) return 0; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + if( vvTraceFILE && pParser->vvidx>=0 ){ + fprintf(vvTraceFILE,"%sPopping %s\n", + vvTracePrompt, + vvTokenName[vvtos->major]); } #endif - yymajor = yytos->major; - yy_destructor( yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + vvmajor = vvtos->major; + vv_destructor( vvmajor, &vvtos->minor); + pParser->vvidx--; + return vvmajor; } static void phvolt_Free( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ - yyParser *pParser = (yyParser*)p; + vvParser *pParser = (vvParser*)p; if( pParser==0 ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->vvidx>=0 ) vv_pop_parser_stack(pParser); (*freeProc)((void*)pParser); } -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ +static int vv_find_shift_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */ - i = yy_shift_ofst[stateno]; - if( i==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; + /* if( pParser->vvidx<0 ) return VV_NO_ACTION; */ + i = vv_shift_ofst[stateno]; + if( i==VV_SHIFT_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ +#ifdef VVFALLBACK int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE, "%sFALLBACK %s => %s\n", + vvTracePrompt, vvTokenName[iLookAhead], vvTokenName[iFallback]); } #endif - return yy_find_shift_action(pParser, iFallback); + return vv_find_shift_action(pParser, iFallback); } #endif - return yy_default[stateno]; + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static int yy_find_reduce_action( - yyParser *pParser, /* The parser */ +static int vv_find_reduce_action( + vvParser *pParser, /* The parser */ int iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->vvstack[pParser->vvidx].stateno; - i = yy_reduce_ofst[stateno]; - if( i==YY_REDUCE_USE_DFLT ){ - return yy_default[stateno]; + i = vv_reduce_ofst[stateno]; + if( i==VV_REDUCE_USE_DFLT ){ + return vv_default[stateno]; } - if( iLookAhead==YYNOCODE ){ - return YY_NO_ACTION; + if( iLookAhead==VVNOCODE ){ + return VV_NO_ACTION; } i += iLookAhead; - if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; + if( i<0 || i>=VV_SZ_ACTTAB || vv_lookahead[i]!=iLookAhead ){ + return vv_default[stateno]; }else{ - return yy_action[i]; + return vv_action[i]; } } -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +static void vv_shift( + vvParser *vvpParser, /* The parser to be shifted */ + int vvNewState, /* The new state to shift in */ + int vvMajor, /* The major token to shift in */ + VVMINORTYPE *vvpMinor /* Pointer ot the minor token to shift in */ ){ - yyStackEntry *yytos; - yypParser->yyidx++; - if( yypParser->yyidx>=YYSTACKDEPTH ){ + vvStackEntry *vvtos; + vvpParser->vvidx++; + if( vvpParser->vvidx>=VVSTACKDEPTH ){ phvolt_ARG_FETCH; - yypParser->yyidx--; + vvpParser->vvidx--; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sStack Overflow!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument var */ return; } - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor = *yypMinor; + vvtos = &vvpParser->vvstack[vvpParser->vvidx]; + vvtos->stateno = vvNewState; + vvtos->major = vvMajor; + vvtos->minor = *vvpMinor; #ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ + if( vvTraceFILE && vvpParser->vvidx>0 ){ int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); + fprintf(vvTraceFILE,"%sShift %d\n",vvTracePrompt,vvNewState); + fprintf(vvTraceFILE,"%sStack:",vvTracePrompt); + for(i=1; i<=vvpParser->vvidx; i++) + fprintf(vvTraceFILE," %s",vvTokenName[vvpParser->vvstack[i].major]); + fprintf(vvTraceFILE,"\n"); } #endif } @@ -160872,9 +130975,9 @@ static void yy_shift( ** is used during the reduce. */ static struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + VVCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { +} vvRuleInfo[] = { { 86, 1 }, { 87, 1 }, { 88, 2 }, @@ -161029,40 +131132,42 @@ static struct { { 110, 1 }, }; -static void yy_accept(yyParser*); /* Forward Declaration */ +static void vv_accept(vvParser*); /* Forward Declaration */ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ +static void vv_reduce( + vvParser *vvpParser, /* The parser */ + int vvruleno /* Number of the rule by which to reduce */ ){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ + int vvgoto; /* The next state */ + int vvact; /* The next action */ + VVMINORTYPE vvgotominor; /* The LHS of the rule reduced */ + vvStackEntry *vvmsp; /* The top of the parser's stack */ + int vvsize; /* Amount to pop the stack */ phvolt_ARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + vvmsp = &vvpParser->vvstack[vvpParser->vvidx]; #ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno=0 + && vvruleno + ** // ** { ... } // User supplied code - ** #line + ** // ** break; */ case 0: +// 155 "parser.php7.lemon" { - ZVAL_ZVAL(&status->ret, &yymsp[0].minor.yy146, 1, 1); + ZVAL_ZVAL(&status->ret, &vvmsp[0].minor.vv146, 1, 1); } +// 1542 "parser.php7.c" break; case 1: case 4: @@ -161086,881 +131191,1098 @@ static void yy_reduce( case 22: case 23: case 138: +// 159 "parser.php7.lemon" { - yygotominor.yy146 = yymsp[0].minor.yy146; + vvgotominor.vv146 = vvmsp[0].minor.vv146; } +// 1570 "parser.php7.c" break; case 2: +// 167 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-1].minor.yy146, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, &vvmsp[0].minor.vv146); } +// 1577 "parser.php7.c" break; case 3: case 37: case 49: case 135: case 142: +// 171 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146); + phvolt_ret_zval_list(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146); } +// 1588 "parser.php7.c" break; case 24: +// 263 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1601 "parser.php7.c" break; case 25: +// 267 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(31,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(31,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1614 "parser.php7.c" break; case 26: +// 271 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-9].minor.yy146, &yymsp[-7].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(31,&yymsp[-10].minor); - yy_destructor(32,&yymsp[-8].minor); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(34,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-9].minor.vv146, &vvmsp[-7].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(31,&vvmsp[-10].minor); + vv_destructor(32,&vvmsp[-8].minor); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(34,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1630 "parser.php7.c" break; case 27: +// 275 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(31,&yymsp[-9].minor); - yy_destructor(32,&yymsp[-7].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(31,&vvmsp[-9].minor); + vv_destructor(32,&vvmsp[-7].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1646 "parser.php7.c" break; case 28: +// 279 "parser.php7.lemon" { - phvolt_ret_if_statement(&yygotominor.yy146, &yymsp[-7].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(31,&yymsp[-8].minor); - yy_destructor(32,&yymsp[-6].minor); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(34,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(33,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_if_statement(&vvgotominor.vv146, &vvmsp[-7].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(31,&vvmsp[-8].minor); + vv_destructor(32,&vvmsp[-6].minor); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(34,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(33,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1662 "parser.php7.c" break; case 29: +// 287 "parser.php7.lemon" { - phvolt_ret_elseif_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(35,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elseif_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(35,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1672 "parser.php7.c" break; case 30: +// 295 "parser.php7.lemon" { - phvolt_ret_elsefor_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(36,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_elsefor_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(36,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1682 "parser.php7.c" break; case 31: +// 303 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(37,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(37,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1696 "parser.php7.c" break; case 32: +// 307 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, NULL, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, NULL, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1711 "parser.php7.c" break; case 33: +// 311 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, yymsp[-9].minor.yy0, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-11].minor); - yy_destructor(37,&yymsp[-10].minor); - yy_destructor(2,&yymsp[-8].minor); - yy_destructor(3,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, vvmsp[-9].minor.vv0, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-11].minor); + vv_destructor(37,&vvmsp[-10].minor); + vv_destructor(2,&vvmsp[-8].minor); + vv_destructor(3,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1726 "parser.php7.c" break; case 34: +// 315 "parser.php7.lemon" { - phvolt_ret_for_statement(&yygotominor.yy146, yymsp[-9].minor.yy0, yymsp[-11].minor.yy0, &yymsp[-7].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-13].minor); - yy_destructor(37,&yymsp[-12].minor); - yy_destructor(2,&yymsp[-10].minor); - yy_destructor(3,&yymsp[-8].minor); - yy_destructor(31,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(39,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_for_statement(&vvgotominor.vv146, vvmsp[-9].minor.vv0, vvmsp[-11].minor.vv0, &vvmsp[-7].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-13].minor); + vv_destructor(37,&vvmsp[-12].minor); + vv_destructor(2,&vvmsp[-10].minor); + vv_destructor(3,&vvmsp[-8].minor); + vv_destructor(31,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(39,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1742 "parser.php7.c" break; case 35: +// 323 "parser.php7.lemon" { - phvolt_ret_set_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(40,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_set_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(40,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1752 "parser.php7.c" break; case 36: case 48: case 134: case 141: +// 331 "parser.php7.lemon" { - phvolt_ret_zval_list(&yygotominor.yy146, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146); - yy_destructor(2,&yymsp[-1].minor); + phvolt_ret_zval_list(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146); + vv_destructor(2,&vvmsp[-1].minor); } +// 1763 "parser.php7.c" break; case 38: +// 343 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1771 "parser.php7.c" break; case 39: +// 347 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_ADD_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(42,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_ADD_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(42,&vvmsp[-1].minor); } +// 1779 "parser.php7.c" break; case 40: +// 351 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_SUB_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(43,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_SUB_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(43,&vvmsp[-1].minor); } +// 1787 "parser.php7.c" break; case 41: +// 355 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_MUL_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(44,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_MUL_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(44,&vvmsp[-1].minor); } +// 1795 "parser.php7.c" break; case 42: +// 359 "parser.php7.lemon" { - phvolt_ret_set_assignment(&yygotominor.yy146, &yymsp[-2].minor.yy146, PHVOLT_T_DIV_ASSIGN, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(45,&yymsp[-1].minor); + phvolt_ret_set_assignment(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, PHVOLT_T_DIV_ASSIGN, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(45,&vvmsp[-1].minor); } +// 1803 "parser.php7.c" break; case 43: case 67: case 133: case 145: +// 363 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_IDENTIFIER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_IDENTIFIER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1813 "parser.php7.c" break; case 44: case 127: +// 367 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAYACCESS, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAYACCESS, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 1823 "parser.php7.c" break; case 45: case 116: +// 371 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DOT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(30,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DOT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(30,&vvmsp[-1].minor); } +// 1832 "parser.php7.c" break; case 46: +// 379 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-7].minor.yy0, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-9].minor); - yy_destructor(47,&yymsp[-8].minor); - yy_destructor(29,&yymsp[-6].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-7].minor.vv0, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-9].minor); + vv_destructor(47,&vvmsp[-8].minor); + vv_destructor(29,&vvmsp[-6].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1847 "parser.php7.c" break; case 47: +// 383 "parser.php7.lemon" { - phvolt_ret_macro_statement(&yygotominor.yy146, yymsp[-8].minor.yy0, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(47,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(49,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_statement(&vvgotominor.vv146, vvmsp[-8].minor.vv0, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(47,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(49,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1862 "parser.php7.c" break; case 50: +// 403 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[0].minor.yy0, NULL, status->scanner_state); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[0].minor.vv0, NULL, status->scanner_state); } +// 1869 "parser.php7.c" break; case 51: +// 407 "parser.php7.lemon" { - phvolt_ret_macro_parameter(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(41,&yymsp[-1].minor); + phvolt_ret_macro_parameter(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(41,&vvmsp[-1].minor); } +// 1877 "parser.php7.c" break; case 52: case 66: case 132: case 146: +// 411 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_INTEGER, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_INTEGER, vvmsp[0].minor.vv0, status->scanner_state); } +// 1887 "parser.php7.c" break; case 53: case 147: +// 415 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_STRING, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_STRING, vvmsp[0].minor.vv0, status->scanner_state); } +// 1895 "parser.php7.c" break; case 54: case 148: +// 419 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_DOUBLE, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_DOUBLE, vvmsp[0].minor.vv0, status->scanner_state); } +// 1903 "parser.php7.c" break; case 55: case 149: +// 423 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_NULL, NULL, status->scanner_state); - yy_destructor(53,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_NULL, NULL, status->scanner_state); + vv_destructor(53,&vvmsp[0].minor); } +// 1912 "parser.php7.c" break; case 56: case 150: +// 427 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_FALSE, NULL, status->scanner_state); - yy_destructor(54,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_FALSE, NULL, status->scanner_state); + vv_destructor(54,&vvmsp[0].minor); } +// 1921 "parser.php7.c" break; case 57: case 151: +// 431 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_TRUE, NULL, status->scanner_state); - yy_destructor(55,&yymsp[0].minor); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_TRUE, NULL, status->scanner_state); + vv_destructor(55,&vvmsp[0].minor); } +// 1930 "parser.php7.c" break; case 58: +// 439 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-8].minor.yy146, &yymsp[-6].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-10].minor); - yy_destructor(56,&yymsp[-9].minor); - yy_destructor(29,&yymsp[-7].minor); - yy_destructor(48,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-8].minor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-10].minor); + vv_destructor(56,&vvmsp[-9].minor); + vv_destructor(29,&vvmsp[-7].minor); + vv_destructor(48,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1945 "parser.php7.c" break; case 59: +// 443 "parser.php7.lemon" { - phvolt_ret_macro_call_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(56,&yymsp[-7].minor); - yy_destructor(29,&yymsp[-5].minor); - yy_destructor(48,&yymsp[-4].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(57,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_macro_call_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(56,&vvmsp[-7].minor); + vv_destructor(29,&vvmsp[-5].minor); + vv_destructor(48,&vvmsp[-4].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(57,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1960 "parser.php7.c" break; case 60: +// 451 "parser.php7.lemon" { - phvolt_ret_empty_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_empty_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1969 "parser.php7.c" break; case 61: +// 459 "parser.php7.lemon" { - phvolt_ret_echo_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(58,&yymsp[-2].minor); - yy_destructor(59,&yymsp[0].minor); + phvolt_ret_echo_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(58,&vvmsp[-2].minor); + vv_destructor(59,&vvmsp[0].minor); } +// 1978 "parser.php7.c" break; case 62: +// 467 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-5].minor.yy0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(60,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-5].minor.vv0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(60,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 1991 "parser.php7.c" break; case 63: +// 471 "parser.php7.lemon" { - phvolt_ret_block_statement(&yygotominor.yy146, yymsp[-4].minor.yy0, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(60,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-3].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(61,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_block_statement(&vvgotominor.vv146, vvmsp[-4].minor.vv0, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(60,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-3].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(61,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2004 "parser.php7.c" break; case 64: +// 479 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-5].minor.yy146, NULL, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(62,&yymsp[-6].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, NULL, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(62,&vvmsp[-6].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2017 "parser.php7.c" break; case 65: +// 483 "parser.php7.lemon" { - phvolt_ret_cache_statement(&yygotominor.yy146, &yymsp[-6].minor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-8].minor); - yy_destructor(62,&yymsp[-7].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(63,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_cache_statement(&vvgotominor.vv146, &vvmsp[-6].minor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-8].minor); + vv_destructor(62,&vvmsp[-7].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(63,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2030 "parser.php7.c" break; case 68: +// 503 "parser.php7.lemon" { - phvolt_ret_raw_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-6].minor); - yy_destructor(64,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(65,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_raw_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-6].minor); + vv_destructor(64,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(65,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2043 "parser.php7.c" break; case 69: +// 511 "parser.php7.lemon" { - phvolt_ret_extends_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(66,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_extends_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(66,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2053 "parser.php7.c" break; case 70: +// 519 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, NULL, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(67,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, NULL, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(67,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2063 "parser.php7.c" break; case 71: +// 523 "parser.php7.lemon" { - phvolt_ret_include_statement(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-5].minor); - yy_destructor(67,&yymsp[-4].minor); - yy_destructor(68,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_include_statement(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-5].minor); + vv_destructor(67,&vvmsp[-4].minor); + vv_destructor(68,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2074 "parser.php7.c" break; case 72: +// 531 "parser.php7.lemon" { - phvolt_ret_do_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(69,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_do_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(69,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2084 "parser.php7.c" break; case 73: +// 539 "parser.php7.lemon" { - phvolt_ret_return_statement(&yygotominor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-3].minor); - yy_destructor(70,&yymsp[-2].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_return_statement(&vvgotominor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-3].minor); + vv_destructor(70,&vvmsp[-2].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2094 "parser.php7.c" break; case 74: +// 547 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 0, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(54,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 0, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(54,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2108 "parser.php7.c" break; case 75: +// 551 "parser.php7.lemon" { - phvolt_ret_autoescape_statement(&yygotominor.yy146, 1, &yymsp[-3].minor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-7].minor); - yy_destructor(71,&yymsp[-6].minor); - yy_destructor(55,&yymsp[-5].minor); - yy_destructor(32,&yymsp[-4].minor); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(72,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_autoescape_statement(&vvgotominor.vv146, 1, &vvmsp[-3].minor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-7].minor); + vv_destructor(71,&vvmsp[-6].minor); + vv_destructor(55,&vvmsp[-5].minor); + vv_destructor(32,&vvmsp[-4].minor); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(72,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2122 "parser.php7.c" break; case 76: +// 559 "parser.php7.lemon" { - phvolt_ret_break_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(73,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_break_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(73,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2132 "parser.php7.c" break; case 77: +// 567 "parser.php7.lemon" { - phvolt_ret_continue_statement(&yygotominor.yy146, status->scanner_state); - yy_destructor(1,&yymsp[-2].minor); - yy_destructor(74,&yymsp[-1].minor); - yy_destructor(32,&yymsp[0].minor); + phvolt_ret_continue_statement(&vvgotominor.vv146, status->scanner_state); + vv_destructor(1,&vvmsp[-2].minor); + vv_destructor(74,&vvmsp[-1].minor); + vv_destructor(32,&vvmsp[0].minor); } +// 2142 "parser.php7.c" break; case 78: +// 575 "parser.php7.lemon" { - phvolt_ret_literal_zval(&yygotominor.yy146, PHVOLT_T_RAW_FRAGMENT, yymsp[0].minor.yy0, status->scanner_state); + phvolt_ret_literal_zval(&vvgotominor.vv146, PHVOLT_T_RAW_FRAGMENT, vvmsp[0].minor.vv0, status->scanner_state); } +// 2149 "parser.php7.c" break; case 79: +// 583 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MINUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MINUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2157 "parser.php7.c" break; case 80: +// 587 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PLUS, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PLUS, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2165 "parser.php7.c" break; case 81: +// 591 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_SUB, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(22,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_SUB, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(22,&vvmsp[-1].minor); } +// 2173 "parser.php7.c" break; case 82: +// 595 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ADD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(21,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ADD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(21,&vvmsp[-1].minor); } +// 2181 "parser.php7.c" break; case 83: +// 599 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MUL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MUL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-1].minor); } +// 2189 "parser.php7.c" break; case 84: +// 603 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_POW, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(19,&yymsp[-2].minor); - yy_destructor(19,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_POW, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(19,&vvmsp[-2].minor); + vv_destructor(19,&vvmsp[-1].minor); } +// 2198 "parser.php7.c" break; case 85: +// 607 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DIV, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DIV, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-1].minor); } +// 2206 "parser.php7.c" break; case 86: +// 611 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(18,&yymsp[-2].minor); - yy_destructor(18,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(18,&vvmsp[-2].minor); + vv_destructor(18,&vvmsp[-1].minor); } +// 2215 "parser.php7.c" break; case 87: +// 615 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_MOD, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(20,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_MOD, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(20,&vvmsp[-1].minor); } +// 2223 "parser.php7.c" break; case 88: +// 619 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_AND, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(7,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_AND, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(7,&vvmsp[-1].minor); } +// 2231 "parser.php7.c" break; case 89: +// 623 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_OR, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(8,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_OR, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(8,&vvmsp[-1].minor); } +// 2239 "parser.php7.c" break; case 90: +// 627 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_CONCAT, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(23,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_CONCAT, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(23,&vvmsp[-1].minor); } +// 2247 "parser.php7.c" break; case 91: +// 631 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_PIPE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(25,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_PIPE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(25,&vvmsp[-1].minor); } +// 2255 "parser.php7.c" break; case 92: +// 635 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_RANGE, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(6,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_RANGE, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(6,&vvmsp[-1].minor); } +// 2263 "parser.php7.c" break; case 93: +// 639 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_EQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(10,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_EQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(10,&vvmsp[-1].minor); } +// 2271 "parser.php7.c" break; case 94: +// 643 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2280 "parser.php7.c" break; case 95: +// 647 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSET, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(76,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSET, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(76,&vvmsp[0].minor); } +// 2289 "parser.php7.c" break; case 96: +// 651 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2298 "parser.php7.c" break; case 97: +// 655 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEMPTY, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(77,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEMPTY, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(77,&vvmsp[0].minor); } +// 2307 "parser.php7.c" break; case 98: +// 659 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2316 "parser.php7.c" break; case 99: +// 663 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISEVEN, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(78,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISEVEN, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(78,&vvmsp[0].minor); } +// 2325 "parser.php7.c" break; case 100: +// 667 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2334 "parser.php7.c" break; case 101: +// 671 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISODD, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(79,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISODD, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(79,&vvmsp[0].minor); } +// 2343 "parser.php7.c" break; case 102: +// 675 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2352 "parser.php7.c" break; case 103: +// 679 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISNUMERIC, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(80,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISNUMERIC, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(80,&vvmsp[0].minor); } +// 2361 "parser.php7.c" break; case 104: +// 683 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2370 "parser.php7.c" break; case 105: +// 687 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISSCALAR, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(81,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISSCALAR, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(81,&vvmsp[0].minor); } +// 2379 "parser.php7.c" break; case 106: +// 691 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2388 "parser.php7.c" break; case 107: +// 695 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ISITERABLE, &yymsp[-2].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); - yy_destructor(82,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ISITERABLE, &vvmsp[-2].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); + vv_destructor(82,&vvmsp[0].minor); } +// 2397 "parser.php7.c" break; case 108: +// 699 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(9,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(9,&vvmsp[-1].minor); } +// 2405 "parser.php7.c" break; case 109: +// 703 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTEQUALS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(11,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTEQUALS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(11,&vvmsp[-1].minor); } +// 2413 "parser.php7.c" break; case 110: +// 707 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(16,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(16,&vvmsp[-1].minor); } +// 2421 "parser.php7.c" break; case 111: +// 711 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOTIDENTICAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(17,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOTIDENTICAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(17,&vvmsp[-1].minor); } +// 2429 "parser.php7.c" break; case 112: +// 715 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESS, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(12,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESS, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(12,&vvmsp[-1].minor); } +// 2437 "parser.php7.c" break; case 113: +// 719 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATER, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(13,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATER, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(13,&vvmsp[-1].minor); } +// 2445 "parser.php7.c" break; case 114: +// 723 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_GREATEREQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(14,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_GREATEREQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(14,&vvmsp[-1].minor); } +// 2453 "parser.php7.c" break; case 115: +// 727 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_LESSEQUAL, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(15,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_LESSEQUAL, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(15,&vvmsp[-1].minor); } +// 2461 "parser.php7.c" break; case 117: +// 735 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_IN, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_IN, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(3,&vvmsp[-1].minor); } +// 2469 "parser.php7.c" break; case 118: +// 739 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT_IN, &yymsp[-3].minor.yy146, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-2].minor); - yy_destructor(3,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT_IN, &vvmsp[-3].minor.vv146, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-2].minor); + vv_destructor(3,&vvmsp[-1].minor); } +// 2478 "parser.php7.c" break; case 119: +// 743 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_NOT, NULL, &yymsp[0].minor.yy146, NULL, status->scanner_state); - yy_destructor(26,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_NOT, NULL, &vvmsp[0].minor.vv146, NULL, status->scanner_state); + vv_destructor(26,&vvmsp[-1].minor); } +// 2486 "parser.php7.c" break; case 120: +// 747 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_INCR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(27,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_INCR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(27,&vvmsp[0].minor); } +// 2494 "parser.php7.c" break; case 121: +// 751 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_DECR, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(28,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_DECR, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(28,&vvmsp[0].minor); } +// 2502 "parser.php7.c" break; case 122: +// 755 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ENCLOSED, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ENCLOSED, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2511 "parser.php7.c" break; case 123: +// 759 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2520 "parser.php7.c" break; case 124: +// 763 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2529 "parser.php7.c" break; case 125: +// 767 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-1].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, NULL, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-1].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2538 "parser.php7.c" break; case 126: +// 771 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_ARRAY, &yymsp[-1].minor.yy146, NULL, NULL, status->scanner_state); - yy_destructor(83,&yymsp[-2].minor); - yy_destructor(84,&yymsp[0].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_ARRAY, &vvmsp[-1].minor.vv146, NULL, NULL, status->scanner_state); + vv_destructor(83,&vvmsp[-2].minor); + vv_destructor(84,&vvmsp[0].minor); } +// 2547 "parser.php7.c" break; case 128: +// 779 "parser.php7.lemon" { - phvolt_ret_expr(&yygotominor.yy146, PHVOLT_T_TERNARY, &yymsp[-2].minor.yy146, &yymsp[0].minor.yy146, &yymsp[-4].minor.yy146, status->scanner_state); - yy_destructor(4,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_expr(&vvgotominor.vv146, PHVOLT_T_TERNARY, &vvmsp[-2].minor.vv146, &vvmsp[0].minor.vv146, &vvmsp[-4].minor.vv146, status->scanner_state); + vv_destructor(4,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); } +// 2556 "parser.php7.c" break; case 129: +// 783 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, NULL, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, NULL, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2566 "parser.php7.c" break; case 130: +// 787 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-4].minor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(24,&yymsp[-3].minor); - yy_destructor(5,&yymsp[-1].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-4].minor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(24,&vvmsp[-3].minor); + vv_destructor(5,&vvmsp[-1].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2576 "parser.php7.c" break; case 131: +// 791 "parser.php7.lemon" { - phvolt_ret_slice(&yygotominor.yy146, &yymsp[-5].minor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(24,&yymsp[-4].minor); - yy_destructor(5,&yymsp[-2].minor); - yy_destructor(46,&yymsp[0].minor); + phvolt_ret_slice(&vvgotominor.vv146, &vvmsp[-5].minor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(24,&vvmsp[-4].minor); + vv_destructor(5,&vvmsp[-2].minor); + vv_destructor(46,&vvmsp[0].minor); } +// 2586 "parser.php7.c" break; case 136: case 144: +// 823 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, yymsp[-2].minor.yy0, &yymsp[0].minor.yy146, status->scanner_state); - yy_destructor(5,&yymsp[-1].minor); + phvolt_ret_named_item(&vvgotominor.vv146, vvmsp[-2].minor.vv0, &vvmsp[0].minor.vv146, status->scanner_state); + vv_destructor(5,&vvmsp[-1].minor); } +// 2595 "parser.php7.c" break; case 137: case 143: +// 827 "parser.php7.lemon" { - phvolt_ret_named_item(&yygotominor.yy146, NULL, &yymsp[0].minor.yy146, status->scanner_state); + phvolt_ret_named_item(&vvgotominor.vv146, NULL, &vvmsp[0].minor.vv146, status->scanner_state); } +// 2603 "parser.php7.c" break; case 139: +// 839 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-3].minor.yy146, &yymsp[-1].minor.yy146, status->scanner_state); - yy_destructor(29,&yymsp[-2].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-3].minor.vv146, &vvmsp[-1].minor.vv146, status->scanner_state); + vv_destructor(29,&vvmsp[-2].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2612 "parser.php7.c" break; case 140: +// 843 "parser.php7.lemon" { - phvolt_ret_func_call(&yygotominor.yy146, &yymsp[-2].minor.yy146, NULL, status->scanner_state); - yy_destructor(29,&yymsp[-1].minor); - yy_destructor(48,&yymsp[0].minor); + phvolt_ret_func_call(&vvgotominor.vv146, &vvmsp[-2].minor.vv146, NULL, status->scanner_state); + vv_destructor(29,&vvmsp[-1].minor); + vv_destructor(48,&vvmsp[0].minor); } +// 2621 "parser.php7.c" break; }; - yygoto = yyRuleInfo[yyruleno].lhs; - yysize = yyRuleInfo[yyruleno].nrhs; - yypParser->yyidx -= yysize; - yyact = yy_find_reduce_action(yypParser,yygoto); - if( yyact < YYNSTATE ){ - yy_shift(yypParser,yyact,yygoto,&yygotominor); - }else if( yyact == YYNSTATE + YYNRULE + 1 ){ - yy_accept(yypParser); + vvgoto = vvRuleInfo[vvruleno].lhs; + vvsize = vvRuleInfo[vvruleno].nrhs; + vvpParser->vvidx -= vvsize; + vvact = vv_find_reduce_action(vvpParser,vvgoto); + if( vvact < VVNSTATE ){ + vv_shift(vvpParser,vvact,vvgoto,&vvgotominor); + }else if( vvact == VVNSTATE + VVNRULE + 1 ){ + vv_accept(vvpParser); } } -static void yy_parse_failed( - yyParser *yypParser /* The parser */ +static void vv_parse_failed( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sFail!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser fails */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ +static void vv_syntax_error( + vvParser *vvpParser, /* The parser */ + int vvmajor, /* The major type of the error token */ + VVMINORTYPE vvminor /* The minor type of the error token */ ){ phvolt_ARG_FETCH; -#define TOKEN (yyminor.yy0) +#define VTOKEN (vvminor.vv0) +// 46 "parser.php7.lemon" { @@ -162060,19 +132382,20 @@ static void yy_syntax_error( status->status = PHVOLT_PARSING_FAILED; +// 2763 "parser.php7.c" phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void yy_accept( - yyParser *yypParser /* The parser */ +static void vv_accept( + vvParser *vvpParser /* The parser */ ){ phvolt_ARG_FETCH; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sAccept!\n",vvTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( vvpParser->vvidx>=0 ) vv_pop_parser_stack(vvpParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ phvolt_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -162098,56 +132421,56 @@ static void yy_accept( ** None. */ static void phvolt_( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - phvolt_TOKENTYPE yyminor /* The value for the token */ + void *vvp, /* The parser */ + int vvmajor, /* The major token code number */ + phvolt_TOKENTYPE vvminor /* The value for the token */ phvolt_ARG_PDECL /* Optional %extra_argument parameter */ ){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ - int yyendofinput; /* True if we are at the end of input */ - int yyerrorhit = 0; /* True if yymajor has invoked an error */ - yyParser *yypParser; /* The parser */ + VVMINORTYPE vvminorunion; + int vvact; /* The parser action. */ + int vvendofinput; /* True if we are at the end of input */ + int vverrorhit = 0; /* True if vvmajor has invoked an error */ + vvParser *vvpParser; /* The parser */ /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ - if( yymajor==0 ) return; - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + vvpParser = (vvParser*)vvp; + if( vvpParser->vvidx<0 ){ + if( vvmajor==0 ) return; + vvpParser->vvidx = 0; + vvpParser->vverrcnt = -1; + vvpParser->vvstack[0].stateno = 0; + vvpParser->vvstack[0].major = 0; } - yyminorunion.yy0 = yyminor; - yyendofinput = (yymajor==0); + vvminorunion.vv0 = vvminor; + vvendofinput = (vvmajor==0); phvolt_ARG_STORE; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sInput %s\n",vvTracePrompt,vvTokenName[vvmajor]); } #endif do{ - yyact = yy_find_shift_action(yypParser,yymajor); - if( yyactyyerrcnt--; - if( yyendofinput && yypParser->yyidx>=0 ){ - yymajor = 0; + vvact = vv_find_shift_action(vvpParser,vvmajor); + if( vvactvverrcnt--; + if( vvendofinput && vvpParser->vvidx>=0 ){ + vvmajor = 0; }else{ - yymajor = YYNOCODE; + vvmajor = VVNOCODE; } - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else if( yyact == YY_ERROR_ACTION ){ - int yymx; + }else if( vvact < VVNSTATE + VVNRULE ){ + vv_reduce(vvpParser,vvact-VVNSTATE); + }else if( vvact == VV_ERROR_ACTION ){ + int vvmx; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sSyntax Error!\n",vvTracePrompt); } #endif -#ifdef YYERRORSYMBOL +#ifdef VVERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the ** grammar defines an error token "ERROR". @@ -162167,40 +132490,40 @@ static void phvolt_( ** shifted successfully. ** */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ + vvmx = vvpParser->vvstack[vvpParser->vvidx].major; + if( vvmx==VVERRORSYMBOL || vverrorhit ){ #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + if( vvTraceFILE ){ + fprintf(vvTraceFILE,"%sDiscard input token %s\n", + vvTracePrompt,vvTokenName[vvmajor]); } #endif - yy_destructor(yymajor,&yyminorunion); - yymajor = YYNOCODE; + vv_destructor(vvmajor,&vvminorunion); + vvmajor = VVNOCODE; }else{ while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + vvpParser->vvidx >= 0 && + vvmx != VVERRORSYMBOL && + (vvact = vv_find_shift_action(vvpParser,VVERRORSYMBOL)) >= VVNSTATE ){ - yy_pop_parser_stack(yypParser); + vv_pop_parser_stack(vvpParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + if( vvpParser->vvidx < 0 || vvmajor==0 ){ + vv_destructor(vvmajor,&vvminorunion); + vv_parse_failed(vvpParser); + vvmajor = VVNOCODE; + }else if( vvmx!=VVERRORSYMBOL ){ + VVMINORTYPE u2; + u2.VVERRSYMDT = 0; + vv_shift(vvpParser,vvact,VVERRORSYMBOL,&u2); } } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#else /* YYERRORSYMBOL is not defined */ + vvpParser->vverrcnt = 3; + vverrorhit = 1; +#else /* VVERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. @@ -162210,23 +132533,783 @@ static void phvolt_( ** As before, subsequent error messages are suppressed until ** three input tokens have been successfully shifted. */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); + if( vvpParser->vverrcnt<=0 ){ + vv_syntax_error(vvpParser,vvmajor,vvminorunion); } - yypParser->yyerrcnt = 3; - yy_destructor(yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); + vvpParser->vverrcnt = 3; + vv_destructor(vvmajor,&vvminorunion); + if( vvendofinput ){ + vv_parse_failed(vvpParser); } - yymajor = YYNOCODE; + vvmajor = VVNOCODE; #endif }else{ - yy_accept(yypParser); - yymajor = YYNOCODE; + vv_accept(vvpParser); + vvmajor = VVNOCODE; } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( vvmajor!=VVNOCODE && vvpParser->vvidx>=0 ); return; } +#endif + + +const phvolt_token_names phvolt_tokens[] = +{ + { SL("INTEGER"), PHVOLT_T_INTEGER }, + { SL("DOUBLE"), PHVOLT_T_DOUBLE }, + { SL("STRING"), PHVOLT_T_STRING }, + { SL("IDENTIFIER"), PHVOLT_T_IDENTIFIER }, + { SL("MINUS"), PHVOLT_T_MINUS }, + { SL("+"), PHVOLT_T_ADD }, + { SL("-"), PHVOLT_T_SUB }, + { SL("*"), PHVOLT_T_MUL }, + { SL("/"), PHVOLT_T_DIV }, + { SL("%%"), PHVOLT_T_MOD }, + { SL("!"), PHVOLT_T_NOT }, + { SL("~"), PHVOLT_T_CONCAT }, + { SL("AND"), PHVOLT_T_AND }, + { SL("OR"), PHVOLT_T_OR }, + { SL("DOT"), PHVOLT_T_DOT }, + { SL("COMMA"), PHVOLT_T_COMMA }, + { SL("EQUALS"), PHVOLT_T_EQUALS }, + { SL("NOT EQUALS"), PHVOLT_T_NOTEQUALS }, + { SL("IDENTICAL"), PHVOLT_T_IDENTICAL }, + { SL("NOT IDENTICAL"), PHVOLT_T_NOTIDENTICAL }, + { SL("NOT"), PHVOLT_T_NOT }, + { SL("RANGE"), PHVOLT_T_RANGE }, + { SL("COLON"), PHVOLT_T_COLON }, + { SL("QUESTION MARK"), PHVOLT_T_QUESTION }, + { SL("<"), PHVOLT_T_LESS }, + { SL("<="), PHVOLT_T_LESSEQUAL }, + { SL(">"), PHVOLT_T_GREATER }, + { SL(">="), PHVOLT_T_GREATEREQUAL }, + { SL("("), PHVOLT_T_PARENTHESES_OPEN }, + { SL(")"), PHVOLT_T_PARENTHESES_CLOSE }, + { SL("["), PHVOLT_T_SBRACKET_OPEN }, + { SL("]"), PHVOLT_T_SBRACKET_CLOSE }, + { SL("{"), PHVOLT_T_CBRACKET_OPEN }, + { SL("}"), PHVOLT_T_CBRACKET_CLOSE }, + { SL("{%"), PHVOLT_T_OPEN_DELIMITER }, + { SL("%}"), PHVOLT_T_CLOSE_DELIMITER }, + { SL("{{"), PHVOLT_T_OPEN_EDELIMITER }, + { SL("}}"), PHVOLT_T_CLOSE_EDELIMITER }, + { SL("IF"), PHVOLT_T_IF }, + { SL("ELSE"), PHVOLT_T_ELSE }, + { SL("ELSEIF"), PHVOLT_T_ELSEIF }, + { SL("ELSEFOR"), PHVOLT_T_ELSEFOR }, + { SL("ENDIF"), PHVOLT_T_ENDIF }, + { SL("FOR"), PHVOLT_T_FOR }, + { SL("IN"), PHVOLT_T_IN }, + { SL("ENDFOR"), PHVOLT_T_ENDFOR }, + { SL("SET"), PHVOLT_T_SET }, + { SL("ASSIGN"), PHVOLT_T_ASSIGN }, + { SL("+="), PHVOLT_T_ADD_ASSIGN }, + { SL("-="), PHVOLT_T_SUB_ASSIGN }, + { SL("*="), PHVOLT_T_MUL_ASSIGN }, + { SL("/="), PHVOLT_T_DIV_ASSIGN }, + { SL("++"), PHVOLT_T_INCR }, + { SL("--"), PHVOLT_T_DECR }, + { SL("BLOCK"), PHVOLT_T_BLOCK }, + { SL("ENDBLOCK"), PHVOLT_T_ENDBLOCK }, + { SL("CACHE"), PHVOLT_T_CACHE }, + { SL("ENDCACHE"), PHVOLT_T_ENDCACHE }, + { SL("EXTENDS"), PHVOLT_T_EXTENDS }, + { SL("IS"), PHVOLT_T_IS }, + { SL("DEFINED"), PHVOLT_T_DEFINED }, + { SL("EMPTY"), PHVOLT_T_EMPTY }, + { SL("EVEN"), PHVOLT_T_EVEN }, + { SL("ODD"), PHVOLT_T_ODD }, + { SL("NUMERIC"), PHVOLT_T_NUMERIC }, + { SL("SCALAR"), PHVOLT_T_SCALAR }, + { SL("ITERABLE"), PHVOLT_T_ITERABLE }, + { SL("INCLUDE"), PHVOLT_T_INCLUDE }, + { SL("DO"), PHVOLT_T_DO }, + { SL("WHITESPACE"), PHVOLT_T_IGNORE }, + { SL("AUTOESCAPE"), PHVOLT_T_AUTOESCAPE }, + { SL("ENDAUTOESCAPE"), PHVOLT_T_ENDAUTOESCAPE }, + { SL("CONTINUE"), PHVOLT_T_CONTINUE }, + { SL("BREAK"), PHVOLT_T_BREAK }, + { SL("WITH"), PHVOLT_T_WITH }, + { SL("RETURN"), PHVOLT_T_RETURN }, + { SL("MACRO"), PHVOLT_T_MACRO }, + { SL("ENDMACRO"), PHVOLT_T_ENDMACRO }, + { SL("CALL"), PHVOLT_T_CALL }, + { SL("WITH"), PHVOLT_T_WITH }, + { NULL, 0, 0 } +}; + +static void *phvolt_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} + +static void phvolt_wrapper_free(void *pointer){ + efree(pointer); +} + +static void phvolt_parse_with_token(void* phvolt_parser, int opcode, int parsercode, phvolt_scanner_token *token, phvolt_parser_status *parser_status){ + + phvolt_parser_token *pToken; + + pToken = emalloc(sizeof(phvolt_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; + + phvolt_(phvolt_parser, parsercode, pToken, parser_status); + + token->value = NULL; + token->len = 0; +} + +static void phvolt_create_error_msg(phvolt_parser_status *parser_status, char *message){ + + unsigned int length = (128 + Z_STRLEN_P(parser_status->scanner_state->active_file)); + char *str = emalloc(sizeof(char) * length); + + snprintf(str, length, "%s in %s on line %d", message, Z_STRVAL_P(parser_status->scanner_state->active_file), parser_status->scanner_state->active_line); + str[length - 1] = '\0'; + + parser_status->syntax_error = estrndup(str, strlen(str)); + efree(str); +} + +static void phvolt_scanner_error_msg(phvolt_parser_status *parser_status, zval **error_msg TSRMLS_DC){ + + char *error, *error_part; + int length; + phvolt_scanner_state *state = parser_status->scanner_state; + +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); +#else + ZVAL_NULL(*error_msg); +#endif + + if (state->start) { + error = emalloc(sizeof(char) * 72 + state->start_length + Z_STRLEN_P(state->active_file)); + if (state->start_length > 16) { + length = 72 + Z_STRLEN_P(state->active_file); + error_part = estrndup(state->start, 16); + snprintf(error, length, "Scanning error before '%s...' in %s on line %d", error_part, Z_STRVAL_P(state->active_file), state->active_line); + error[length - 1] = '\0'; + efree(error_part); + } else { + length = 48 + state->start_length + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error before '%s' in %s on line %d", state->start, Z_STRVAL_P(state->active_file), state->active_line); + } + } else { + error = emalloc(sizeof(char) * (32 + Z_STRLEN_P(state->active_file))); + length = 32 + Z_STRLEN_P(state->active_file); + snprintf(error, length, "Scanning error near to EOF in %s", Z_STRVAL_P(state->active_file)); + } + + error[length - 1] = '\0'; +#if PHP_VERSION_ID < 70000 + ZVAL_STRING(*error_msg, error, 1); +#else + ZVAL_STRING(*error_msg, error); +#endif + + efree(error); +} + +static int phvolt_parse_view(zval *result, zval *view_code, zval *template_path TSRMLS_DC){ + +#if PHP_VERSION_ID < 70000 + zval *error_msg = NULL; +#else + zval em, *error_msg = &em; +#endif + + ZVAL_NULL(result); + +#if PHP_VERSION_ID >= 70000 + ZVAL_NULL(error_msg); +#endif + + if (Z_TYPE_P(view_code) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "View code must be a string"); + return FAILURE; + } + + if (phvolt_internal_parse_view(&result, view_code, template_path, &error_msg TSRMLS_CC) == FAILURE) { + ZEPHIR_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, Z_STRVAL_P(error_msg)); +#if PHP_VERSION_ID < 70000 + zval_ptr_dtor(&error_msg); +#else + zval_dtor(error_msg); +#endif + return FAILURE; + } + + return SUCCESS; +} + +static int phvolt_is_blank_string(phvolt_scanner_token *token){ + + char *marker = token->value; + unsigned int ch, i; + + for (i = 0; i < token->len; i++) { + ch = *marker; + if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != 11) { + return 0; + } + marker++; + } + + return 1; +} + +static int phvolt_internal_parse_view(zval **result, zval *view_code, zval *template_path, zval **error_msg TSRMLS_DC) { + + char *error; + phvolt_scanner_state *state; + phvolt_scanner_token token; + int scanner_status, status = SUCCESS; + phvolt_parser_status *parser_status = NULL; + void* phvolt_parser; + + /** Check if the view has code */ + if (!Z_STRVAL_P(view_code)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "View code cannot be null", 1); +#else + ZVAL_STRING(*error_msg, "View code cannot be null"); +#endif + return FAILURE; + } + + if (!Z_STRLEN_P(view_code)) { + array_init(*result); + return SUCCESS; + } + + /** Start the reentrant parser */ + phvolt_parser = phvolt_Alloc(phvolt_wrapper_alloc); + if (unlikely(!phvolt_parser)) { +#if PHP_VERSION_ID < 70000 + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, "Memory allocation error", 1); +#else + ZVAL_STRING(*error_msg, "Memory allocation error"); +#endif + return FAILURE; + } + + parser_status = emalloc(sizeof(phvolt_parser_status)); + state = emalloc(sizeof(phvolt_scanner_state)); + + parser_status->status = PHVOLT_PARSING_OK; + parser_status->scanner_state = state; +#if PHP_VERSION_ID < 70000 + parser_status->ret = NULL; +#else + ZVAL_UNDEF(&parser_status->ret); +#endif + parser_status->token = &token; + parser_status->syntax_error = NULL; + + /** Initialize the scanner state */ + state->active_token = 0; + state->start = Z_STRVAL_P(view_code); + state->mode = PHVOLT_MODE_RAW; + state->raw_buffer = emalloc(sizeof(char) * PHVOLT_RAW_BUFFER_SIZE); + state->raw_buffer_size = PHVOLT_RAW_BUFFER_SIZE; + state->raw_buffer_cursor = 0; + state->active_file = template_path; + state->active_line = 1; + state->statement_position = 0; + state->extends_mode = 0; + state->block_level = 0; + state->macro_level = 0; + state->start_length = 0; + state->old_if_level = 0; + state->if_level = 0; + state->for_level = 0; + state->whitespace_control = 0; + state->forced_raw_state = 0; + + state->end = state->start; + + token.value = NULL; + token.len = 0; + + while (0 <= (scanner_status = phvolt_get_token(state, &token))) { + + state->active_token = token.opcode; + + state->start_length = (Z_STRVAL_P(view_code) + Z_STRLEN_P(view_code) - state->start); + + switch (token.opcode) { + + case PHVOLT_T_IGNORE: + break; + + case PHVOLT_T_ADD: + phvolt_(phvolt_parser, PHVOLT_PLUS, NULL, parser_status); + break; + case PHVOLT_T_SUB: + phvolt_(phvolt_parser, PHVOLT_MINUS, NULL, parser_status); + break; + case PHVOLT_T_MUL: + phvolt_(phvolt_parser, PHVOLT_TIMES, NULL, parser_status); + break; + case PHVOLT_T_DIV: + phvolt_(phvolt_parser, PHVOLT_DIVIDE, NULL, parser_status); + break; + case PHVOLT_T_MOD: + phvolt_(phvolt_parser, PHVOLT_MOD, NULL, parser_status); + break; + case PHVOLT_T_AND: + phvolt_(phvolt_parser, PHVOLT_AND, NULL, parser_status); + break; + case PHVOLT_T_OR: + phvolt_(phvolt_parser, PHVOLT_OR, NULL, parser_status); + break; + case PHVOLT_T_IS: + phvolt_(phvolt_parser, PHVOLT_IS, NULL, parser_status); + break; + case PHVOLT_T_EQUALS: + phvolt_(phvolt_parser, PHVOLT_EQUALS, NULL, parser_status); + break; + case PHVOLT_T_NOTEQUALS: + phvolt_(phvolt_parser, PHVOLT_NOTEQUALS, NULL, parser_status); + break; + case PHVOLT_T_LESS: + phvolt_(phvolt_parser, PHVOLT_LESS, NULL, parser_status); + break; + case PHVOLT_T_GREATER: + phvolt_(phvolt_parser, PHVOLT_GREATER, NULL, parser_status); + break; + case PHVOLT_T_GREATEREQUAL: + phvolt_(phvolt_parser, PHVOLT_GREATEREQUAL, NULL, parser_status); + break; + case PHVOLT_T_LESSEQUAL: + phvolt_(phvolt_parser, PHVOLT_LESSEQUAL, NULL, parser_status); + break; + case PHVOLT_T_IDENTICAL: + phvolt_(phvolt_parser, PHVOLT_IDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOTIDENTICAL: + phvolt_(phvolt_parser, PHVOLT_NOTIDENTICAL, NULL, parser_status); + break; + case PHVOLT_T_NOT: + phvolt_(phvolt_parser, PHVOLT_NOT, NULL, parser_status); + break; + case PHVOLT_T_DOT: + phvolt_(phvolt_parser, PHVOLT_DOT, NULL, parser_status); + break; + case PHVOLT_T_CONCAT: + phvolt_(phvolt_parser, PHVOLT_CONCAT, NULL, parser_status); + break; + case PHVOLT_T_RANGE: + phvolt_(phvolt_parser, PHVOLT_RANGE, NULL, parser_status); + break; + case PHVOLT_T_PIPE: + phvolt_(phvolt_parser, PHVOLT_PIPE, NULL, parser_status); + break; + case PHVOLT_T_COMMA: + phvolt_(phvolt_parser, PHVOLT_COMMA, NULL, parser_status); + break; + case PHVOLT_T_COLON: + phvolt_(phvolt_parser, PHVOLT_COLON, NULL, parser_status); + break; + case PHVOLT_T_QUESTION: + phvolt_(phvolt_parser, PHVOLT_QUESTION, NULL, parser_status); + break; + + case PHVOLT_T_PARENTHESES_OPEN: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_OPEN, NULL, parser_status); + break; + case PHVOLT_T_PARENTHESES_CLOSE: + phvolt_(phvolt_parser, PHVOLT_PARENTHESES_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_SBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_SBRACKET_CLOSE, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_OPEN: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_OPEN, NULL, parser_status); + break; + case PHVOLT_T_CBRACKET_CLOSE: + phvolt_(phvolt_parser, PHVOLT_CBRACKET_CLOSE, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_OPEN_DELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_DELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_DELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_OPEN_EDELIMITER: + if (state->extends_mode == 1 && state->block_level == 0) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_OPEN_EDELIMITER, NULL, parser_status); + break; + case PHVOLT_T_CLOSE_EDELIMITER: + phvolt_(phvolt_parser, PHVOLT_CLOSE_EDELIMITER, NULL, parser_status); + break; + + case PHVOLT_T_NULL: + phvolt_(phvolt_parser, PHVOLT_NULL, NULL, parser_status); + break; + case PHVOLT_T_TRUE: + phvolt_(phvolt_parser, PHVOLT_TRUE, NULL, parser_status); + break; + case PHVOLT_T_FALSE: + phvolt_(phvolt_parser, PHVOLT_FALSE, NULL, parser_status); + break; + + case PHVOLT_T_INTEGER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_INTEGER, PHVOLT_INTEGER, &token, parser_status); + break; + case PHVOLT_T_DOUBLE: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_DOUBLE, PHVOLT_DOUBLE, &token, parser_status); + break; + case PHVOLT_T_STRING: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_STRING, PHVOLT_STRING, &token, parser_status); + break; + case PHVOLT_T_IDENTIFIER: + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_IDENTIFIER, PHVOLT_IDENTIFIER, &token, parser_status); + break; + + case PHVOLT_T_IF: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->if_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_IF, NULL, parser_status); + break; + + case PHVOLT_T_ELSE: + if (state->if_level == 0 && state->for_level > 0) { + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + } else { + phvolt_(phvolt_parser, PHVOLT_ELSE, NULL, parser_status); + } + break; + + case PHVOLT_T_ELSEFOR: + phvolt_(phvolt_parser, PHVOLT_ELSEFOR, NULL, parser_status); + break; + + case PHVOLT_T_ELSEIF: + if (state->if_level == 0) { + phvolt_create_error_msg(parser_status, "Unexpected ENDIF"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_ELSEIF, NULL, parser_status); + break; + + case PHVOLT_T_ENDIF: + state->block_level--; + state->if_level--; + phvolt_(phvolt_parser, PHVOLT_ENDIF, NULL, parser_status); + break; + + case PHVOLT_T_FOR: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->old_if_level = state->if_level; + state->if_level = 0; + state->for_level++; + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_FOR, NULL, parser_status); + break; + + case PHVOLT_T_IN: + phvolt_(phvolt_parser, PHVOLT_IN, NULL, parser_status); + break; + + case PHVOLT_T_ENDFOR: + state->block_level--; + state->for_level--; + state->if_level = state->old_if_level; + phvolt_(phvolt_parser, PHVOLT_ENDFOR, NULL, parser_status); + break; + + case PHVOLT_T_RAW_FRAGMENT: + if (token.len > 0) { + if (state->extends_mode == 1 && state->block_level == 0){ + if (!phvolt_is_blank_string(&token)) { + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + } + efree(token.value); + break; + } else { + if (!phvolt_is_blank_string(&token)) { + state->statement_position++; + } + } + phvolt_parse_with_token(phvolt_parser, PHVOLT_T_RAW_FRAGMENT, PHVOLT_RAW_FRAGMENT, &token, parser_status); + } else { + efree(token.value); + } + break; + + case PHVOLT_T_SET: + if (state->extends_mode == 1 && state->block_level == 0){ + phvolt_create_error_msg(parser_status, "Child templates only may contain blocks"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } + phvolt_(phvolt_parser, PHVOLT_SET, NULL, parser_status); + break; + case PHVOLT_T_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_ADD_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_ADD_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_SUB_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_SUB_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_MUL_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_MUL_ASSIGN, NULL, parser_status); + break; + case PHVOLT_T_DIV_ASSIGN: + phvolt_(phvolt_parser, PHVOLT_DIV_ASSIGN, NULL, parser_status); + break; + + case PHVOLT_T_INCR: + phvolt_(phvolt_parser, PHVOLT_INCR, NULL, parser_status); + break; + case PHVOLT_T_DECR: + phvolt_(phvolt_parser, PHVOLT_DECR, NULL, parser_status); + break; + + case PHVOLT_T_BLOCK: + if (state->block_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding blocks into other blocks is not supported"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->block_level++; + } + phvolt_(phvolt_parser, PHVOLT_BLOCK, NULL, parser_status); + break; + case PHVOLT_T_ENDBLOCK: + state->block_level--; + phvolt_(phvolt_parser, PHVOLT_ENDBLOCK, NULL, parser_status); + break; + + case PHVOLT_T_MACRO: + if (state->macro_level > 0) { + phvolt_create_error_msg(parser_status, "Embedding macros into other macros is not allowed"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->macro_level++; + } + phvolt_(phvolt_parser, PHVOLT_MACRO, NULL, parser_status); + break; + case PHVOLT_T_ENDMACRO: + state->macro_level--; + phvolt_(phvolt_parser, PHVOLT_ENDMACRO, NULL, parser_status); + break; + + case PHVOLT_T_CALL: + phvolt_(phvolt_parser, PHVOLT_CALL, NULL, parser_status); + break; + case PHVOLT_T_ENDCALL: + phvolt_(phvolt_parser, PHVOLT_ENDCALL, NULL, parser_status); + break; + + case PHVOLT_T_CACHE: + phvolt_(phvolt_parser, PHVOLT_CACHE, NULL, parser_status); + break; + case PHVOLT_T_ENDCACHE: + phvolt_(phvolt_parser, PHVOLT_ENDCACHE, NULL, parser_status); + break; + + case PHVOLT_T_RAW: + phvolt_(phvolt_parser, PHVOLT_RAW, NULL, parser_status); + state->forced_raw_state++; + break; + case PHVOLT_T_ENDRAW: + phvolt_(phvolt_parser, PHVOLT_ENDRAW, NULL, parser_status); + state->forced_raw_state--; + break; + + case PHVOLT_T_INCLUDE: + phvolt_(phvolt_parser, PHVOLT_INCLUDE, NULL, parser_status); + break; + + case PHVOLT_T_WITH: + phvolt_(phvolt_parser, PHVOLT_WITH, NULL, parser_status); + break; + + case PHVOLT_T_DEFINED: + phvolt_(phvolt_parser, PHVOLT_DEFINED, NULL, parser_status); + break; + + case PHVOLT_T_EMPTY: + phvolt_(phvolt_parser, PHVOLT_EMPTY, NULL, parser_status); + break; + + case PHVOLT_T_EVEN: + phvolt_(phvolt_parser, PHVOLT_EVEN, NULL, parser_status); + break; + + case PHVOLT_T_ODD: + phvolt_(phvolt_parser, PHVOLT_ODD, NULL, parser_status); + break; + + case PHVOLT_T_NUMERIC: + phvolt_(phvolt_parser, PHVOLT_NUMERIC, NULL, parser_status); + break; + + case PHVOLT_T_SCALAR: + phvolt_(phvolt_parser, PHVOLT_SCALAR, NULL, parser_status); + break; + + case PHVOLT_T_ITERABLE: + phvolt_(phvolt_parser, PHVOLT_ITERABLE, NULL, parser_status); + break; + + case PHVOLT_T_DO: + phvolt_(phvolt_parser, PHVOLT_DO, NULL, parser_status); + break; + case PHVOLT_T_RETURN: + phvolt_(phvolt_parser, PHVOLT_RETURN, NULL, parser_status); + break; + + case PHVOLT_T_AUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_AUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_ENDAUTOESCAPE: + phvolt_(phvolt_parser, PHVOLT_ENDAUTOESCAPE, NULL, parser_status); + break; + + case PHVOLT_T_BREAK: + phvolt_(phvolt_parser, PHVOLT_BREAK, NULL, parser_status); + break; + + case PHVOLT_T_CONTINUE: + phvolt_(phvolt_parser, PHVOLT_CONTINUE, NULL, parser_status); + break; + + case PHVOLT_T_EXTENDS: + if (state->statement_position != 1) { + phvolt_create_error_msg(parser_status, "Extends statement must be placed at the first line in the template"); + parser_status->status = PHVOLT_PARSING_FAILED; + break; + } else { + state->extends_mode = 1; + } + phvolt_(phvolt_parser, PHVOLT_EXTENDS, NULL, parser_status); + break; + + default: + parser_status->status = PHVOLT_PARSING_FAILED; + error = emalloc(sizeof(char) * (48 + Z_STRLEN_P(state->active_file))); + snprintf(error, 48 + Z_STRLEN_P(state->active_file) + state->active_line, "Scanner: unknown opcode %d on in %s line %d", token.opcode, Z_STRVAL_P(state->active_file), state->active_line); +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, error, 1); + } +#else + if (Z_TYPE_P(*error_msg) == IS_NULL) { + ZVAL_STRING((*error_msg), error); + } +#endif + efree(error); + break; + } + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + break; + } + + state->end = state->start; + } + + if (status != FAILURE) { + switch (scanner_status) { + case PHVOLT_SCANNER_RETCODE_ERR: + case PHVOLT_SCANNER_RETCODE_IMPOSSIBLE: + if (!*error_msg) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } else { + if (Z_TYPE_P(*error_msg) == IS_NULL) { + phvolt_scanner_error_msg(parser_status, error_msg TSRMLS_CC); + } + } + status = FAILURE; + break; + default: + phvolt_(phvolt_parser, 0, NULL, parser_status); + } + } + + state->active_token = 0; + state->start = NULL; + efree(state->raw_buffer); + + if (parser_status->status != PHVOLT_PARSING_OK) { + status = FAILURE; + if (parser_status->syntax_error) { +#if PHP_VERSION_ID < 70000 + if (!*error_msg) { + MAKE_STD_ZVAL(*error_msg); + ZVAL_STRING(*error_msg, parser_status->syntax_error, 1); + } +#else + ZVAL_STRING(*error_msg, parser_status->syntax_error); +#endif + efree(parser_status->syntax_error); + } + } + + phvolt_Free(phvolt_parser, phvolt_wrapper_free); + + if (status != FAILURE) { + if (parser_status->status == PHVOLT_PARSING_OK) { +#if PHP_VERSION_ID < 70000 + if (parser_status->ret) { + ZVAL_ZVAL(*result, parser_status->ret, 0, 0); + ZVAL_NULL(parser_status->ret); + zval_ptr_dtor(&parser_status->ret); + } else { + array_init(*result); + } +#else + if (Z_TYPE(parser_status->ret) != IS_UNDEF) { + ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); + } else { + array_init(*result); + } +#endif + } + } + + efree(parser_status); + efree(state); + + return status; +} /* Generated by re2c 0.13.6 on Sun May 1 19:16:49 2016 */ @@ -167934,7 +139017,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { number = zephir_fast_count_int(items TSRMLS_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, show); - ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 322, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 287, &_2); zephir_check_call_status(); roundedTotal = zephir_safe_div_long_zval(number, _3 TSRMLS_CC); totalPages = (int) (roundedTotal); @@ -167945,7 +139028,7 @@ static PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { ZVAL_LONG(&_2, (show * ((pageNumber - 1)))); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, show); - ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 396, items, &_2, &_4); + ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 361, items, &_2, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(items, _5); if (pageNumber < totalPages) { @@ -168291,7 +139374,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_4$$4); ZEPHIR_MAKE_REF(_3$$4); ZEPHIR_MAKE_REF(_4$$4); - ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 407, _1$$4, _2$$4, _3$$4, _4$$4); + ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 372, _1$$4, _2$$4, _3$$4, _4$$4); ZEPHIR_UNREF(_3$$4); ZEPHIR_UNREF(_4$$4); zephir_check_call_status(); @@ -168304,7 +139387,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { ZVAL_NULL(_8$$5); ZEPHIR_MAKE_REF(_7$$5); ZEPHIR_MAKE_REF(_8$$5); - ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 408, _5$$5, _6$$5, _7$$5, _8$$5); + ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 373, _5$$5, _6$$5, _7$$5, _8$$5); ZEPHIR_UNREF(_7$$5); ZEPHIR_UNREF(_8$$5); zephir_check_call_status(); @@ -168315,7 +139398,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { } ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, -1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 409, connection, &_9, ZEPHIR_GLOBAL(global_null)); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 374, connection, &_9, ZEPHIR_GLOBAL(global_null)); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC); RETURN_CCTOR(connection); @@ -168363,7 +139446,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, put) { ZEPHIR_CONCAT_SVSVSVSVSV(_0, "put ", priority, " ", delay, " ", ttr, " ", length, "\r\n", serialized); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 190 TSRMLS_CC); _1 = !ZEPHIR_IS_STRING(status, "INSERTED"); @@ -168400,7 +139483,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { } ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, command); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_0, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 215 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_0, "RESERVED")) { @@ -168413,7 +139496,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, reserve) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_4, "unserialize", NULL, 66, _2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _1, _4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _1, _4); zephir_check_call_status(); RETURN_MM(); @@ -168444,7 +139527,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, choose) { ZEPHIR_CONCAT_SV(_0, "use ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 238 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168480,7 +139563,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, watch) { ZEPHIR_CONCAT_SV(_0, "watch ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 255 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168517,7 +139600,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, ignore) { ZEPHIR_CONCAT_SV(_0, "ignore ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 272 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "WATCHING")) { @@ -168557,7 +139640,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, pauseTube) { ZEPHIR_CONCAT_SVSV(_1, "pause-tube ", tube, " ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 289 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "PAUSED")) { @@ -168585,7 +139668,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, kick) { ZEPHIR_CONCAT_SV(_1, "kick ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 306 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "KICKED")) { @@ -168609,7 +139692,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, stats) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 323 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168645,7 +139728,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, statsTube) { ZEPHIR_CONCAT_SV(_0, "stats-tube ", tube); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 340 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168668,7 +139751,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubes) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 357 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168691,7 +139774,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubeUsed) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 374 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "USING")) { @@ -168714,7 +139797,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, listTubesWatched) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 412); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 377); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 391 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "OK")) { @@ -168737,7 +139820,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 408 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168750,7 +139833,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168768,7 +139851,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 425 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_1, "FOUND")) { @@ -168781,7 +139864,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 66, _3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _2, _5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _2, _5); zephir_check_call_status(); RETURN_MM(); @@ -168802,7 +139885,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { if (!(zephir_is_true(_0))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 444 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168815,7 +139898,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168839,7 +139922,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { ZEPHIR_CONCAT_SV(_1, "peek ", &_0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 462 TSRMLS_CC); if (!ZEPHIR_IS_STRING(_2, "FOUND")) { @@ -168852,7 +139935,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, jobPeek) { zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, this_ptr, _3, _6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 376, this_ptr, _3, _6); zephir_check_call_status(); RETURN_MM(); @@ -168883,7 +139966,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 410); + ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 375); zephir_check_call_status(); ZEPHIR_OBS_VAR(status); zephir_array_fetch_long(&status, response, 0, PH_NOISY, "phalcon/queue/beanstalk.zep", 491 TSRMLS_CC); @@ -168892,7 +139975,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, readYaml) { zephir_array_fetch_long(&numberOfBytes, response, 1, PH_NOISY, "phalcon/queue/beanstalk.zep", 494 TSRMLS_CC); ZEPHIR_CALL_METHOD(&response, this_ptr, "read", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 413, response); + ZEPHIR_CALL_FUNCTION(&data, "yaml_parse", NULL, 378, response); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(numberOfBytes); @@ -168939,13 +140022,13 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { } ZEPHIR_SINIT_VAR(_0$$5); ZVAL_LONG(&_0$$5, (length + 2)); - ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 414, connection, &_0$$5); + ZEPHIR_CALL_FUNCTION(&_1$$5, "stream_get_line", &_2, 379, connection, &_0$$5); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0$$5); ZVAL_STRING(&_0$$5, "\r\n", 0); ZEPHIR_INIT_VAR(data); zephir_fast_trim(data, _1$$5, &_0$$5, ZEPHIR_TRIM_RIGHT TSRMLS_CC); - ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 415, connection); + ZEPHIR_CALL_FUNCTION(&_3$$5, "stream_get_meta_data", NULL, 380, connection); zephir_check_call_status(); zephir_array_fetch_string(&_4$$5, _3$$5, SL("timed_out"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 535 TSRMLS_CC); if (zephir_is_true(_4$$5)) { @@ -168957,7 +140040,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, read) { ZVAL_LONG(&_5$$8, 16384); ZEPHIR_SINIT_VAR(_6$$8); ZVAL_STRING(&_6$$8, "\r\n", 0); - ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 414, connection, &_5$$8, &_6$$8); + ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_2, 379, connection, &_5$$8, &_6$$8); zephir_check_call_status(); } if (ZEPHIR_IS_STRING_IDENTICAL(data, "UNKNOWN_COMMAND")) { @@ -169006,7 +140089,7 @@ static PHP_METHOD(Phalcon_Queue_Beanstalk, write) { ZEPHIR_CPY_WRT(packet, _0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, zephir_fast_strlen_ev(packet)); - ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 416, connection, packet, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 381, connection, packet, &_1); zephir_check_call_status(); RETURN_MM(); @@ -169355,7 +140438,7 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { if ((zephir_function_exists_ex(SS("random_bytes") TSRMLS_CC) == SUCCESS)) { ZEPHIR_SINIT_VAR(_0$$4); ZVAL_LONG(&_0$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 427, &_0$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 392, &_0$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169380,16 +140463,16 @@ static PHP_METHOD(Phalcon_Security_Random, bytes) { ZVAL_STRING(&_4$$7, "/dev/urandom", 0); ZEPHIR_SINIT_VAR(_5$$7); ZVAL_STRING(&_5$$7, "rb", 0); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 298, &_4$$7, &_5$$7); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", NULL, 263, &_4$$7, &_5$$7); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(handle)) { ZEPHIR_SINIT_VAR(_6$$8); ZVAL_LONG(&_6$$8, 0); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 428, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_read_buffer", NULL, 393, handle, &_6$$8); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_6$$8); ZVAL_LONG(&_6$$8, len); - ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 429, handle, &_6$$8); + ZEPHIR_CALL_FUNCTION(&ret, "fread", NULL, 394, handle, &_6$$8); zephir_check_call_status(); zephir_fclose(handle TSRMLS_CC); if (zephir_fast_strlen_ev(ret) != len) { @@ -169425,7 +140508,7 @@ static PHP_METHOD(Phalcon_Security_Random, hex) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_MAKE_REF(_3); ZEPHIR_RETURN_CALL_FUNCTION("array_shift", NULL, 132, _3); @@ -169462,7 +140545,7 @@ static PHP_METHOD(Phalcon_Security_Random, base58) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "C*", 0); - ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 430, &_1, _0); + ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 395, &_1, _0); zephir_check_call_status(); zephir_is_iterable(bytes, &_3, &_2, 0, 0, "phalcon/security/random.zep", 205); for ( @@ -169576,7 +140659,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { zephir_check_call_status(); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "N1a/n1b/n1c/n1d/n1e/N1f", 0); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 430, &_2, _0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 395, &_2, _0); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&ary, "array_values", NULL, 224, _3); zephir_check_call_status(); @@ -169591,7 +140674,7 @@ static PHP_METHOD(Phalcon_Security_Random, uuid) { ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "%08x-%04x-%04x-%04x-%04x%08x", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_MAKE_REF(ary); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, ary, _7); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, ary, _7); zephir_check_temp_parameter(_7); ZEPHIR_UNREF(ary); zephir_check_call_status(); @@ -169628,7 +140711,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_0$$4, 0); ZEPHIR_SINIT_VAR(_1$$4); ZVAL_LONG(&_1$$4, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 431, &_0$$4, &_1$$4); + ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 396, &_0$$4, &_1$$4); zephir_check_call_status(); RETURN_MM(); } @@ -169641,7 +140724,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, len); - ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 432, &_4); + ZEPHIR_CALL_FUNCTION(&hex, "dechex", NULL, 397, &_4); zephir_check_call_status(); if (((zephir_fast_strlen_ev(hex) & 1)) == 1) { ZEPHIR_INIT_VAR(_5$$6); @@ -169650,7 +140733,7 @@ static PHP_METHOD(Phalcon_Security_Random, number) { } ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 433, &_4, hex); + ZEPHIR_CALL_FUNCTION(&_6, "pack", NULL, 398, &_4, hex); zephir_check_call_status(); zephir_concat_self(&bin, _6 TSRMLS_CC); _7 = ZEPHIR_STRING_OFFSET(bin, 0); @@ -169688,19 +140771,19 @@ static PHP_METHOD(Phalcon_Security_Random, number) { ZVAL_LONG(&_19$$7, 0); ZEPHIR_SINIT_NVAR(_20$$7); ZVAL_LONG(&_20$$7, 1); - ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 434, rnd, _16$$7, &_19$$7, &_20$$7); + ZEPHIR_CALL_FUNCTION(&_21$$7, "substr_replace", &_22, 399, rnd, _16$$7, &_19$$7, &_20$$7); zephir_check_call_status(); ZEPHIR_CPY_WRT(rnd, _21$$7); } while (ZEPHIR_LT(bin, rnd)); ZEPHIR_SINIT_NVAR(_4); ZVAL_STRING(&_4, "H*", 0); - ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 430, &_4, rnd); + ZEPHIR_CALL_FUNCTION(&ret, "unpack", NULL, 395, &_4, rnd); zephir_check_call_status(); ZEPHIR_MAKE_REF(ret); ZEPHIR_CALL_FUNCTION(&_23, "array_shift", NULL, 132, ret); ZEPHIR_UNREF(ret); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 435, _23); + ZEPHIR_RETURN_CALL_FUNCTION("hexdec", NULL, 400, _23); zephir_check_call_status(); RETURN_MM(); @@ -170667,7 +141750,7 @@ static PHP_METHOD(Phalcon_Session_Bag, getIterator) { } object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 439, _1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 404, _1); zephir_check_call_status(); RETURN_MM(); @@ -170919,7 +142002,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { } ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 2592000); - ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 436, lifetime, _0); + ZEPHIR_CALL_FUNCTION(&_1, "min", NULL, 401, lifetime, _0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_lifetime"), _1 TSRMLS_CC); ZEPHIR_OBS_VAR(prefix); @@ -170946,7 +142029,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_OBS_VAR(_4); zephir_read_property_this(&_4, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_3, SL("lifetime"), &_4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 334, _3); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 299, _3); zephir_check_call_status(); ZEPHIR_INIT_VAR(_5); zephir_create_array(_5, 5, 0 TSRMLS_CC); @@ -170955,7 +142038,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { zephir_array_update_string(&_5, SL("prefix"), &prefix, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("statsKey"), &statsKey, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5, SL("persistent_id"), &persistentId, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 335, _2, _5); + ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 300, _2, _5); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_libmemcached"), _0 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -170994,9 +142077,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171205,9 +142288,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_OBS_VAR(_6); zephir_read_property_this(&_6, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_5, SL("lifetime"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 334, _5); + ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 299, _5); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 337, _4, options); + ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 302, _4, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_memcache"), _3 TSRMLS_CC); ZEPHIR_INIT_VAR(_7); @@ -171246,9 +142329,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct) { ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "gc", 1); zephir_array_fast_append(_13, _8); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _7, _9, _10, _11, _12, _13); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _7, _9, _10, _11, _12, _13); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_memcache_ce, this_ptr, "__construct", &_14, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171444,7 +142527,7 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 0, _4); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 338, _3, options); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 303, _3, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _2 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); @@ -171483,9 +142566,9 @@ static PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); - ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 437, _6, _8, _9, _10, _11, _12); + ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 402, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 438, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, this_ptr, "__construct", &_13, 403, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -171738,7 +142821,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_10$$24, "PHP_EOL"); ZEPHIR_INIT_VAR(_11$$24); ZEPHIR_CONCAT_SV(_11$$24, "", _10$$24); - ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 443, options, using, value, _11$$24); + ZEPHIR_CALL_SELF(&_8$$24, "_optionsfromresultset", &_9, 408, options, using, value, _11$$24); zephir_check_call_status(); zephir_concat_self(&code, _8$$24 TSRMLS_CC); } else { @@ -171747,7 +142830,7 @@ static PHP_METHOD(Phalcon_Tag_Select, selectField) { ZEPHIR_GET_CONSTANT(_14$$26, "PHP_EOL"); ZEPHIR_INIT_VAR(_15$$26); ZEPHIR_CONCAT_SV(_15$$26, "", _14$$26); - ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 444, options, value, _15$$26); + ZEPHIR_CALL_SELF(&_12$$26, "_optionsfromarray", &_13, 409, options, value, _15$$26); zephir_check_call_status(); zephir_concat_self(&code, _12$$26 TSRMLS_CC); } else { @@ -171787,7 +142870,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromResultset) { ZEPHIR_OBS_VAR(usingOne); zephir_array_fetch_long(&usingOne, using, 1, PH_NOISY, "phalcon/tag/select.zep", 168 TSRMLS_CC); } - ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 445); + ZEPHIR_CALL_CE_STATIC(&_0, phalcon_tag_ce, "getescaperservice", &_1, 410); zephir_check_call_status(); ZEPHIR_CPY_WRT(escaper, _0); _2 = zephir_get_iterator(resultset TSRMLS_CC); @@ -171900,7 +142983,7 @@ static PHP_METHOD(Phalcon_Tag_Select, _optionsFromArray) { if (Z_TYPE_P(optionText) == IS_ARRAY) { ZEPHIR_INIT_NVAR(_4$$4); ZEPHIR_GET_CONSTANT(_4$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 444, optionText, value, closeOption); + ZEPHIR_CALL_SELF(&_5$$4, "_optionsfromarray", &_6, 409, optionText, value, closeOption); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_7$$4); ZEPHIR_GET_CONSTANT(_7$$4, "PHP_EOL"); @@ -172271,7 +143354,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_csv_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); if (!(zephir_array_isset_string(options, SS("content")))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_translate_exception_ce, "Parameter 'content' is required", "phalcon/translate/adapter/csv.zep", 42); @@ -172284,7 +143367,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, __construct) { ZVAL_STRING(_3, ";", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "\"", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 455, _1, _2, _3, _4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "_load", NULL, 420, _1, _2, _3, _4); zephir_check_temp_parameter(_3); zephir_check_temp_parameter(_4); zephir_check_call_status(); @@ -172306,7 +143389,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rb", 0); - ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 298, file, &_0); + ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 263, file, &_0); zephir_check_call_status(); if (Z_TYPE_P(fileHandler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_1$$3); @@ -172320,7 +143403,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { return; } while (1) { - ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 456, fileHandler, length, delimiter, enclosure); + ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 421, fileHandler, length, delimiter, enclosure); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(data)) { break; @@ -172538,7 +143621,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, query) { } - ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 457, index); + ZEPHIR_CALL_FUNCTION(&translation, "gettext", NULL, 0, index); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); zephir_check_call_status(); @@ -172576,7 +143659,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, exists) { static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { int count, ZEPHIR_LAST_CALL_STATUS; - zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, _0$$3, _1$$4; + zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, *_0$$3, *_1$$4; zval *msgid1 = NULL, *msgid2 = NULL, *domain = NULL; ZEPHIR_MM_GROW(); @@ -172628,14 +143711,14 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) { if (!(!(!domain) && Z_STRLEN_P(domain))) { - ZEPHIR_SINIT_VAR(_0$$3); - ZVAL_LONG(&_0$$3, count); - ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 458, msgid1, msgid2, &_0$$3); + ZEPHIR_INIT_VAR(_0$$3); + ZVAL_LONG(_0$$3, count); + ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 0, msgid1, msgid2, _0$$3); zephir_check_call_status(); } else { - ZEPHIR_SINIT_VAR(_1$$4); - ZVAL_LONG(&_1$$4, count); - ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 459, domain, msgid1, msgid2, &_1$$4); + ZEPHIR_INIT_VAR(_1$$4); + ZVAL_LONG(_1$$4, count); + ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 0, domain, msgid1, msgid2, _1$$4); zephir_check_call_status(); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders); @@ -172654,7 +143737,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDomain) { - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, domain); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, domain); zephir_check_call_status(); RETURN_MM(); @@ -172669,7 +143752,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, resetDomain) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 460, _0); + ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 0, _0); zephir_check_call_status(); RETURN_MM(); @@ -172705,8 +143788,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { HashTable *_1$$4; HashPosition _0$$4; int ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_3 = NULL; - zval *directory, *key = NULL, *value = NULL, **_2$$4, *_4$$6 = NULL; + zval *directory, *key = NULL, *value = NULL, **_2$$4, *_3$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &directory); @@ -172725,13 +143807,13 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { ) { ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); ZEPHIR_GET_HVALUE(value, _2$$4); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, key, value); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, key, value); zephir_check_call_status(); } } else { - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getdefaultdomain", NULL, 0); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 461, _4$$6, directory); + ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", NULL, 0, _3$$6, directory); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -172779,21 +143861,21 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setLocale) { _3 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_4); ZEPHIR_CONCAT_SV(_4, "LC_ALL=", _3); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _4); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _4); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SV(_7, "LANG=", _6); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _7); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _7); zephir_check_call_status(); _8 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SV(_9, "LANGUAGE=", _8); - ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 462, _9); + ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 457, _9); zephir_check_call_status(); _10 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_11); - ZVAL_LONG(&_11, 6); + ZVAL_LONG(&_11, 0); ZEPHIR_CALL_FUNCTION(NULL, "setlocale", NULL, 442, &_11, _10); zephir_check_call_status(); RETURN_MM_MEMBER(this_ptr, "_locale"); @@ -172847,7 +143929,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_Gettext, getOptionsDefault) { zephir_create_array(return_value, 2, 0 TSRMLS_CC); - add_assoc_long_ex(return_value, SS("category"), 6); + add_assoc_long_ex(return_value, SS("category"), 0); add_assoc_stringl_ex(return_value, SS("defaultDomain"), SL("messages"), 1); return; @@ -172887,7 +143969,7 @@ static PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, __construct) { options = options_param; - ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 454, options); + ZEPHIR_CALL_PARENT(NULL, phalcon_translate_adapter_nativearray_ce, this_ptr, "__construct", &_0, 419, options); zephir_check_call_status(); ZEPHIR_OBS_VAR(data); if (!(zephir_array_isset_string_fetch(&data, options, SS("content"), 0 TSRMLS_CC))) { @@ -173081,7 +144163,7 @@ static PHP_METHOD(Phalcon_Translate_Interpolator_IndexedArray, replacePlaceholde } if (_0) { ZEPHIR_MAKE_REF(placeholders); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 403, placeholders, translation); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 368, placeholders, translation); ZEPHIR_UNREF(placeholders); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1$$3); @@ -173338,7 +144420,7 @@ static PHP_METHOD(Phalcon_Validation_Message, __set_state) { zephir_array_fetch_string(&_0, message, SL("_message"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_1, message, SL("_field"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); zephir_array_fetch_string(&_2, message, SL("_type"), PH_NOISY | PH_READONLY, "phalcon/validation/message.zep", 134 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 465, _0, _1, _2); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 460, _0, _1, _2); zephir_check_call_status(); RETURN_MM(); @@ -173691,7 +144773,7 @@ static PHP_METHOD(Phalcon_Validation_Message_Group, offsetUnset) { ZEPHIR_INIT_VAR(_2$$3); ZVAL_LONG(_2$$3, 1); ZEPHIR_MAKE_REF(_1$$3); - ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 466, _1$$3, index, _2$$3); + ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 461, _1$$3, index, _2$$3); ZEPHIR_UNREF(_1$$3); zephir_check_call_status(); } @@ -173951,7 +145033,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 467, value); + ZEPHIR_CALL_FUNCTION(&_0, "ctype_alnum", NULL, 462, value); zephir_check_call_status(); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_VAR(_1$$3); @@ -174001,7 +145083,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alnum, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "Alnum", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -174106,7 +145188,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Alpha, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Alpha", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -174231,7 +145313,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Between, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$5); ZVAL_STRING(_10$$5, "Between", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 465, _9$$5, field, _10$$5, code); + ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 460, _9$$5, field, _10$$5, code); zephir_check_temp_parameter(_10$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _4$$5); @@ -174294,7 +145376,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_CALL_METHOD(&valueWith, validation, "getvalue", NULL, 0, fieldWith); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 468, value, valueWith); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 463, value, valueWith); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$4); @@ -174358,7 +145440,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_10$$4); ZVAL_STRING(_10$$4, "Confirmation", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 465, _9$$4, field, _10$$4, code); + ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 460, _9$$4, field, _10$$4, code); zephir_check_temp_parameter(_10$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$4); @@ -174451,7 +145533,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 469, value); + ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 464, value); zephir_check_call_status(); if (!(zephir_is_true(valid))) { ZEPHIR_INIT_VAR(_0$$3); @@ -174501,7 +145583,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_6$$3); ZVAL_STRING(_6$$3, "CreditCard", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 465, _5$$3, field, _6$$3, code); + ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 460, _5$$3, field, _6$$3, code); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0$$3); @@ -174532,7 +145614,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm ZEPHIR_CPY_WRT(digits, _2); ZEPHIR_INIT_VAR(hash); ZVAL_STRING(hash, "", 1); - ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 470, digits); + ZEPHIR_CALL_FUNCTION(&_4, "array_reverse", NULL, 465, digits); zephir_check_call_status(); zephir_is_iterable(_4, &_6, &_5, 0, 0, "phalcon/validation/validator/creditcard.zep", 118); for ( @@ -174552,7 +145634,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_CreditCard, verifyByLuhnAlgorithm } ZEPHIR_CALL_FUNCTION(&_9, "str_split", &_1, 74, hash); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 471, _9); + ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 466, _9); zephir_check_call_status(); RETURN_MM_BOOL((zephir_safe_mod_zval_long(result, 10 TSRMLS_CC) == 0)); @@ -174612,7 +145694,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { ZEPHIR_INIT_NVAR(format); ZVAL_STRING(format, "Y-m-d", 1); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 472, value, format); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 467, value, format); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_INIT_VAR(_3$$5); @@ -174653,7 +145735,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Date, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$5); ZVAL_STRING(_8$$5, "Date", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 465, _7$$5, field, _8$$5); + ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 460, _7$$5, field, _8$$5); zephir_check_temp_parameter(_8$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$5); @@ -174742,7 +145824,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); _0 = Z_TYPE_P(value) == IS_LONG; if (!(_0)) { - ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 473, value); + ZEPHIR_CALL_FUNCTION(&_1, "ctype_digit", NULL, 468, value); zephir_check_call_status(); _0 = zephir_is_true(_1); } @@ -174796,7 +145878,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "Digit", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 465, _7, field, _8, code); + ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 460, _7, field, _8, code); zephir_check_temp_parameter(_8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2); @@ -174898,7 +145980,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Email, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Email", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); @@ -175040,7 +146122,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_ExclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "ExclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175168,7 +146250,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_16$$6); ZVAL_STRING(_16$$6, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 465, _14$$6, field, _16$$6, code); + ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 460, _14$$6, field, _16$$6, code); zephir_check_temp_parameter(_16$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11$$6); @@ -175217,7 +146299,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_28$$9); ZVAL_STRING(_28$$9, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 465, _27$$9, field, _28$$9, code); + ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 460, _27$$9, field, _28$$9, code); zephir_check_temp_parameter(_28$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _24$$9); @@ -175258,7 +146340,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_35$$12); ZVAL_STRING(_35$$12, "FileValid", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 465, _34$$12, field, _35$$12, code); + ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 460, _34$$12, field, _35$$12, code); zephir_check_temp_parameter(_35$$12); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _31$$12); @@ -175349,7 +146431,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_54$$18); ZVAL_STRING(_54$$18, "FileSize", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 465, _53$$18, field, _54$$18, code); + ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 460, _53$$18, field, _54$$18, code); zephir_check_temp_parameter(_54$$18); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _50$$18); @@ -175419,7 +146501,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_63$$26); ZVAL_STRING(_63$$26, "FileType", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 465, _62$$26, field, _63$$26, code); + ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 460, _62$$26, field, _63$$26, code); zephir_check_temp_parameter(_63$$26); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _59$$26); @@ -175507,7 +146589,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_77$$33); ZVAL_STRING(_77$$33, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 465, _76$$33, field, _77$$33, code); + ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 460, _76$$33, field, _77$$33, code); zephir_check_temp_parameter(_77$$33); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _73$$33); @@ -175566,7 +146648,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_86$$38); ZVAL_STRING(_86$$38, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 465, _85$$38, field, _86$$38, code); + ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 460, _85$$38, field, _86$$38, code); zephir_check_temp_parameter(_86$$38); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _82$$38); @@ -175741,7 +146823,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Identical, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_14$$8); ZVAL_STRING(_14$$8, "Identical", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 465, _13$$8, field, _14$$8, code); + ZEPHIR_CALL_METHOD(NULL, _8$$8, "__construct", NULL, 460, _13$$8, field, _14$$8, code); zephir_check_temp_parameter(_14$$8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$8); @@ -175883,7 +146965,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_InclusionIn, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$9); ZVAL_STRING(_11$$9, "InclusionIn", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 465, _10$$9, field, _11$$9, code); + ZEPHIR_CALL_METHOD(NULL, _5$$9, "__construct", NULL, 460, _10$$9, field, _11$$9, code); zephir_check_temp_parameter(_11$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _5$$9); @@ -175988,7 +147070,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Numericality, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$3); ZVAL_STRING(_9$$3, "Numericality", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 465, _8$$3, field, _9$$3, code); + ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _8$$3, field, _9$$3, code); zephir_check_temp_parameter(_9$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$3); @@ -176093,7 +147175,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_PresenceOf, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_7$$3); ZVAL_STRING(_7$$3, "PresenceOf", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _6$$3, field, _7$$3, code); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _6$$3, field, _7$$3, code); zephir_check_temp_parameter(_7$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176213,7 +147295,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Regex, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_9$$6); ZVAL_STRING(_9$$6, "Regex", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 465, _8$$6, field, _9$$6, code); + ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 460, _8$$6, field, _9$$6, code); zephir_check_temp_parameter(_9$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$6); @@ -176351,7 +147433,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_11$$11); ZVAL_STRING(_11$$11, "TooLong", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 465, _9$$11, field, _11$$11, code); + ZEPHIR_CALL_METHOD(NULL, _6$$11, "__construct", &_12, 460, _9$$11, field, _11$$11, code); zephir_check_temp_parameter(_11$$11); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _6$$11); @@ -176396,7 +147478,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_19$$16); ZVAL_STRING(_19$$16, "TooShort", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 465, _18$$16, field, _19$$16, code); + ZEPHIR_CALL_METHOD(NULL, _15$$16, "__construct", &_12, 460, _18$$16, field, _19$$16, code); zephir_check_temp_parameter(_19$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _15$$16); @@ -176477,7 +147559,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, validate) { zephir_check_call_status(); ZEPHIR_INIT_NVAR(_6$$3); ZVAL_STRING(_6$$3, "Uniqueness", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 465, _4$$3, field, _6$$3, _5$$3); + ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 460, _4$$3, field, _6$$3, _5$$3); zephir_check_temp_parameter(_6$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1$$3); @@ -176944,7 +148026,7 @@ static PHP_METHOD(Phalcon_Validation_Validator_Url, validate) { zephir_check_call_status(); ZEPHIR_INIT_VAR(_8$$3); ZVAL_STRING(_8$$3, "Url", ZEPHIR_TEMP_PARAM_COPY); - ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 465, _7$$3, field, _8$$3, code); + ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 460, _7$$3, field, _8$$3, code); zephir_check_temp_parameter(_8$$3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$3); diff --git a/build/php5/safe/php_phalcon.h b/build/php5/safe/php_phalcon.h index f8a6d35836e..aa0591bfc62 100644 --- a/build/php5/safe/php_phalcon.h +++ b/build/php5/safe/php_phalcon.h @@ -185,7 +185,7 @@ typedef zend_function zephir_fcall_cache_entry; #define PHP_PHALCON_VERSION "3.0.4" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" -#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev" +#define PHP_PHALCON_ZEPVERSION "0.9.6a-dev-aef205594b" #define PHP_PHALCON_DESCRIPTION "Web framework delivered as a C-extension for PHP" typedef struct _zephir_struct_db {