commit 6d84b17b7c4f043bb8b337780fb38d4bfd55e88b
parent 4ab5a49c9990e667b405348cd0073231f44d2c24
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Fri, 19 Apr 2013 20:40:37 -0600
scribble/reader: allow escape character to be non-ASCII
original commit: 96c5521196dc1fe19c401950775b2c8f8e80991f
Diffstat:
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/collects/scribblings/scribble/reader-internals.scrbl b/collects/scribblings/scribble/reader-internals.scrbl
@@ -198,7 +198,7 @@ Useful for implementing languages that are textual by default (see
@defproc[(make-at-readtable
[#:readtable readtable readtable? (current-readtable)]
- [#:command-char command-char character? #\@]
+ [#:command-char command-char char? #\@]
[#:datum-readtable datum-readtable
(or/c readtable? boolean?
(readtable? . -> . readtable?))
diff --git a/collects/tests/scribble/docs/diamond.rkt b/collects/tests/scribble/docs/diamond.rkt
@@ -0,0 +1,15 @@
+#lang racket/base
+(require (only-in scribble/reader make-at-readtable))
+
+(provide (rename-out [diamond-read read]
+ [diamond-read-syntax read-syntax]))
+
+(define diamond-readtable (make-at-readtable #:command-char #\◇))
+
+(define (diamond-read p)
+ (parameterize ([current-readtable diamond-readtable])
+ (read p)))
+
+(define (diamond-read-syntax name p)
+ (parameterize ([current-readtable diamond-readtable])
+ (read-syntax name p)))
diff --git a/collects/tests/scribble/docs/diamond.scrbl b/collects/tests/scribble/docs/diamond.scrbl
@@ -0,0 +1,14 @@
+#lang scribble/base
+@#reader "diamond.rkt"
+
+◇begin{
+
+ This example checks that @ is not an escape character
+ if we make a reader that uses a different escape character.
+
+ ◇(define ch "diamond")
+
+ It also makes sure that a non-ASCII character like ◇ch
+ is ok as an escape character.
+
+ }
diff --git a/collects/tests/scribble/docs/diamond.txt b/collects/tests/scribble/docs/diamond.txt
@@ -0,0 +1,5 @@
+This example checks that @ is not an escape character if we make a
+reader that uses a different escape character.
+
+It also makes sure that a non-ASCII character like diamond is ok as an
+escape character.