@@ -86,20 +86,20 @@ var (
8686func (d * intDecoder ) decodeByte (buf []byte , cursor int64 ) ([]byte , int64 , error ) {
8787 b := (* sliceHeader )(unsafe .Pointer (& buf )).data
8888 if char (b , cursor ) != 'i' {
89- return nil , cursor , errors .ErrExpected ("int" , cursor )
89+ return nil , cursor , errors .ErrUnexpected ("int" , cursor , buf [ cursor ] )
9090 }
9191
9292 cursor ++
9393 if char (b , cursor ) != ':' {
94- return nil , cursor , errors .ErrExpected ("int sep ':'" , cursor )
94+ return nil , cursor , errors .ErrUnexpected ("int sep ':'" , cursor , buf [ cursor ] )
9595 }
9696 cursor ++
9797
9898 switch char (b , cursor ) {
9999 case '0' :
100100 cursor ++
101101 if char (b , cursor ) != ';' {
102- return nil , cursor , errors .ErrExpected ("';' end int" , cursor )
102+ return nil , cursor , errors .ErrUnexpected ("';' end int" , cursor , buf [ cursor ] )
103103 }
104104 return numZeroBuf , cursor + 1 , nil
105105 case '-' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' :
@@ -109,7 +109,7 @@ func (d *intDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error)
109109 cursor ++
110110 }
111111 if char (b , cursor ) != ';' {
112- return nil , cursor , errors .ErrExpected ("';' end int" , cursor )
112+ return nil , cursor , errors .ErrUnexpected ("';' end int" , cursor , buf [ cursor ] )
113113 }
114114 num := buf [start :cursor ]
115115 return num , cursor + 1 , nil
@@ -155,20 +155,20 @@ func (d *intDecoder) processBytes(bytes []byte, cursor int64, rv reflect.Value)
155155func readInt (buf []byte , cursor int64 ) (int , int64 , error ) {
156156 b := (* sliceHeader )(unsafe .Pointer (& buf )).data
157157 if char (b , cursor ) != 'i' {
158- return 0 , cursor , errors .ErrExpected ("'i' to start a int" , cursor )
158+ return 0 , cursor , errors .ErrUnexpected ("'i' to start a int" , cursor , buf [ cursor ] )
159159 }
160160
161161 cursor ++
162162 if char (b , cursor ) != ':' {
163- return 0 , cursor , errors .ErrExpected ("int sep ':'" , cursor )
163+ return 0 , cursor , errors .ErrUnexpected ("int sep ':'" , cursor , buf [ cursor ] )
164164 }
165165 cursor ++
166166
167167 switch char (b , cursor ) {
168168 case '0' :
169169 cursor ++
170170 if char (b , cursor ) != ';' {
171- return 0 , cursor , errors .ErrExpected ("';' end int" , cursor )
171+ return 0 , cursor , errors .ErrUnexpected ("';' end int" , cursor , buf [ cursor ] )
172172 }
173173 cursor ++
174174 return 0 , cursor , nil
@@ -180,12 +180,12 @@ func readInt(buf []byte, cursor int64) (int, int64, error) {
180180 }
181181
182182 if char (b , cursor ) != ';' {
183- return 0 , cursor , errors .ErrExpected ("';' end int" , cursor )
183+ return 0 , cursor , errors .ErrUnexpected ("';' end int" , cursor , buf [ cursor ] )
184184 }
185185 value := parseByteStringInt (buf [start :cursor ])
186186 cursor ++
187187 return value , cursor , nil
188188 default :
189- return 0 , 0 , errors .ErrExpected ("int" , cursor )
189+ return 0 , 0 , errors .ErrUnexpected ("int" , cursor , buf [ cursor ] )
190190 }
191191}
0 commit comments