jscl icon indicating copy to clipboard operation
jscl copied to clipboard

Reader needs to skip comments sometimes

Open davazp opened this issue 11 years ago • 4 comments
trafficstars

The reader does not know how to skip comments. It skipped semicolon comments but now it needs to be done properly.

'(1 2 #| foo |# . 3)

davazp avatar Jul 15 '14 02:07 davazp

Is this bug resolved after #159? If not then I don't understand this testcase.

With #159 applied, JSCL hangs when given '(1 2 . #| foo |#), as it does with '(1 2 . ), as there is nothing following the .. What is the expected behavior here? And if it should be different, surely that is a problem with the . syntax rather than the comment syntax?

orodley avatar Jul 15 '14 02:07 orodley

Sorry, I updated the description. The code was wrong.

davazp avatar Jul 15 '14 03:07 davazp

For example, compare:

(ls-read-from-string "(1 2 ;foo 
. 3)") ; => (1 2 . 3)

to

(ls-read-from-string "(1 2 #|foo|#
. 3)") ; => (1 2 |.| 3)

davazp avatar Jul 15 '14 03:07 davazp

Right, that makes sense. How to resolve this? I see that the reason this is happening is that semicolon comments are skipped in SKIP-WHITESPACES-AND-COMMENTS, which is called in the middle of reading lists. Should the #| |# code be added into this function, or are you planning on overhauling the code so this does not need to be special-cased?

orodley avatar Jul 15 '14 03:07 orodley