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