Skip to content

Commit 8de9986

Browse files
committed
Revert "Try to reorganize language scanner dependencies"
This reverts commit 18cfbfe.
1 parent 18cfbfe commit 8de9986

File tree

7 files changed

+58
-52
lines changed

7 files changed

+58
-52
lines changed

Zend/zend_compile.h

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,57 +27,6 @@
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-
8130
#define SET_UNUSED(op) op ## _type = IS_UNUSED
8231

8332
#define MAKE_NOP(opline) do { \
@@ -432,7 +381,7 @@ typedef struct _zend_internal_arg_info {
432381
typedef struct _zend_arg_info {
433382
zend_string *name;
434383
zend_type type;
435-
void *_unused;
384+
zend_string *default_value;
436385
} zend_arg_info;
437386

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

Zend/zend_globals.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ 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+
269275
struct _zend_php_scanner_globals {
270276
zend_file_handle *yy_in;
271277
zend_file_handle *yy_out;

Zend/zend_language_scanner.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,42 @@
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+
2359
typedef struct _zend_heredoc_label {
2460
char *label;
2561
int length;
@@ -28,6 +64,9 @@ typedef struct _zend_heredoc_label {
2864
} zend_heredoc_label;
2965

3066
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);
3170
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
3271
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
3372
ZEND_API void zend_lex_tstring(zval *zv);

ext/reflection/Makefile.frag

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$(top_srcdir)/Zend/zend_language_parser.c:
2+
$(top_srcdir)/Zend/zend_language_scanner.c:
3+
$(top_srcdir)/ext/reflection/php_reflection.c: $(top_srcdir)/Zend/zend_language_parser.h
4+
$(builddir)/reflection.lo: $(top_srcdir)/Zend/zend_language_parser.c $(top_srcdir)/Zend/zend_language_scanner.c

ext/reflection/config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include "zend.h"
3333
#include "zend_API.h"
34+
#include "zend_language_scanner.h"
35+
#include "zend_language_scanner_defs.h"
3436
#include "zend_exceptions.h"
3537
#include "zend_operators.h"
3638
#include "zend_constants.h"

scripts/dev/genfiles

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ $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+
127132
echo "genfiles: Generating standard extension lexer files"
128133
$MAKE RE2C="$RE2C" RE2C_FLAGS="$RE2C_FLAGS" srcdir=ext/standard builddir=ext/standard top_srcdir=. \
129134
-f ext/standard/Makefile.frag \

0 commit comments

Comments
 (0)