@@ -18,59 +18,85 @@ module.exports = {
18
18
expr = this . read_expr_item ( ) ;
19
19
}
20
20
// binary operations
21
- if ( this . token === "|" )
21
+ if ( this . token === "|" ) {
22
22
return result ( "bin" , "|" , expr , this . next ( ) . read_expr ( ) ) ;
23
- if ( this . token === "&" )
23
+ }
24
+ if ( this . token === "&" ) {
24
25
return result ( "bin" , "&" , expr , this . next ( ) . read_expr ( ) ) ;
25
- if ( this . token === "^" )
26
+ }
27
+ if ( this . token === "^" ) {
26
28
return result ( "bin" , "^" , expr , this . next ( ) . read_expr ( ) ) ;
27
- if ( this . token === "." )
29
+ }
30
+ if ( this . token === "." ) {
28
31
return result ( "bin" , "." , expr , this . next ( ) . read_expr ( ) ) ;
29
- if ( this . token === "+" )
32
+ }
33
+ if ( this . token === "+" ) {
30
34
return result ( "bin" , "+" , expr , this . next ( ) . read_expr ( ) ) ;
31
- if ( this . token === "-" )
35
+ }
36
+ if ( this . token === "-" ) {
32
37
return result ( "bin" , "-" , expr , this . next ( ) . read_expr ( ) ) ;
33
- if ( this . token === "*" )
38
+ }
39
+ if ( this . token === "*" ) {
34
40
return result ( "bin" , "*" , expr , this . next ( ) . read_expr ( ) ) ;
35
- if ( this . token === "/" )
41
+ }
42
+ if ( this . token === "/" ) {
36
43
return result ( "bin" , "/" , expr , this . next ( ) . read_expr ( ) ) ;
37
- if ( this . token === "%" )
44
+ }
45
+ if ( this . token === "%" ) {
38
46
return result ( "bin" , "%" , expr , this . next ( ) . read_expr ( ) ) ;
39
- if ( this . token === this . tok . T_POW )
47
+ }
48
+ if ( this . token === this . tok . T_POW ) {
40
49
return result ( "bin" , "**" , expr , this . next ( ) . read_expr ( ) ) ;
41
- if ( this . token === this . tok . T_SL )
50
+ }
51
+ if ( this . token === this . tok . T_SL ) {
42
52
return result ( "bin" , "<<" , expr , this . next ( ) . read_expr ( ) ) ;
43
- if ( this . token === this . tok . T_SR )
53
+ }
54
+ if ( this . token === this . tok . T_SR ) {
44
55
return result ( "bin" , ">>" , expr , this . next ( ) . read_expr ( ) ) ;
56
+ }
45
57
// more binary operations (formerly bool)
46
- if ( this . token === this . tok . T_BOOLEAN_OR )
58
+ if ( this . token === this . tok . T_BOOLEAN_OR ) {
47
59
return result ( "bin" , "||" , expr , this . next ( ) . read_expr ( ) ) ;
48
- if ( this . token === this . tok . T_LOGICAL_OR )
60
+ }
61
+ if ( this . token === this . tok . T_LOGICAL_OR ) {
49
62
return result ( "bin" , "or" , expr , this . next ( ) . read_expr ( ) ) ;
50
- if ( this . token === this . tok . T_BOOLEAN_AND )
63
+ }
64
+ if ( this . token === this . tok . T_BOOLEAN_AND ) {
51
65
return result ( "bin" , "&&" , expr , this . next ( ) . read_expr ( ) ) ;
52
- if ( this . token === this . tok . T_LOGICAL_AND )
66
+ }
67
+ if ( this . token === this . tok . T_LOGICAL_AND ) {
53
68
return result ( "bin" , "and" , expr , this . next ( ) . read_expr ( ) ) ;
54
- if ( this . token === this . tok . T_LOGICAL_XOR )
69
+ }
70
+ if ( this . token === this . tok . T_LOGICAL_XOR ) {
55
71
return result ( "bin" , "xor" , expr , this . next ( ) . read_expr ( ) ) ;
56
- if ( this . token === this . tok . T_IS_IDENTICAL )
72
+ }
73
+ if ( this . token === this . tok . T_IS_IDENTICAL ) {
57
74
return result ( "bin" , "===" , expr , this . next ( ) . read_expr ( ) ) ;
58
- if ( this . token === this . tok . T_IS_NOT_IDENTICAL )
75
+ }
76
+ if ( this . token === this . tok . T_IS_NOT_IDENTICAL ) {
59
77
return result ( "bin" , "!==" , expr , this . next ( ) . read_expr ( ) ) ;
60
- if ( this . token === this . tok . T_IS_EQUAL )
78
+ }
79
+ if ( this . token === this . tok . T_IS_EQUAL ) {
61
80
return result ( "bin" , "==" , expr , this . next ( ) . read_expr ( ) ) ;
62
- if ( this . token === this . tok . T_IS_NOT_EQUAL )
81
+ }
82
+ if ( this . token === this . tok . T_IS_NOT_EQUAL ) {
63
83
return result ( "bin" , "!=" , expr , this . next ( ) . read_expr ( ) ) ;
64
- if ( this . token === "<" )
84
+ }
85
+ if ( this . token === "<" ) {
65
86
return result ( "bin" , "<" , expr , this . next ( ) . read_expr ( ) ) ;
66
- if ( this . token === ">" )
87
+ }
88
+ if ( this . token === ">" ) {
67
89
return result ( "bin" , ">" , expr , this . next ( ) . read_expr ( ) ) ;
68
- if ( this . token === this . tok . T_IS_SMALLER_OR_EQUAL )
90
+ }
91
+ if ( this . token === this . tok . T_IS_SMALLER_OR_EQUAL ) {
69
92
return result ( "bin" , "<=" , expr , this . next ( ) . read_expr ( ) ) ;
70
- if ( this . token === this . tok . T_IS_GREATER_OR_EQUAL )
93
+ }
94
+ if ( this . token === this . tok . T_IS_GREATER_OR_EQUAL ) {
71
95
return result ( "bin" , ">=" , expr , this . next ( ) . read_expr ( ) ) ;
72
- if ( this . token === this . tok . T_SPACESHIP )
96
+ }
97
+ if ( this . token === this . tok . T_SPACESHIP ) {
73
98
return result ( "bin" , "<=>" , expr , this . next ( ) . read_expr ( ) ) ;
99
+ }
74
100
if ( this . token === this . tok . T_INSTANCEOF ) {
75
101
expr = result (
76
102
"bin" ,
@@ -89,8 +115,9 @@ module.exports = {
89
115
90
116
// extra operations :
91
117
// $username = $_GET['user'] ?? 'nobody';
92
- if ( this . token === this . tok . T_COALESCE )
118
+ if ( this . token === this . tok . T_COALESCE ) {
93
119
return result ( "bin" , "??" , expr , this . next ( ) . read_expr ( ) ) ;
120
+ }
94
121
95
122
// extra operations :
96
123
// $username = $_GET['user'] ? true : false;
@@ -226,14 +253,18 @@ module.exports = {
226
253
*/
227
254
read_expr_item : function ( ) {
228
255
let result , expr ;
229
- if ( this . token === "+" )
256
+ if ( this . token === "+" ) {
230
257
return this . node ( "unary" ) ( "+" , this . next ( ) . read_expr ( ) ) ;
231
- if ( this . token === "-" )
258
+ }
259
+ if ( this . token === "-" ) {
232
260
return this . node ( "unary" ) ( "-" , this . next ( ) . read_expr ( ) ) ;
233
- if ( this . token === "!" )
261
+ }
262
+ if ( this . token === "!" ) {
234
263
return this . node ( "unary" ) ( "!" , this . next ( ) . read_expr ( ) ) ;
235
- if ( this . token === "~" )
264
+ }
265
+ if ( this . token === "~" ) {
236
266
return this . node ( "unary" ) ( "~" , this . next ( ) . read_expr ( ) ) ;
267
+ }
237
268
238
269
if ( this . token === "(" ) {
239
270
expr = this . next ( ) . read_expr ( ) ;
@@ -299,8 +330,9 @@ module.exports = {
299
330
}
300
331
}
301
332
302
- if ( this . token === this . tok . T_CLONE )
333
+ if ( this . token === this . tok . T_CLONE ) {
303
334
return this . node ( "clone" ) ( this . next ( ) . read_expr ( ) ) ;
335
+ }
304
336
305
337
switch ( this . token ) {
306
338
case this . tok . T_INC :
0 commit comments