add file-or-directory-identity (4.1.2.5)

svn: r15623

original commit: a47d94f75f4099c5fcc1ed8a85fad456a0d7537f
This commit is contained in:
Matthew Flatt 2009-07-29 17:39:03 +00:00
parent 1786776961
commit 2d86232ba0
2 changed files with 22 additions and 13 deletions

View File

@ -11,7 +11,8 @@
(and (content? i)
(not (list? i)))
(and (splice? i)
(andmap pre-content? (splice-run i)))))
(andmap pre-content? (splice-run i)))
(void? i)))
(define (pre-flow? i)
(or (string? i)
@ -19,7 +20,8 @@
(not (list? i)))
(block? i)
(and (splice? i)
(andmap pre-flow? (splice-run i)))))
(andmap pre-flow? (splice-run i)))
(void? i)))
(define (pre-part? v)
(or (pre-flow? v)
@ -150,6 +152,8 @@
l))
(decode-accum-para accum)
null))]
[(void? (car l))
(loop (cdr l) next? keys colls accum title tag-prefix tags vers style)]
[(title-decl? (car l))
(cond [(not part-depth) (error 'decode "misplaced title: ~e" (car l))]
[title (error 'decode "found extra title: ~v" (car l))]
@ -267,6 +271,7 @@
(define (match-newline-whitespace l)
(cond [(null? l) #f]
[(void? (car l)) (match-newline-whitespace (cdr l))]
[(line-break? (car l)) (skip-whitespace l)]
[(splice? (car l))
(match-newline-whitespace (append (splice-run (car l)) (cdr l)))]
@ -274,9 +279,11 @@
[else #f]))
(define (skip-whitespace l)
(if (or (null? l) (not (whitespace? (car l))))
l
(skip-whitespace (cdr l))))
(if (or (null? l)
(not (or (whitespace? (car l))
(void? (car l)))))
l
(skip-whitespace (cdr l))))
(define (decode l)
(decode-part l null #f 0))
@ -285,7 +292,10 @@
(make-paragraph plain (decode-content l)))
(define (decode-content l)
(append-map (lambda (s) (if (string? s) (decode-string s) (list s)))
(append-map (lambda (s) (cond
[(string? s) (decode-string s)]
[(void? s) null]
[else (list s)]))
(skip-whitespace l)))
(define (decode-compound-paragraph l)

View File

@ -59,9 +59,9 @@ Pre-content is decoded into @tech{content} by functions like
@defproc[(pre-flow? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is a @deftech{pre-flow} value: a
string or other non-list @scheme[content], a @scheme[block], or a
@scheme[splice] containing a list of @tech{pre-flow} values; otherwise
returns @scheme[#f].
string or other non-list @scheme[content], a @scheme[block],
@|void-const|, or a @scheme[splice] containing a list of
@tech{pre-flow} values; otherwise returns @scheme[#f].
Pre-flow is decoded into a @tech{flow} (i.e., a list of @tech{blocks})
by functions like @scheme[decode-flow].}
@ -73,8 +73,8 @@ Returns @scheme[#t] if @scheme[v] is a @deftech{pre-part} value: a
string or other non-list @scheme[content], a @scheme[block], a
@scheme[part], a @scheme[title-decl], a @scheme[part-start], a
@scheme[part-index-decl], a @scheme[part-collect-decl], a
@scheme[part-tag-decl], or a @scheme[splice] containing a list of
@tech{pre-part} values; otherwise returns @scheme[#f].
@scheme[part-tag-decl], @|void-const|, or a @scheme[splice] containing
a list of @tech{pre-part} values; otherwise returns @scheme[#f].
A pre-part sequences is decoded into a @scheme[part] by functions like
@scheme[decode] and @scheme[decode-part].}
@ -93,9 +93,8 @@ of @scheme[part-tag-decl] add hyperlink tags to the section
title. Instances of @scheme[part-start] at level 0 trigger sub-part
parsing. Instances of @scheme[section] trigger are used as-is as
subsections, and instances of @scheme[paragraph] and other
flow-element datatypes are used as-is in the enclosing flow.
flow-element datatypes are used as-is in the enclosing flow.}
}
@defproc[(decode-part [lst (listof pre-part?)]
[tags (listof string?)]