2013-10-31 15:57:12 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2014-01-03 11:08:10 +08:00
|
|
|
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
2013-10-31 15:57:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available through the world-wide-web at the following url: |
|
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Bob Weinand <bwoebi@php.net> |
|
2013-11-07 02:21:07 +08:00
|
|
|
| Dmitry Stogov <dmitry@zend.com> |
|
2013-10-31 15:57:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef ZEND_AST_H
|
|
|
|
#define ZEND_AST_H
|
|
|
|
|
|
|
|
#include "zend.h"
|
|
|
|
|
2013-11-07 14:22:49 +08:00
|
|
|
typedef enum _zend_ast_kind {
|
|
|
|
/* first 256 kinds are reserved for opcodes */
|
2013-11-07 02:21:07 +08:00
|
|
|
ZEND_CONST = 256,
|
|
|
|
ZEND_BOOL_AND,
|
|
|
|
ZEND_BOOL_OR,
|
2013-11-07 14:22:49 +08:00
|
|
|
ZEND_SELECT,
|
2013-11-07 02:21:07 +08:00
|
|
|
ZEND_UNARY_PLUS,
|
|
|
|
ZEND_UNARY_MINUS,
|
2013-11-07 14:22:49 +08:00
|
|
|
} zend_ast_kind;
|
2013-10-31 15:57:12 +08:00
|
|
|
|
|
|
|
struct _zend_ast {
|
2013-11-07 02:21:07 +08:00
|
|
|
unsigned short kind;
|
|
|
|
unsigned short children;
|
|
|
|
union {
|
2014-02-10 14:04:30 +08:00
|
|
|
zval val;
|
2013-11-07 23:39:47 +08:00
|
|
|
zend_ast *child;
|
2013-11-07 02:21:07 +08:00
|
|
|
} u;
|
2013-10-31 15:57:12 +08:00
|
|
|
};
|
|
|
|
|
2013-11-07 14:22:49 +08:00
|
|
|
ZEND_API zend_ast *zend_ast_create_constant(zval *zv);
|
2013-10-31 15:57:12 +08:00
|
|
|
|
2013-11-07 14:22:49 +08:00
|
|
|
ZEND_API zend_ast *zend_ast_create_unary(uint kind, zend_ast *op0);
|
|
|
|
ZEND_API zend_ast *zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1);
|
|
|
|
ZEND_API zend_ast *zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2);
|
2013-10-31 15:57:12 +08:00
|
|
|
|
2013-11-07 02:21:07 +08:00
|
|
|
ZEND_API int zend_ast_is_ct_constant(zend_ast *ast);
|
2013-10-31 15:57:12 +08:00
|
|
|
|
2013-12-10 18:19:17 +08:00
|
|
|
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope TSRMLS_DC);
|
2013-10-31 15:57:12 +08:00
|
|
|
|
2013-11-07 02:21:07 +08:00
|
|
|
ZEND_API zend_ast *zend_ast_copy(zend_ast *ast);
|
|
|
|
ZEND_API void zend_ast_destroy(zend_ast *ast);
|
2013-10-31 15:57:12 +08:00
|
|
|
|
|
|
|
#endif
|