@@ -173,7 +173,7 @@ public function parse($input, $flags = 0)
173173
174174 while (true ) {
175175 // retrieve state number from top of stack
176- $ state = $ this ->stack [count ($ this ->stack )-1 ];
176+ $ state = $ this ->stack [\ count ($ this ->stack )-1 ];
177177
178178 // use default actions if available
179179 if (isset ($ this ->defaultActions [$ state ])) {
@@ -198,7 +198,7 @@ public function parse($input, $flags = 0)
198198 }
199199
200200 $ message = null ;
201- if (in_array ("'STRING' " , $ expected ) && in_array (substr ($ this ->lexer ->match , 0 , 1 ), array ('" ' , "' " ))) {
201+ if (\ in_array ("'STRING' " , $ expected ) && \ in_array (substr ($ this ->lexer ->match , 0 , 1 ), array ('" ' , "' " ))) {
202202 $ message = "Invalid string " ;
203203 if ("' " === substr ($ this ->lexer ->match , 0 , 1 )) {
204204 $ message .= ", it appears you used single quotes instead of double quotes " ;
@@ -214,7 +214,7 @@ public function parse($input, $flags = 0)
214214 if ($ message ) {
215215 $ errStr .= $ message ;
216216 } else {
217- $ errStr .= (count ($ expected ) > 1 ) ? "Expected one of: " : "Expected: " ;
217+ $ errStr .= (\ count ($ expected ) > 1 ) ? "Expected one of: " : "Expected: " ;
218218 $ errStr .= implode (', ' , $ expected );
219219 }
220220
@@ -248,25 +248,25 @@ public function parse($input, $flags = 0)
248248 // try to recover from error
249249 while (true ) {
250250 // check for error recovery rule in this state
251- if (array_key_exists ($ TERROR , $ this ->table [$ state ])) {
251+ if (\ array_key_exists ($ TERROR , $ this ->table [$ state ])) {
252252 break ;
253253 }
254254 if ($ state == 0 ) {
255255 throw new ParsingException ($ errStr ?: 'Parsing halted. ' );
256256 }
257257 $ this ->popStack (1 );
258- $ state = $ this ->stack [count ($ this ->stack )-1 ];
258+ $ state = $ this ->stack [\ count ($ this ->stack )-1 ];
259259 }
260260
261261 $ preErrorSymbol = $ symbol ; // save the lookahead token
262262 $ symbol = $ TERROR ; // insert generic error symbol as new lookahead
263- $ state = $ this ->stack [count ($ this ->stack )-1 ];
263+ $ state = $ this ->stack [\ count ($ this ->stack )-1 ];
264264 $ action = isset ($ this ->table [$ state ][$ TERROR ]) ? $ this ->table [$ state ][$ TERROR ] : false ;
265265 $ recovering = 3 ; // allow 3 real symbols to be shifted before reporting a new error
266266 }
267267
268268 // this shouldn't happen, unless resolve defaults are off
269- if (is_array ($ action [0 ]) && count ($ action ) > 1 ) {
269+ if (\ is_array ($ action [0 ]) && \ count ($ action ) > 1 ) {
270270 throw new ParsingException ('Parse Error: multiple actions possible at state: ' . $ state . ', token: ' . $ symbol );
271271 }
272272
@@ -295,13 +295,13 @@ public function parse($input, $flags = 0)
295295 $ len = $ this ->productions_ [$ action [1 ]][1 ];
296296
297297 // perform semantic action
298- $ yyval ->token = $ this ->vstack [count ($ this ->vstack ) - $ len ]; // default to $$ = $1
298+ $ yyval ->token = $ this ->vstack [\ count ($ this ->vstack ) - $ len ]; // default to $$ = $1
299299 // default location, uses first token for firsts, last for lasts
300300 $ yyval ->store = array ( // _$ = store
301- 'first_line ' => $ this ->lstack [count ($ this ->lstack ) - ($ len ?: 1 )]['first_line ' ],
302- 'last_line ' => $ this ->lstack [count ($ this ->lstack ) - 1 ]['last_line ' ],
303- 'first_column ' => $ this ->lstack [count ($ this ->lstack ) - ($ len ?: 1 )]['first_column ' ],
304- 'last_column ' => $ this ->lstack [count ($ this ->lstack ) - 1 ]['last_column ' ],
301+ 'first_line ' => $ this ->lstack [\ count ($ this ->lstack ) - ($ len ?: 1 )]['first_line ' ],
302+ 'last_line ' => $ this ->lstack [\ count ($ this ->lstack ) - 1 ]['last_line ' ],
303+ 'first_column ' => $ this ->lstack [\ count ($ this ->lstack ) - ($ len ?: 1 )]['first_column ' ],
304+ 'last_column ' => $ this ->lstack [\ count ($ this ->lstack ) - 1 ]['last_column ' ],
305305 );
306306 $ r = $ this ->performAction ($ yyval , $ yytext , $ yyleng , $ yylineno , $ action [1 ], $ this ->vstack , $ this ->lstack );
307307
@@ -316,7 +316,7 @@ public function parse($input, $flags = 0)
316316 $ this ->stack [] = $ this ->productions_ [$ action [1 ]][0 ]; // push nonterminal (reduce)
317317 $ this ->vstack [] = $ yyval ->token ;
318318 $ this ->lstack [] = $ yyval ->store ;
319- $ newState = $ this ->table [$ this ->stack [count ($ this ->stack )-2 ]][$ this ->stack [count ($ this ->stack )-1 ]];
319+ $ newState = $ this ->table [$ this ->stack [\ count ($ this ->stack )-2 ]][$ this ->stack [\ count ($ this ->stack )-1 ]];
320320 $ this ->stack [] = $ newState ;
321321 break ;
322322
@@ -340,17 +340,17 @@ protected function parseError($str, $hash)
340340 private function performAction (stdClass $ yyval , $ yytext , $ yyleng , $ yylineno , $ yystate , &$ tokens )
341341 {
342342 // $0 = $len
343- $ len = count ($ tokens ) - 1 ;
343+ $ len = \ count ($ tokens ) - 1 ;
344344 switch ($ yystate ) {
345345 case 1 :
346346 $ yytext = preg_replace_callback ('{(?: \\\\["bfnrt/ \\\\]| \\\\u[a-fA-F0-9]{4})} ' , array ($ this , 'stringInterpolation ' ), $ yytext );
347347 $ yyval ->token = $ yytext ;
348348 break ;
349349 case 2 :
350350 if (strpos ($ yytext , 'e ' ) !== false || strpos ($ yytext , 'E ' ) !== false ) {
351- $ yyval ->token = floatval ($ yytext );
351+ $ yyval ->token = \ floatval ($ yytext );
352352 } else {
353- $ yyval ->token = strpos ($ yytext , '. ' ) === false ? intval ($ yytext ) : floatval ($ yytext );
353+ $ yyval ->token = strpos ($ yytext , '. ' ) === false ? \ intval ($ yytext ) : \ floatval ($ yytext );
354354 }
355355 break ;
356356 case 3 :
@@ -456,9 +456,9 @@ private function stringInterpolation($match)
456456 case '\" ' :
457457 return '" ' ;
458458 case '\b ' :
459- return chr (8 );
459+ return \ chr (8 );
460460 case '\f ' :
461- return chr (12 );
461+ return \ chr (12 );
462462 case '\n ' :
463463 return "\n" ;
464464 case '\r ' :
@@ -474,9 +474,9 @@ private function stringInterpolation($match)
474474
475475 private function popStack ($ n )
476476 {
477- $ this ->stack = array_slice ($ this ->stack , 0 , - (2 * $ n ));
478- $ this ->vstack = array_slice ($ this ->vstack , 0 , - $ n );
479- $ this ->lstack = array_slice ($ this ->lstack , 0 , - $ n );
477+ $ this ->stack = \ array_slice ($ this ->stack , 0 , - (2 * $ n ));
478+ $ this ->vstack = \ array_slice ($ this ->vstack , 0 , - $ n );
479+ $ this ->lstack = \ array_slice ($ this ->lstack , 0 , - $ n );
480480 }
481481
482482 private function lex ()
0 commit comments