commit
ced25315ac
|
@ -463,6 +463,12 @@ END
|
||||||
"<a href=\"#\">inner</a>"
|
"<a href=\"#\">inner</a>"
|
||||||
'(a ([href "#"]) "inner"))
|
'(a ([href "#"]) "inner"))
|
||||||
|
|
||||||
|
(test-syntax:read-xml/element
|
||||||
|
"<a c=\"1\" a=\"2\" b=\"3\">inner</a>"
|
||||||
|
'(a ([c "1"] [a "2"] [b "3"]) "inner"))
|
||||||
|
|
||||||
|
(test-syntax:read-xml/element/exn "<a c=\"1\" a=\"2\" c=\"3\">inner</a>" "read-xml: lex-error: at position 1.20/21: duplicated attribute name c")
|
||||||
|
|
||||||
(test-syntax:read-xml/element
|
(test-syntax:read-xml/element
|
||||||
"<root> </root>"
|
"<root> </root>"
|
||||||
'(root () nbsp))
|
'(root () nbsp))
|
||||||
|
|
|
@ -270,17 +270,16 @@
|
||||||
|
|
||||||
;; lex-attributes : Input-port (-> Location) -> (listof Attribute)
|
;; lex-attributes : Input-port (-> Location) -> (listof Attribute)
|
||||||
(define (lex-attributes in pos)
|
(define (lex-attributes in pos)
|
||||||
(sort (let loop ()
|
(let* ([result_list
|
||||||
|
(let loop ()
|
||||||
(skip-space in)
|
(skip-space in)
|
||||||
(cond [(name-start? (peek-char-or-special in))
|
(cond [(name-start? (peek-char-or-special in))
|
||||||
(cons (lex-attribute in pos) (loop))]
|
(cons (lex-attribute in pos) (loop))]
|
||||||
[else null]))
|
[else null]))]
|
||||||
(lambda (a b)
|
[check_dup (check-duplicates result_list (lambda (a b) (eq? (attribute-name a) (attribute-name b))))])
|
||||||
(let ([na (attribute-name a)]
|
(if check_dup
|
||||||
[nb (attribute-name b)])
|
(lex-error in pos "duplicated attribute name ~a" (attribute-name check_dup))
|
||||||
(cond
|
result_list)))
|
||||||
[(eq? na nb) (lex-error in pos "duplicated attribute name ~a" na)]
|
|
||||||
[else (string<? (symbol->string na) (symbol->string nb))])))))
|
|
||||||
|
|
||||||
;; lex-attribute : Input-port (-> Location) -> Attribute
|
;; lex-attribute : Input-port (-> Location) -> Attribute
|
||||||
(define (lex-attribute in pos)
|
(define (lex-attribute in pos)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user