Closed kjcjohnson closed 3 years ago
The current reader implementation gets baffled by a list where the final "element" is a comment. E.g.:
(list 1 2 3 ; only a comment here ) ; <-- closing parenthesis here
The problem is in ReadDelimitedList:
ReadDelimitedList
3
;
Read
ReadImpl
NothingSentinel
Maybe the fix is just to have ReadDelimitedList call ReadImpl instead of Read, and handle the NothingSentinel itself?
@WileyCorning - heads up if you're implementing anything with the S-expression parser. I'll fix this "soon", but it's easy to work around in the meantime (just remove the comment).
The current reader implementation gets baffled by a list where the final "element" is a comment. E.g.:
The problem is in
ReadDelimitedList
:3
, it consumes whitespace;
, which is not whitespace, so it recursively callsRead
to get the next S-expressionRead
callsReadImpl
, which returnsNothingSentinel
(as it was a comment), but then immediately tries to read another (real) token from the streamReadImpl
now reads the closing parenthesis, which signals an errorMaybe the fix is just to have
ReadDelimitedList
callReadImpl
instead ofRead
, and handle theNothingSentinel
itself?