@@ -47,10 +47,6 @@ int json_yydebug = 1;
47
47
48
48
%union {
49
49
zval value;
50
- struct {
51
- zend_string *key;
52
- zval val;
53
- } pair;
54
50
}
55
51
56
52
@@ -66,10 +62,8 @@ int json_yydebug = 1;
66
62
67
63
%type <value> start object key value array
68
64
%type <value> members member elements element
69
- %type <pair> pair
70
65
71
66
%destructor { zval_ptr_dtor_nogc (&$$); } <value>
72
- %destructor { zend_string_release_ex ($$.key , 0 ); zval_ptr_dtor_nogc (&$$.val ); } <pair>
73
67
74
68
%code {
75
69
static int php_json_yylex (union YYSTYPE *value, php_json_parser *parser);
@@ -130,30 +124,22 @@ members:
130
124
;
131
125
132
126
member :
133
- pair
127
+ key ' : ' value
134
128
{
135
129
parser->methods.object_create(parser, &$$ );
136
- if (parser->methods.object_update(parser, &$$ , $1 .key , &$1 .val ) == FAILURE) {
130
+ if (parser->methods.object_update(parser, &$$ , Z_STR( $1 ) , &$3 ) == FAILURE) {
137
131
YYERROR ;
138
132
}
139
133
}
140
- | member ' ,' pair
134
+ | member ' ,' key ' : ' value
141
135
{
142
- if (parser->methods.object_update(parser, &$1 , $3 .key , &$3 .val ) == FAILURE) {
136
+ if (parser->methods.object_update(parser, &$1 , Z_STR( $3 ) , &$5 ) == FAILURE) {
143
137
YYERROR ;
144
138
}
145
139
ZVAL_COPY_VALUE (&$$, &$1 );
146
140
}
147
141
;
148
142
149
- pair :
150
- key ' :' value
151
- {
152
- $$ .key = Z_STR($1 );
153
- ZVAL_COPY_VALUE (&$$.val, &$3 );
154
- }
155
- ;
156
-
157
143
array :
158
144
' ['
159
145
{
0 commit comments