Skip to content

Commit d5f0eaa

Browse files
committed
Try to reorganize language scanner dependencies
1 parent 83f6574 commit d5f0eaa

File tree

7 files changed

+53
-58
lines changed

7 files changed

+53
-58
lines changed

Zend/zend_compile.h

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,58 @@
2727

2828
#include "zend_llist.h"
2929

30+
#include "zend_stack.h"
31+
#include "zend_ptr_stack.h"
32+
#include "zend_multibyte.h"
33+
#include "zend_arena.h"
34+
#include "zend_language_scanner_defs.h"
35+
36+
typedef enum {
37+
ON_TOKEN,
38+
ON_FEEDBACK,
39+
ON_STOP
40+
} zend_php_scanner_event;
41+
42+
typedef struct _zend_lex_state {
43+
unsigned int yy_leng;
44+
unsigned char *yy_start;
45+
unsigned char *yy_text;
46+
unsigned char *yy_cursor;
47+
unsigned char *yy_marker;
48+
unsigned char *yy_limit;
49+
int yy_state;
50+
zend_stack state_stack;
51+
zend_ptr_stack heredoc_label_stack;
52+
53+
zend_file_handle *in;
54+
uint32_t lineno;
55+
zend_string *filename;
56+
57+
/* original (unfiltered) script */
58+
unsigned char *script_org;
59+
size_t script_org_size;
60+
61+
/* filtered script */
62+
unsigned char *script_filtered;
63+
size_t script_filtered_size;
64+
65+
/* input/output filters */
66+
zend_encoding_filter input_filter;
67+
zend_encoding_filter output_filter;
68+
const zend_encoding *script_encoding;
69+
70+
/* hooks */
71+
void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
72+
void *on_event_context;
73+
74+
zend_ast *ast;
75+
zend_arena *ast_arena;
76+
} zend_lex_state;
77+
78+
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
79+
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
80+
ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename);
81+
3082
#define SET_UNUSED(op) op ## _type = IS_UNUSED
3183

3284
#define MAKE_NOP(opline) do { \
@@ -381,7 +433,7 @@ typedef struct _zend_internal_arg_info {
381433
typedef struct _zend_arg_info {
382434
zend_string *name;
383435
zend_type type;
384-
zend_string *default_value;
436+
void *_unused;
385437
} zend_arg_info;
386438

387439
/* the following structure repeats the layout of zend_internal_arg_info,

Zend/zend_globals.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,6 @@ struct _zend_ini_scanner_globals {
266266
int scanner_mode;
267267
};
268268

269-
typedef enum {
270-
ON_TOKEN,
271-
ON_FEEDBACK,
272-
ON_STOP
273-
} zend_php_scanner_event;
274-
275269
struct _zend_php_scanner_globals {
276270
zend_file_handle *yy_in;
277271
zend_file_handle *yy_out;

Zend/zend_language_scanner.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,6 @@
2020
#ifndef ZEND_SCANNER_H
2121
#define ZEND_SCANNER_H
2222

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-
5923
typedef struct _zend_heredoc_label {
6024
char *label;
6125
int length;
@@ -64,9 +28,6 @@ typedef struct _zend_heredoc_label {
6428
} zend_heredoc_label;
6529

6630
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, const char *filename);
7031
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
7132
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
7233
ZEND_API void zend_lex_tstring(zval *zv);

ext/reflection/Makefile.frag

Lines changed: 0 additions & 4 deletions
This file was deleted.

ext/reflection/config.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
PHP_NEW_EXTENSION(reflection, php_reflection.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
2-
PHP_ADD_MAKEFILE_FRAGMENT

ext/reflection/php_reflection.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
#include "zend.h"
3333
#include "zend_API.h"
34-
#include "zend_language_scanner.h"
35-
#include "zend_language_scanner_defs.h"
3634
#include "zend_exceptions.h"
3735
#include "zend_operators.h"
3836
#include "zend_constants.h"

scripts/dev/genfiles

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ $MAKE RE2C="$RE2C" RE2C_FLAGS="$RE2C_FLAGS" srcdir=ext/pdo builddir=ext/pdo top_
124124
-f ext/pdo/Makefile.frag \
125125
ext/pdo/pdo_sql_parser.c
126126

127-
echo "genfiles: Generating reflection extension lexer files"
128-
$MAKE RE2C="$RE2C" RE2C_FLAGS="$RE2C_FLAGS" srcdir=ext/reflection builddir=ext/reflection top_srcdir=. \
129-
-f ext/reflection/Makefile.frag \
130-
ext/reflection/php_reflection.c
131-
132127
echo "genfiles: Generating standard extension lexer files"
133128
$MAKE RE2C="$RE2C" RE2C_FLAGS="$RE2C_FLAGS" srcdir=ext/standard builddir=ext/standard top_srcdir=. \
134129
-f ext/standard/Makefile.frag \

0 commit comments

Comments
 (0)