Transparent XML structs
This commit is contained in:
parent
801419693a
commit
a13edb18b6
|
@ -195,7 +195,7 @@ END
|
||||||
"~n<a <a>" "read-xml: lex-error: at position 2.4/6: expected / or > to close tag `a'")
|
"~n<a <a>" "read-xml: lex-error: at position 2.4/6: expected / or > to close tag `a'")
|
||||||
|
|
||||||
(test-read-xml/exn "" "read-xml: parse-error: expected root element - received #<eof>")
|
(test-read-xml/exn "" "read-xml: parse-error: expected root element - received #<eof>")
|
||||||
(test-read-xml/exn "<br /><br />" "read-xml: parse-error: extra stuff at end of document #<element>")
|
(test-read-xml/exn "<br /><br />" "read-xml: parse-error: extra stuff at end of document (element ")
|
||||||
|
|
||||||
(test-read-xml
|
(test-read-xml
|
||||||
"<doc><bold>hi</bold> there!</doc>"
|
"<doc><bold>hi</bold> there!</doc>"
|
||||||
|
@ -322,7 +322,7 @@ END
|
||||||
|
|
||||||
(test-read-xml/element/exn
|
(test-read-xml/element/exn
|
||||||
"<!-- comment --><br />"
|
"<!-- comment --><br />"
|
||||||
"read-xml: parse-error: expected root element - received #<comment>")
|
"read-xml: parse-error: expected root element - received (comment ")
|
||||||
|
|
||||||
(test-read-xml/element
|
(test-read-xml/element
|
||||||
"<title><![CDATA[hello world[mp3]]]></title>"
|
"<title><![CDATA[hello world[mp3]]]></title>"
|
||||||
|
@ -363,7 +363,7 @@ END
|
||||||
"~n<a <a>" "read-xml: lex-error: at position 2.4/6: expected / or > to close tag `a'")
|
"~n<a <a>" "read-xml: lex-error: at position 2.4/6: expected / or > to close tag `a'")
|
||||||
|
|
||||||
(test-syntax:read-xml/exn "" "read-xml: parse-error: expected root element - received #<eof>")
|
(test-syntax:read-xml/exn "" "read-xml: parse-error: expected root element - received #<eof>")
|
||||||
(test-syntax:read-xml/exn "<br /><br />" "read-xml: parse-error: extra stuff at end of document #<element>")
|
(test-syntax:read-xml/exn "<br /><br />" "read-xml: parse-error: extra stuff at end of document (element ")
|
||||||
|
|
||||||
(test-syntax:read-xml
|
(test-syntax:read-xml
|
||||||
"<doc><bold>hi</bold> there!</doc>"
|
"<doc><bold>hi</bold> there!</doc>"
|
||||||
|
@ -430,7 +430,7 @@ END
|
||||||
|
|
||||||
(test-syntax:read-xml/element/exn
|
(test-syntax:read-xml/element/exn
|
||||||
"<!-- comment --><br />"
|
"<!-- comment --><br />"
|
||||||
"read-xml: parse-error: expected root element - received #<comment>")
|
"read-xml: parse-error: expected root element - received (comment ")
|
||||||
|
|
||||||
; XXX need more syntax:read-xml/element tests
|
; XXX need more syntax:read-xml/element tests
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
; Location = (make-location Nat Nat Nat) | Symbol
|
; Location = (make-location Nat Nat Nat) | Symbol
|
||||||
(define-struct location (line char offset))
|
(define-struct location (line char offset) #:transparent)
|
||||||
|
|
||||||
; Source = (make-source Location Location)
|
; Source = (make-source Location Location)
|
||||||
(define-struct source (start stop))
|
(define-struct source (start stop) #:transparent)
|
||||||
|
|
||||||
; Document = (make-document Prolog Element (listof Misc))
|
; Document = (make-document Prolog Element (listof Misc))
|
||||||
(define-struct document (prolog element misc))
|
(define-struct document (prolog element misc) #:transparent)
|
||||||
|
|
||||||
; Prolog = (make-prolog (listof Misc) Document-type (listof Misc))
|
; Prolog = (make-prolog (listof Misc) Document-type (listof Misc))
|
||||||
(define-struct prolog (misc dtd misc2))
|
(define-struct prolog (misc dtd misc2) #:transparent)
|
||||||
|
|
||||||
; Document-type = (make-document-type sym External-dtd #f)
|
; Document-type = (make-document-type sym External-dtd #f)
|
||||||
; | #f
|
; | #f
|
||||||
(define-struct document-type (name external inlined))
|
(define-struct document-type (name external inlined) #:transparent)
|
||||||
|
|
||||||
; External-dtd = (make-external-dtd/public str str)
|
; External-dtd = (make-external-dtd/public str str)
|
||||||
; | (make-external-dtd/system str)
|
; | (make-external-dtd/system str)
|
||||||
; | #f
|
; | #f
|
||||||
(define-struct external-dtd (system))
|
(define-struct external-dtd (system) #:transparent)
|
||||||
(define-struct (external-dtd/public external-dtd) (public))
|
(define-struct (external-dtd/public external-dtd) (public) #:transparent)
|
||||||
(define-struct (external-dtd/system external-dtd) ())
|
(define-struct (external-dtd/system external-dtd) () #:transparent)
|
||||||
|
|
||||||
; Element = (make-element Location Location Symbol (listof Attribute) (listof Content))
|
; Element = (make-element Location Location Symbol (listof Attribute) (listof Content))
|
||||||
(define-struct (element source) (name attributes content))
|
(define-struct (element source) (name attributes content) #:transparent)
|
||||||
|
|
||||||
; Attribute = (make-attribute Location Location Symbol String)
|
; Attribute = (make-attribute Location Location Symbol String)
|
||||||
(define-struct (attribute source) (name value))
|
(define-struct (attribute source) (name value) #:transparent)
|
||||||
|
|
||||||
; Pcdata = (make-pcdata Location Location String)
|
; Pcdata = (make-pcdata Location Location String)
|
||||||
(define-struct (pcdata source) (string))
|
(define-struct (pcdata source) (string) #:transparent)
|
||||||
|
|
||||||
; Cdata = (make-cdata Location Location String)
|
; Cdata = (make-cdata Location Location String)
|
||||||
(define-struct (cdata source) (string))
|
(define-struct (cdata source) (string) #:transparent)
|
||||||
|
|
||||||
; Content = Pcdata
|
; Content = Pcdata
|
||||||
; | Element
|
; | Element
|
||||||
|
@ -45,14 +45,14 @@
|
||||||
; | Processing-instruction
|
; | Processing-instruction
|
||||||
|
|
||||||
; Entity = (make-entity Location Location (U Nat Symbol))
|
; Entity = (make-entity Location Location (U Nat Symbol))
|
||||||
(define-struct (entity source) (text))
|
(define-struct (entity source) (text) #:transparent)
|
||||||
|
|
||||||
; Processing-instruction = (make-p-i Location Location String String)
|
; Processing-instruction = (make-p-i Location Location String String)
|
||||||
; also represents XMLDecl
|
; also represents XMLDecl
|
||||||
(define-struct (p-i source) (target-name instruction))
|
(define-struct (p-i source) (target-name instruction) #:transparent)
|
||||||
|
|
||||||
; Comment = (make-comment String)
|
; Comment = (make-comment String)
|
||||||
(define-struct comment (text))
|
(define-struct comment (text) #:transparent)
|
||||||
|
|
||||||
; permissive-xexprs : parameter bool
|
; permissive-xexprs : parameter bool
|
||||||
(define permissive-xexprs (make-parameter #f))
|
(define permissive-xexprs (make-parameter #f))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user