@@ -113,7 +113,7 @@ export function parse(query: string, options?: JSONQueryParseOptions): JSONQuery
113113 parseString ( ) ??
114114 parseUnquotedString ( ) ??
115115 parseInteger ( ) ??
116- throwError ( 'Property expected' )
116+ throwSyntaxError ( 'Property expected' )
117117 )
118118 }
119119
@@ -163,7 +163,10 @@ export function parse(query: string, options?: JSONQueryParseOptions): JSONQuery
163163 }
164164
165165 const key =
166- parseString ( ) ?? parseUnquotedString ( ) ?? parseInteger ( ) ?? throwError ( 'Key expected' )
166+ parseString ( ) ??
167+ parseUnquotedString ( ) ??
168+ parseInteger ( ) ??
169+ throwSyntaxError ( 'Key expected' )
167170
168171 skipWhitespace ( )
169172 eatChar ( ':' )
@@ -221,14 +224,14 @@ export function parse(query: string, options?: JSONQueryParseOptions): JSONQuery
221224 }
222225
223226 // end of the parsing chain
224- throwError ( 'Value expected' )
227+ throwSyntaxError ( 'Value expected' )
225228 }
226229
227230 const parseEnd = ( ) => {
228231 skipWhitespace ( )
229232
230233 if ( i < query . length ) {
231- throwError ( `Unexpected part '${ query . substring ( i ) } '` )
234+ throwSyntaxError ( `Unexpected part '${ query . substring ( i ) } '` )
232235 }
233236 }
234237
@@ -244,12 +247,12 @@ export function parse(query: string, options?: JSONQueryParseOptions): JSONQuery
244247
245248 const eatChar = ( char : string ) => {
246249 if ( query [ i ] !== char ) {
247- throwError ( `Character '${ char } ' expected` )
250+ throwSyntaxError ( `Character '${ char } ' expected` )
248251 }
249252 i ++
250253 }
251254
252- const throwError = ( message : string , pos = i ) => {
255+ const throwSyntaxError = ( message : string , pos = i ) => {
253256 throw new SyntaxError ( `${ message } (pos: ${ pos } )` )
254257 }
255258
0 commit comments