xref: /PHP-7.2/Zend/zend_language_scanner.h (revision 7a7ec01a)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2018 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@zend.com>                                |
16    |          Zeev Suraski <zeev@zend.com>                                |
17    +----------------------------------------------------------------------+
18 */
19 
20 /* $Id$ */
21 
22 #ifndef ZEND_SCANNER_H
23 #define ZEND_SCANNER_H
24 
25 typedef struct _zend_lex_state {
26 	unsigned int yy_leng;
27 	unsigned char *yy_start;
28 	unsigned char *yy_text;
29 	unsigned char *yy_cursor;
30 	unsigned char *yy_marker;
31 	unsigned char *yy_limit;
32 	int yy_state;
33 	zend_stack state_stack;
34 	zend_ptr_stack heredoc_label_stack;
35 
36 	zend_file_handle *in;
37 	uint32_t lineno;
38 	zend_string *filename;
39 
40 	/* original (unfiltered) script */
41 	unsigned char *script_org;
42 	size_t script_org_size;
43 
44 	/* filtered script */
45 	unsigned char *script_filtered;
46 	size_t script_filtered_size;
47 
48 	/* input/output filters */
49 	zend_encoding_filter input_filter;
50 	zend_encoding_filter output_filter;
51 	const zend_encoding *script_encoding;
52 
53 	/* hooks */
54 	void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
55 	void *on_event_context;
56 
57 	zend_ast *ast;
58 	zend_arena *ast_arena;
59 } zend_lex_state;
60 
61 typedef struct _zend_heredoc_label {
62 	char *label;
63 	int length;
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 
78 /*
79  * Local variables:
80  * tab-width: 4
81  * c-basic-offset: 4
82  * indent-tabs-mode: t
83  * End:
84  * vim600: sw=4 ts=4 fdm=marker
85  * vim<600: sw=4 ts=4
86  */
87