Skip to content

Commit 18cfbfe

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

File tree

7 files changed

+52
-58
lines changed

7 files changed

+52
-58
lines changed

Zend/zend_compile.h

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,57 @@
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+
35+
typedef enum {
36+
ON_TOKEN,
37+
ON_FEEDBACK,
38+
ON_STOP
39+
} zend_php_scanner_event;
40+
41+
typedef struct _zend_lex_state {
42+
unsigned int yy_leng;
43+
unsigned char *yy_start;
44+
unsigned char *yy_text;
45+
unsigned char *yy_cursor;
46+
unsigned char *yy_marker;
47+
unsigned char *yy_limit;
48+
int yy_state;
49+
zend_stack state_stack;
50+
zend_ptr_stack heredoc_label_stack;
51+
52+
zend_file_handle *in;
53+
uint32_t lineno;
54+
zend_string *filename;
55+
56+
/* original (unfiltered) script */
57+
unsigned char *script_org;
58+
size_t script_org_size;
59+
60+
/* filtered script */
61+
unsigned char *script_filtered;
62+
size_t script_filtered_size;
63+
64+
/* input/output filters */
65+
zend_encoding_filter input_filter;
66+
zend_encoding_filter output_filter;
67+
const zend_encoding *script_encoding;
68+
69+
/* hooks */
70+
void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
71+
void *on_event_context;
72+
73+
zend_ast *ast;
74+
zend_arena *ast_arena;
75+
} zend_lex_state;
76+
77+
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
78+
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
79+
ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename);
80+
3081
#define SET_UNUSED(op) op ## _type = IS_UNUSED
3182

3283
#define MAKE_NOP(opline) do { \
@@ -381,7 +432,7 @@ typedef struct _zend_internal_arg_info {
381432
typedef struct _zend_arg_info {
382433
zend_string *name;
383434
zend_type type;
384-
zend_string *default_value;
435+
void *_unused;
385436
} zend_arg_info;
386437

387438
/* 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)