diff --git a/pkgs/racket-doc/scribblings/reference/reader-example.rkt b/pkgs/racket-doc/scribblings/reference/reader-example.rkt index 6ad643f8c7..5cff915f99 100644 --- a/pkgs/racket-doc/scribblings/reference/reader-example.rkt +++ b/pkgs/racket-doc/scribblings/reference/reader-example.rkt @@ -15,7 +15,8 @@ dispatch-table dispatch metavar - cilitchar) + cilitchar + ci0litchar) (define (as-flow i) (make-flow (list (if (block? i) i @@ -135,16 +136,20 @@ (define (metavar . s) (make-element 'italic (decode-content s))) - (define (cilitchar s) + (define (cilitchar s #:just-first? [just-first? #f]) (let ([ss (map list->string (let loop ([l (string->list s)]) (if (null? l) (list null) (let ([r (loop (cdr l))]) (if (char-alphabetic? (car l)) - (append - (map (lambda (i) (cons (char-downcase (car l)) i)) r) - (map (lambda (i) (cons (char-upcase (car l)) i)) r)) + (if just-first? + (list + (cons (char-downcase (car l)) (cdr l)) + (cons (char-upcase (car l)) (cdr l))) + (append + (map (lambda (i) (cons (char-downcase (car l)) i)) r) + (map (lambda (i) (cons (char-upcase (car l)) i)) r))) (map (lambda (i) (cons (car l) i)) r))))))]) (case (length ss) [(1) (litchar (car ss))] @@ -157,5 +162,8 @@ (list " or " (litchar (car ss))) (list* (litchar (car ss)) ", " - (loop (cdr ss))))))])))) + (loop (cdr ss))))))]))) + + (define (ci0litchar s) + (cilitchar s #:just-first? #t))) diff --git a/pkgs/racket-doc/scribblings/reference/reader.scrbl b/pkgs/racket-doc/scribblings/reference/reader.scrbl index acf601db5a..d6a9feb638 100644 --- a/pkgs/racket-doc/scribblings/reference/reader.scrbl +++ b/pkgs/racket-doc/scribblings/reference/reader.scrbl @@ -113,13 +113,13 @@ on the next character or characters in the input stream as follows: @dispatch[@litchar{#[}]{starts a @tech{vector}; see @secref["parse-vector"]} @dispatch[@litchar["#{"]]{starts a @tech{vector}; see @secref["parse-vector"]} - @dispatch[@litchar{#fl(}]{starts a @tech{flvector}; see @secref["parse-vector"]} - @dispatch[@litchar{#fl[}]{starts a @tech{flvector}; see @secref["parse-vector"]} - @dispatch[@litchar["#fl{"]]{starts a @tech{flvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar{#fl(}]{starts a @tech{flvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar{#fl[}]{starts a @tech{flvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar["#fl{"]]{starts a @tech{flvector}; see @secref["parse-vector"]} - @dispatch[@litchar{#fx(}]{starts a @tech{fxvector}; see @secref["parse-vector"]} - @dispatch[@litchar{#fx[}]{starts a @tech{fxvector}; see @secref["parse-vector"]} - @dispatch[@litchar["#fx{"]]{starts a @tech{fxvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar{#fx(}]{starts a @tech{fxvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar{#fx[}]{starts a @tech{fxvector}; see @secref["parse-vector"]} + @dispatch[@ci0litchar["#fx{"]]{starts a @tech{fxvector}; see @secref["parse-vector"]} @dispatch[@litchar{#s(}]{starts a @tech{structure} literal; see @secref["parse-structure"]} @dispatch[@litchar{#s[}]{starts a @tech{structure} literal; see @secref["parse-structure"]} @@ -170,10 +170,18 @@ on the next character or characters in the input stream as follows: @dispatch[@elem{@litchar{#fl}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{[}}]{starts a flvector; see @secref["parse-vector"]} @dispatch[@elem{@litchar{#fl}@kleeneplus{@nonterm{digit@sub{10}}}@litchar["{"]}]{starts a flvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fl}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{(}}]{starts a flvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fl}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{[}}]{starts a flvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fl}@kleeneplus{@nonterm{digit@sub{10}}}@litchar["{"]}]{starts a flvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{(}}]{starts a fxvector; see @secref["parse-vector"]} @dispatch[@elem{@litchar{#fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{[}}]{starts a fxvector; see @secref["parse-vector"]} @dispatch[@elem{@litchar{#fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar["{"]}]{starts a fxvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{(}}]{starts a fxvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar{[}}]{starts a fxvector; see @secref["parse-vector"]} + @dispatch[@elem{@litchar{#Fx}@kleeneplus{@nonterm{digit@sub{10}}}@litchar["{"]}]{starts a fxvector; see @secref["parse-vector"]} + @dispatch[@graph-defn[]]{binds a graph tag; see @secref["parse-graph"]} @dispatch[@graph-ref[]]{uses a graph tag; see @secref["parse-graph"]} @@ -784,7 +792,8 @@ one of the following forms: @item{@litchar{#\}@nonterm{c}: the character @nonterm{c}, as long as @litchar{#\}@nonterm{c} and the characters following it - do not match any of the previous cases, and as long as the + do not match any of the previous cases, and as long as + @nonterm{c} or the character after @nonterm{c} is not @racketlink[char-alphabetic?]{alphabetic}.} @@ -941,7 +950,7 @@ If the @racket[read-accept-reader] or @racket[read-accept-lang] @tech{parameter} is set to @racket[#f], then if the reader encounters @litchar{#lang} or equivalent @litchar{#!}, the @exnraise[exn:fail:read]. -@section[#:tag "parse-cdot"]{Reading with C-style infix dot notation} +@section[#:tag "parse-cdot"]{Reading with C-style Infix-Dot Notation} When the @racket[read-cdot] @tech{parameter} is set to @racket[#t], then a variety of changes occur in the reader.