File tree 6 files changed +3067
-21
lines changed
6 files changed +3067
-21
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ module.exports = {
16
16
*/
17
17
read_while : function ( ) {
18
18
const result = this . node ( "while" ) ;
19
+ this . expect ( this . tok . T_WHILE ) && this . next ( ) ;
19
20
let test = null ;
20
21
let body = null ;
21
22
let shortForm = false ;
@@ -40,6 +41,7 @@ module.exports = {
40
41
*/
41
42
read_do : function ( ) {
42
43
const result = this . node ( "do" ) ;
44
+ this . expect ( this . tok . T_DO ) && this . next ( ) ;
43
45
let test = null ;
44
46
let body = null ;
45
47
body = this . read_statement ( ) ;
@@ -63,6 +65,7 @@ module.exports = {
63
65
*/
64
66
read_for : function ( ) {
65
67
const result = this . node ( "for" ) ;
68
+ this . expect ( this . tok . T_FOR ) && this . next ( ) ;
66
69
let init = [ ] ;
67
70
let test = [ ] ;
68
71
let increment = [ ] ;
@@ -105,6 +108,7 @@ module.exports = {
105
108
*/
106
109
read_foreach : function ( ) {
107
110
const result = this . node ( "foreach" ) ;
111
+ this . expect ( this . tok . T_FOREACH ) && this . next ( ) ;
108
112
let source = null ;
109
113
let key = null ;
110
114
let value = null ;
Original file line number Diff line number Diff line change @@ -204,16 +204,16 @@ module.exports = {
204
204
return this . read_switch ( ) ;
205
205
206
206
case this . tok . T_FOR :
207
- return this . next ( ) . read_for ( ) ;
207
+ return this . read_for ( ) ;
208
208
209
209
case this . tok . T_FOREACH :
210
- return this . next ( ) . read_foreach ( ) ;
210
+ return this . read_foreach ( ) ;
211
211
212
212
case this . tok . T_WHILE :
213
- return this . next ( ) . read_while ( ) ;
213
+ return this . read_while ( ) ;
214
214
215
215
case this . tok . T_DO :
216
- return this . next ( ) . read_do ( ) ;
216
+ return this . read_do ( ) ;
217
217
218
218
case this . tok . T_COMMENT :
219
219
return this . read_comment ( ) ;
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ module.exports = {
15
15
* @see http://php.net/manual/en/control-structures.switch.php
16
16
*/
17
17
read_switch : function ( ) {
18
- this . expect ( this . tok . T_SWITCH ) && this . next ( ) ;
19
18
const result = this . node ( "switch" ) ;
19
+ this . expect ( this . tok . T_SWITCH ) && this . next ( ) ;
20
20
this . expect ( "(" ) && this . next ( ) ;
21
21
const test = this . read_expr ( ) ;
22
22
this . expect ( ")" ) && this . next ( ) ;
Original file line number Diff line number Diff line change @@ -1065,14 +1065,14 @@ Program {
1065
1065
" line" : 44 ,
1066
1066
" offset" : 887 ,
1067
1067
},
1068
- " source" : " ($this->dwarf as $name => $greeting) {
1068
+ " source" : " foreach ($this->dwarf as $name => $greeting) {
1069
1069
echo \\" Hey ho $name, $greeting !\\ " ;
1070
1070
continue $foo ;
1071
1071
}" ,
1072
1072
" start" : Position {
1073
- " column" : 13 ,
1073
+ " column" : 6 ,
1074
1074
" line" : 41 ,
1075
- " offset" : 776 ,
1075
+ " offset" : 769 ,
1076
1076
},
1077
1077
},
1078
1078
" shortForm" : false ,
@@ -2228,7 +2228,7 @@ Program {
2228
2228
" line" : 70 ,
2229
2229
" offset" : 1450 ,
2230
2230
},
2231
- " source" : " ($this->style) {
2231
+ " source" : " switch ($this->style) {
2232
2232
case ' dot' :
2233
2233
case ' point' :
2234
2234
$body = ' ......' ;
@@ -2238,9 +2238,9 @@ Program {
2238
2238
break ;
2239
2239
}" ,
2240
2240
" start" : Position {
2241
- " column" : 12 ,
2241
+ " column" : 6 ,
2242
2242
" line" : 62 ,
2243
- " offset" : 1278 ,
2243
+ " offset" : 1272 ,
2244
2244
},
2245
2245
},
2246
2246
" shortForm" : false ,
@@ -4328,14 +4328,14 @@ next:
4328
4328
" line" : 126 ,
4329
4329
" offset" : 2773 ,
4330
4330
},
4331
- " source" : " ($i = 0; $i < count($this->banana); $i++) {
4331
+ " source" : " for ($i = 0; $i < count($this->banana); $i++) {
4332
4332
$x %= ($i * 2 ) / ($i - 1 );
4333
4333
$what = $this - > $x [++ $i ] ? ' yes!' : ' noo!' ;
4334
4334
}" ,
4335
4335
" start" : Position {
4336
- " column" : 9 ,
4336
+ " column" : 6 ,
4337
4337
" line" : 123 ,
4338
- " offset" : 2637 ,
4338
+ " offset" : 2634 ,
4339
4339
},
4340
4340
},
4341
4341
" shortForm" : false ,
@@ -5872,15 +5872,15 @@ next:
5872
5872
" line" : 102 ,
5873
5873
" offset" : 2111 ,
5874
5874
},
5875
- " source" : " ($bar) {
5875
+ " source" : " while ($bar) {
5876
5876
if ((int )calculateMeaningOfLife () === 42 ) {
5877
5877
break foo;
5878
5878
} else continue ;
5879
5879
}" ,
5880
5880
" start" : Position {
5881
- " column" : 11 ,
5881
+ " column" : 6 ,
5882
5882
" line" : 98 ,
5883
- " offset" : 1997 ,
5883
+ " offset" : 1992 ,
5884
5884
},
5885
5885
},
5886
5886
" shortForm" : false ,
@@ -5956,15 +5956,15 @@ next:
5956
5956
" line" : 107 ,
5957
5957
" offset" : 2196 ,
5958
5958
},
5959
- " source" : " {
5959
+ " source" : " do {
5960
5960
? >
5961
5961
Caesar : here I was
5962
5962
< ? php
5963
5963
} while (false );" ,
5964
5964
" start" : Position {
5965
- " column" : 9 ,
5965
+ " column" : 6 ,
5966
5966
" line" : 103 ,
5967
- " offset" : 2121 ,
5967
+ " offset" : 2118 ,
5968
5968
},
5969
5969
},
5970
5970
" test" : Boolean {
You can’t perform that action at this time.
0 commit comments