File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11parameters :
2- level : 8
2+ level : 9
33 paths :
44 - src
55 - tests
Original file line number Diff line number Diff line change @@ -279,6 +279,7 @@ protected function doParse(): Program
279279 if ($ rule === 0 ) {
280280 /* accept */
281281 //$this->traceAccept();
282+ /** @phpstan-ignore return.type */
282283 return $ this ->semValue ;
283284 }
284285 if ($ rule !== $ this ->unexpectedTokenRule ) {
@@ -444,21 +445,21 @@ protected function createTokenMap(): array
444445 if ($ name === 'EOF ' || $ name === 'error ' ) {
445446 continue ;
446447 }
447- $ tokenMap [$ name ] = constant (static ::class . ':: ' . $ name );
448- }
448+ $ extSymbol = constant (static ::class . ':: ' . $ name );
449+
450+ if (!is_int ($ extSymbol )) {
451+ $ type = get_debug_type ($ extSymbol );
452+ throw new \Exception ("Unexpected external ID type $ type for token $ name " );
453+ }
449454
450- // We have created a map from token IDs to external symbol IDs.
451- // Now map them to the internal symbol ID.
452- $ fullTokenMap = [];
453- foreach ($ tokenMap as $ token => $ extSymbol ) {
454455 $ intSymbol = $ this ->tokenToSymbol [$ extSymbol ];
455456 if ($ intSymbol === $ this ->invalidSymbol ) {
456457 continue ;
457458 }
458- $ fullTokenMap [ $ token ] = $ intSymbol ;
459+ $ tokenMap [ $ name ] = $ intSymbol ;
459460 }
460461
461- return $ fullTokenMap ;
462+ return $ tokenMap ;
462463 }
463464
464465 /*
You can’t perform that action at this time.
0 commit comments