21
21
import com .semmle .util .io .WholeIO ;
22
22
import java .io .File ;
23
23
import java .util .ArrayList ;
24
+ import java .util .Collections ;
24
25
import java .util .List ;
25
26
import java .util .regex .Matcher ;
26
27
import java .util .regex .Pattern ;
@@ -32,7 +33,6 @@ public class JSONParser {
32
33
private int offset ;
33
34
private int length ;
34
35
private String src ;
35
- private List <ParseError > recoverableErrors ;
36
36
37
37
public static Pair <JSONValue , List <ParseError >> parseValue (String json ) throws ParseError {
38
38
JSONParser parser = new JSONParser (json );
@@ -41,14 +41,13 @@ public static Pair<JSONValue, List<ParseError>> parseValue(String json) throws P
41
41
parser .consumeWhitespace ();
42
42
if (parser .offset < parser .length ) parser .raise ("Expected end of input" );
43
43
44
- return Pair .make (value , parser . recoverableErrors );
44
+ return Pair .make (value , Collections . emptyList () );
45
45
}
46
46
47
47
private JSONParser (String json ) throws ParseError {
48
48
this .line = 1 ;
49
49
this .column = 0 ;
50
50
this .offset = 0 ;
51
- this .recoverableErrors = new ArrayList <ParseError >();
52
51
53
52
if (json == null ) raise ("Input string may not be null" );
54
53
this .length = json .length ();
@@ -351,17 +350,16 @@ private void consumeWhitespace() throws ParseError {
351
350
}
352
351
}
353
352
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. */
355
354
private void skipLineComment () throws ParseError {
356
355
Position pos = new Position (line , column , offset );
357
356
char c ;
358
357
next ();
359
358
next ();
360
359
while ((c = peek ()) != '\r' && c != '\n' && c != -1 ) next ();
361
- recoverableErrors .add (new ParseError ("Comments are not legal in JSON." , pos ));
362
360
}
363
361
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. */
365
363
private void skipBlockComment () throws ParseError {
366
364
Position pos = new Position (line , column , offset );
367
365
char c ;
@@ -376,7 +374,6 @@ private void skipBlockComment() throws ParseError {
376
374
break ;
377
375
}
378
376
} while (true );
379
- recoverableErrors .add (new ParseError ("Comments are not legal in JSON." , pos ));
380
377
}
381
378
382
379
private void consume (char token ) throws ParseError {
0 commit comments