checkpoint
svn: r6702
This commit is contained in:
parent
a1db9b32a4
commit
513726af9e
|
@ -83,8 +83,8 @@ string for each end of line. For example:
|
|||
blah}
|
||||
|
||||
It is your responsibility to make sure that `foo' is bound (in any way:
|
||||
it can be either a function or a macro). To see the forms, you can use
|
||||
quote as usual, for example:
|
||||
it can be either a function or a macro, or in quoted forms). To see the
|
||||
forms, you can use quote as usual, for example:
|
||||
|
||||
'@foo{bar}
|
||||
|
||||
|
@ -97,8 +97,9 @@ wrapping the *whole* expression. For example:
|
|||
|
||||
When writing Scheme code, this means that @`',@foo{blah} is exactly the
|
||||
same as `@',@foo{blah} and `',@@foo{blah}, but unlike the latter two,
|
||||
the first construct can appear in body texts with the same meaning,
|
||||
whereas the other two would not work (see below).
|
||||
the first construct can appear in @-body texts with the same meaning,
|
||||
whereas the other two would not work (the punctuations will be taken as
|
||||
part of the text).
|
||||
|
||||
The command itself is not limited to a Scheme identifier -- it can be
|
||||
any Scheme expression:
|
||||
|
@ -120,14 +121,15 @@ and the ";"), then the construct is a comment. There are two comment
|
|||
forms, one for arbitrary-text and possibly nested comments, and another
|
||||
one for a -to-the-end-of-the-line comment:
|
||||
|
||||
@; <whitespace>* { ...any-text-including-newlines... }
|
||||
@;{ ...any-text-including-tested-scribble-pieces... }
|
||||
|
||||
@; <anything-that-doesn't-begin-with-a-brace-to-the-end-of-the-line>
|
||||
|
||||
Note that the first form is analogous to a "#;" comment: the commented
|
||||
body must still parse correctly. Also note that in the second form all
|
||||
text from the "@;" to the end of the line an all following (non-newline)
|
||||
whitespaces are part of the comment. For example:
|
||||
text from the "@;" to the end of the line and all following
|
||||
(non-newline) whitespaces are part of the comment (as with TeX `%'
|
||||
comments). For example:
|
||||
|
||||
@foo{bar @; comment --is-read-as--> (foo "bar baz")
|
||||
baz}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
;; Skips whitespace characters, sensitive to the current readtable's
|
||||
;; definition of whitespace; optimizes common spaces when possible
|
||||
(define/kw skip-whitespace
|
||||
(define skip-whitespace
|
||||
(let* ([plain-readtables (make-hash-table 'weak)]
|
||||
[plain-spaces '(#\space #\tab #\newline #\return #\page)]
|
||||
[plain-spaces-re
|
||||
|
@ -95,19 +95,14 @@
|
|||
|
||||
(define ((dispatcher start-inside?)
|
||||
char inp source-name line-num col-num position)
|
||||
(define (next-syntax readtable)
|
||||
(parameterize ([current-readtable readtable])
|
||||
(let loop ()
|
||||
(let ([x (read-syntax/recursive source-name inp)])
|
||||
(if (special-comment? x) (loop) x)))))
|
||||
(define (read-error msg . xs)
|
||||
(let-values ([(line col pos) (port-next-location inp)])
|
||||
(raise-read-error (apply format msg xs) source-name line col pos #f)))
|
||||
(define (cur-pos)
|
||||
(let-values ([(line col pos) (port-next-location inp)])
|
||||
pos))
|
||||
(define (span-from start)
|
||||
(and start (- (cur-pos) start)))
|
||||
(define (read-error msg . xs)
|
||||
(let-values ([(line col pos) (port-next-location inp)])
|
||||
(raise-read-error (apply format msg xs) source-name line col pos #f)))
|
||||
(define (read-from-bytes-exact-or-identifier bs)
|
||||
(let ([inp (open-input-bytes bs)]
|
||||
[default (lambda _ (string->symbol (bytes->string/utf-8 bs)))])
|
||||
|
@ -197,6 +192,7 @@
|
|||
(if (or (not (read-insert-indents)) (null? stxs))
|
||||
stxs
|
||||
(let ([mincol (apply min (map syntax/placeholder-column stxs))])
|
||||
;;!!!
|
||||
(let loop ([curline line-num] [stxs stxs] [r '()])
|
||||
(if (null? stxs)
|
||||
(reverse! r)
|
||||
|
@ -279,7 +275,12 @@
|
|||
(read-from-bytes-exact-or-identifier (cadr m))
|
||||
(list source-name line col pos (span-from pos)))
|
||||
#t))]
|
||||
[else (values (next-syntax cmd-readtable) #f)])))
|
||||
[else (values
|
||||
(parameterize ([current-readtable cmd-readtable])
|
||||
(let loop ()
|
||||
(let ([x (read-syntax/recursive source-name inp)])
|
||||
(if (special-comment? x) (loop) x))))
|
||||
#f)])))
|
||||
(cond
|
||||
[start-inside?
|
||||
(datum->syntax-object #f (get-lines)
|
||||
|
|
Loading…
Reference in New Issue
Block a user