In Scheme mode @|| will also throw an error instead of being read as a

comment.  This is to avoid confusing situations like

  (define foo (list x '@|| y))

which quoted the `y' since @|| was read as a comment.

svn: r15789
This commit is contained in:
Eli Barzilay 2009-08-21 11:11:21 +00:00
parent 7d69ec01c2
commit 1ea8c66511
2 changed files with 22 additions and 4 deletions

View File

@ -391,10 +391,12 @@
(let*-values ([(line col pos) (port-next-location inp)]
[(xs) (get)])
(cond [(not xs) xs]
[(null? xs) (make-special-comment #f)]
[(null? (cdr xs)) (car xs)]
[else (read-error line col pos
"too many escape expressions")]))
[(or (null? xs) (not (null? (cdr xs))))
(read-error line col pos
"a ~a|...| form in Scheme mode must have ~a"
ch:command
"exactly one escaped expression")]
[else (car xs)]))
(get))))
;; called only when we must see a command in the input

View File

@ -636,6 +636,22 @@ bar}
---
\foo{\" -\error-> #rx":1:6: read: expected a closing '\"'$"
---
@|1 2|
-@error->
#rx"a @|...| form in Scheme mode must have exactly one escaped expression"
---
@||
-@error->
#rx"a @|...| form in Scheme mode must have exactly one escaped expression"
---
\|1 2|
-\error->
#rx"a \\\\|...| form in Scheme mode must have exactly one escaped expression"
---
\||
-\error->
#rx"a \\\\|...| form in Scheme mode must have exactly one escaped expression"
---
;; -------------------- inside-reader
---
foo bar baz -@i-> "foo bar baz"