Cope with extraneous whitespace in sexp reader
This commit is contained in:
parent
4df94ffe40
commit
074fd181c9
|
@ -81,6 +81,7 @@ public class SexpReader {
|
|||
}
|
||||
|
||||
public Object _read(int c) throws IOException {
|
||||
while (true) {
|
||||
switch (c) {
|
||||
case -1:
|
||||
return null;
|
||||
|
@ -103,8 +104,13 @@ public class SexpReader {
|
|||
default:
|
||||
if (Character.isDigit(c)) {
|
||||
return new SexpBytes(_readSimpleString(c - '0'));
|
||||
} else if (Character.isWhitespace(c)) {
|
||||
// Skip harmless (?) whitespace
|
||||
c = _input.read();
|
||||
continue;
|
||||
} else {
|
||||
throw new SexpSyntaxError("Unexpected character");
|
||||
throw new SexpSyntaxError("Unexpected character: " + c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue