1 /* 2 +----------------------------------------------------------------------+ 3 | Zend Engine | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 2.00 of the Zend license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.zend.com/license/2_00.txt. | 11 | If you did not receive a copy of the Zend license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@zend.com so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Authors: Andi Gutmans <andi@php.net> | 16 | Zeev Suraski <zeev@php.net> | 17 +----------------------------------------------------------------------+ 18 */ 19 20 #ifndef ZEND_SCANNER_H 21 #define ZEND_SCANNER_H 22 23 typedef struct _zend_lex_state { 24 unsigned int yy_leng; 25 unsigned char *yy_start; 26 unsigned char *yy_text; 27 unsigned char *yy_cursor; 28 unsigned char *yy_marker; 29 unsigned char *yy_limit; 30 int yy_state; 31 zend_stack state_stack; 32 zend_ptr_stack heredoc_label_stack; 33 34 zend_file_handle *in; 35 uint32_t lineno; 36 zend_string *filename; 37 38 /* original (unfiltered) script */ 39 unsigned char *script_org; 40 size_t script_org_size; 41 42 /* filtered script */ 43 unsigned char *script_filtered; 44 size_t script_filtered_size; 45 46 /* input/output filters */ 47 zend_encoding_filter input_filter; 48 zend_encoding_filter output_filter; 49 const zend_encoding *script_encoding; 50 51 /* hooks */ 52 void (*on_event)(zend_php_scanner_event event, int token, int line, void *context); 53 void *on_event_context; 54 55 zend_ast *ast; 56 zend_arena *ast_arena; 57 } zend_lex_state; 58 59 typedef struct _zend_heredoc_label { 60 char *label; 61 int length; 62 int indentation; 63 zend_bool indentation_uses_spaces; 64 } zend_heredoc_label; 65 66 BEGIN_EXTERN_C() 67 ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state); 68 ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state); 69 ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename); 70 ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding); 71 ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding); 72 ZEND_API void zend_lex_tstring(zval *zv); 73 74 END_EXTERN_C() 75 76 #endif 77