diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-15 12:36:49 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-21 16:27:48 +0100 |
| commit | e528762c1c59bc0bd0bd6d78246c14269630cf0f (patch) | |
| tree | e8ee4eec737685c2a0ea5c2ba78fb86fd54035e5 /Zend/zend_compile.h | |
| parent | 1cf84f1579c54233c69a9394a8c02d29e092e32a (diff) | |
| download | php-git-e528762c1c59bc0bd0bd6d78246c14269630cf0f.tar.gz | |
Switch to bison location tracking
Locations for AST nodes are now tracked with the help of bison
location tracking. This is more accurate than what we currently do
and easier to extend with more information.
A zend_ast_loc structure is introduced, which is used for the location
stack. Currently it only holds the start lineno, but can be extended
to also hold end lineno and offset/column information in the future.
All AST constructors now accept a zend_ast_loc* as first argument, and
will use it to determine their lineno. Previously this used either the
CG(zend_lineno), or the smallest AST lineno of child nodes.
On the parser side, the location structure for a whole rule can be
obtained using the &@$ character salad.
Diffstat (limited to 'Zend/zend_compile.h')
| -rw-r--r-- | Zend/zend_compile.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 82d70fd4b0..646aef4663 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -94,8 +94,6 @@ typedef struct _zend_ast_znode { znode node; } zend_ast_znode; -ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(znode *node); - static zend_always_inline znode *zend_ast_get_znode(zend_ast *ast) { return &((zend_ast_znode *) ast)->node; } @@ -732,7 +730,7 @@ void zend_file_context_end(zend_file_context *prev_context); extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type); extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename); -ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem); +ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem, zend_ast_loc *loc); void startup_scanner(void); void shutdown_scanner(void); @@ -845,7 +843,7 @@ ZEND_API zend_bool zend_is_auto_global_str(char *name, size_t len); ZEND_API size_t zend_dirname(char *path, size_t len); ZEND_API void zend_set_function_arg_flags(zend_function *func); -int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem); +int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem, zend_ast_loc *loc); void zend_assert_valid_class_name(const zend_string *const_name); |
