@@ -258,20 +258,23 @@ protected function createTokenMap() {
258258 // 256 is the minimum possible token number, as everything below
259259 // it is an ASCII value
260260 for ($ i = 256 ; $ i < 1000 ; ++$ i ) {
261- // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM
262261 if (T_DOUBLE_COLON === $ i ) {
262+ // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM
263263 $ tokenMap [$ i ] = Parser::T_PAAMAYIM_NEKUDOTAYIM ;
264- // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO
265264 } elseif (T_OPEN_TAG_WITH_ECHO === $ i ) {
265+ // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO
266266 $ tokenMap [$ i ] = Parser::T_ECHO ;
267- // T_CLOSE_TAG is equivalent to ';'
268267 } elseif (T_CLOSE_TAG === $ i ) {
268+ // T_CLOSE_TAG is equivalent to ';'
269269 $ tokenMap [$ i ] = ord ('; ' );
270- // and the others can be mapped directly
271- } elseif ('UNKNOWN ' !== ($ name = token_name ($ i ))
272- && defined ($ name = 'PhpParser\Parser:: ' . $ name )
273- ) {
274- $ tokenMap [$ i ] = constant ($ name );
270+ } elseif ('UNKNOWN ' !== $ name = token_name ($ i )) {
271+ if ('T_HASHBANG ' === $ name ) {
272+ // HHVM uses a special token for #! hashbang lines
273+ $ tokenMap [$ i ] = Parser::T_INLINE_HTML ;
274+ } else if (defined ($ name = 'PhpParser\Parser:: ' . $ name )) {
275+ // Other tokens can be mapped directly
276+ $ tokenMap [$ i ] = constant ($ name );
277+ }
275278 }
276279 }
277280
0 commit comments