@@ -52,24 +52,22 @@ private void Advance(int positons) {
52
52
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
53
53
private string GetNumbers ( ) {
54
54
int start = this . _position ;
55
- int length = this . _input . Slice ( this . _position ) . IndexOf ( ( byte ) ';' ) ;
56
- this . _position += length ;
57
- return this . _inputEncoding . GetString ( this . _input . Slice ( start , length ) ) ;
55
+ while ( this . _input [ this . _position ] != ( byte ) ';' ) {
56
+ this . _position ++ ;
57
+ }
58
+ return this . _inputEncoding . GetString ( this . _input . Slice ( start , this . _position - start ) ) ;
58
59
}
59
60
60
61
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
61
62
private int GetLength ( ) {
62
- int length = 0 ;
63
- for ( ; this . _input [ this . _position ] != ':' ; this . _position ++ ) {
64
- length = length * 10 + ( _input [ _position ] - 48 ) ;
63
+ if ( this . _input [ this . _position + 1 ] == ':' ) {
64
+ return _input [ _position ++ ] - 48 ;
65
65
}
66
- return length ;
67
- }
68
-
69
-
70
- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
71
- private string GetNCharacters ( int length ) {
72
- return _inputEncoding . GetString ( this . _input . Slice ( this . _position , length ) ) ;
66
+ int start = this . _position ;
67
+ while ( this . _input [ this . _position ] != ( byte ) ':' ) {
68
+ this . _position ++ ;
69
+ }
70
+ return int . Parse ( this . _input . Slice ( start , this . _position - start ) ) ;
73
71
}
74
72
75
73
internal void GetToken ( ) {
@@ -127,7 +125,7 @@ private void GetStringToken() {
127
125
this . _tokens [ this . _tokenPosition ++ ] = new PhpToken (
128
126
PhpDataType . String ,
129
127
position ,
130
- this . GetNCharacters ( length )
128
+ _inputEncoding . GetString ( this . _input . Slice ( this . _position , length ) )
131
129
) ;
132
130
this . Advance ( 2 + length ) ;
133
131
}
@@ -178,7 +176,7 @@ private void GetObjectToken() {
178
176
this . Advance ( ) ;
179
177
int classNameLength = this . GetLength ( ) ;
180
178
this . Advance ( 2 ) ;
181
- string className = this . GetNCharacters ( classNameLength ) ;
179
+ string className = _inputEncoding . GetString ( this . _input . Slice ( this . _position , classNameLength ) ) ;
182
180
this . Advance ( 2 + classNameLength ) ;
183
181
int propertyCount = this . GetLength ( ) ;
184
182
this . _tokens [ this . _tokenPosition ++ ] = new PhpToken (
0 commit comments