From 6d84b17b7c4f043bb8b337780fb38d4bfd55e88b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 19 Apr 2013 20:40:37 -0600 Subject: [PATCH] scribble/reader: allow escape character to be non-ASCII original commit: 96c5521196dc1fe19c401950775b2c8f8e80991f --- .../scribblings/scribble/reader-internals.scrbl | 2 +- collects/tests/scribble/docs/diamond.rkt | 15 +++++++++++++++ collects/tests/scribble/docs/diamond.scrbl | 14 ++++++++++++++ collects/tests/scribble/docs/diamond.txt | 5 +++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 collects/tests/scribble/docs/diamond.rkt create mode 100644 collects/tests/scribble/docs/diamond.scrbl create mode 100644 collects/tests/scribble/docs/diamond.txt diff --git a/collects/scribblings/scribble/reader-internals.scrbl b/collects/scribblings/scribble/reader-internals.scrbl index 81ca17d3..5a94f199 100644 --- 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 new file mode 100644 index 00000000..28a203d0 --- /dev/null +++ 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 new file mode 100644 index 00000000..f8a257b8 --- /dev/null +++ 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 new file mode 100644 index 00000000..ef48f8a9 --- /dev/null +++ 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.