@@ -73,17 +73,7 @@ public function deserialize(array $data): ATN
7373 $ this ->readRules ($ atn );
7474 $ this ->readModes ($ atn );
7575 $ sets = [];
76-
77- // First, deserialize sets with 16-bit arguments <= U+FFFF.
78- $ this ->readSets ($ sets , function () {
79- return $ this ->readInt ();
80- });
81-
82- // Next, deserialize sets with 32-bit arguments <= U+10FFFF.
83- $ this ->readSets ($ sets , function () {
84- return $ this ->readInt32 ();
85- });
86-
76+ $ this ->readSets ($ sets );
8777 $ this ->readEdges ($ atn , $ sets );
8878 $ this ->readDecisions ($ atn );
8979 $ this ->readLexerActions ($ atn );
@@ -138,11 +128,6 @@ private function readStates(ATN $atn): void
138128 }
139129
140130 $ ruleIndex = $ this ->readInt ();
141-
142- if ($ ruleIndex === 0xFFFF ) {
143- $ ruleIndex = -1 ;
144- }
145-
146131 $ s = $ this ->stateFactory ($ stype , $ ruleIndex );
147132
148133 if ($ stype === ATNState::LOOP_END ) {
@@ -222,11 +207,6 @@ private function readRules(ATN $atn): void
222207
223208 if ($ atn ->grammarType === ATN ::ATN_TYPE_LEXER ) {
224209 $ tokenType = $ this ->readInt ();
225-
226- if ($ tokenType === 0xFFFF ) {
227- $ tokenType = Token::EOF ;
228- }
229-
230210 $ atn ->ruleToTokenType [$ i ] = $ tokenType ;
231211 }
232212 }
@@ -260,7 +240,7 @@ private function readModes(ATN $atn): void
260240 /**
261241 * @param array<IntervalSet> $sets
262242 */
263- private function readSets (array &$ sets, callable $ readUnicode ): void
243+ private function readSets (array &$ sets ): void
264244 {
265245 $ m = $ this ->readInt ();
266246
@@ -276,8 +256,8 @@ private function readSets(array &$sets, callable $readUnicode): void
276256 }
277257
278258 for ($ j =0 ; $ j < $ n ; $ j ++) {
279- $ i1 = $ readUnicode ();
280- $ i2 = $ readUnicode ();
259+ $ i1 = $ this -> readInt ();
260+ $ i2 = $ this -> readInt ();
281261 $ iset ->addRange ($ i1 , $ i2 );
282262 }
283263 }
@@ -380,17 +360,7 @@ private function readLexerActions(ATN $atn): void
380360 for ($ i = 0 ; $ i < $ count ; $ i ++) {
381361 $ actionType = $ this ->readInt ();
382362 $ data1 = $ this ->readInt ();
383-
384- if ($ data1 === 0xFFFF ) {
385- $ data1 = -1 ;
386- }
387-
388363 $ data2 = $ this ->readInt ();
389-
390- if ($ data2 === 0xFFFF ) {
391- $ data2 = -1 ;
392- }
393-
394364 $ lexerAction = $ this ->lexerActionFactory ($ actionType , $ data1 , $ data2 );
395365 $ atn ->lexerActions [$ i ] = $ lexerAction ;
396366 }
@@ -628,14 +598,6 @@ private function readInt(): int
628598 return $ this ->data [$ this ->pos ++];
629599 }
630600
631- private function readInt32 (): int
632- {
633- $ low = $ this ->readInt ();
634- $ high = $ this ->readInt ();
635-
636- return $ low | ($ high << 16 );
637- }
638-
639601 /**
640602 * @param array<IntervalSet> $sets
641603 */
0 commit comments