2121import com .semmle .util .io .WholeIO ;
2222import java .io .File ;
2323import java .util .ArrayList ;
24+ import java .util .Collections ;
2425import java .util .List ;
2526import java .util .regex .Matcher ;
2627import java .util .regex .Pattern ;
@@ -32,7 +33,6 @@ public class JSONParser {
3233 private int offset ;
3334 private int length ;
3435 private String src ;
35- private List <ParseError > recoverableErrors ;
3636
3737 public static Pair <JSONValue , List <ParseError >> parseValue (String json ) throws ParseError {
3838 JSONParser parser = new JSONParser (json );
@@ -41,14 +41,13 @@ public static Pair<JSONValue, List<ParseError>> parseValue(String json) throws P
4141 parser .consumeWhitespace ();
4242 if (parser .offset < parser .length ) parser .raise ("Expected end of input" );
4343
44- return Pair .make (value , parser . recoverableErrors );
44+ return Pair .make (value , Collections . emptyList () );
4545 }
4646
4747 private JSONParser (String json ) throws ParseError {
4848 this .line = 1 ;
4949 this .column = 0 ;
5050 this .offset = 0 ;
51- this .recoverableErrors = new ArrayList <ParseError >();
5251
5352 if (json == null ) raise ("Input string may not be null" );
5453 this .length = json .length ();
@@ -351,17 +350,16 @@ private void consumeWhitespace() throws ParseError {
351350 }
352351 }
353352
354- /** Skips the line comment starting at the current position and records a recoverable error . */
353+ /** Skips the line comment starting at the current position. */
355354 private void skipLineComment () throws ParseError {
356355 Position pos = new Position (line , column , offset );
357356 char c ;
358357 next ();
359358 next ();
360359 while ((c = peek ()) != '\r' && c != '\n' && c != -1 ) next ();
361- recoverableErrors .add (new ParseError ("Comments are not legal in JSON." , pos ));
362360 }
363361
364- /** Skips the block comment starting at the current position and records a recoverable error . */
362+ /** Skips the block comment starting at the current position. */
365363 private void skipBlockComment () throws ParseError {
366364 Position pos = new Position (line , column , offset );
367365 char c ;
@@ -376,7 +374,6 @@ private void skipBlockComment() throws ParseError {
376374 break ;
377375 }
378376 } while (true );
379- recoverableErrors .add (new ParseError ("Comments are not legal in JSON." , pos ));
380377 }
381378
382379 private void consume (char token ) throws ParseError {
0 commit comments