diff --git a/basis/xml/syntax/syntax.factor b/basis/xml/syntax/syntax.factor index f395920..f41f17e 100644 --- a/basis/xml/syntax/syntax.factor +++ b/basis/xml/syntax/syntax.factor @@ -5,7 +5,7 @@ sequences summary lexer splitting combinators locals xml.data memoize sequences.deep xml.data xml.state xml namespaces present arrays generalizations strings make math macros multiline inverse combinators.short-circuit sorting fry unicode.categories -effects ; +effects hashtables ; IN: xml.syntax alist 2dup delete-at* [ drop [ no-tag new throw ] ] unless suffix + '[ dup url>> _ case ] ; + : compile-tags ( word xtable -- quot ) - >alist swap '[ _ no-tag boa throw ] suffix + >alist [ build-cases ] assoc-map + swap '[ _ no-tag boa throw ] suffix '[ dup main>> _ case ] ; : define-tags ( word effect -- ) [ dup dup "xtable" word-prop compile-tags ] dip define-declared ; -:: define-tag ( string word quot -- ) - quot string word "xtable" word-prop set-at +:: define-tag ( tag namespace word quot -- ) + quot namespace tag word "xtable" word-prop + [ ?set-at ] change-at word word stack-effect define-tags ; PRIVATE> @@ -34,7 +40,10 @@ SYNTAX: TAGS: 2bi ; SYNTAX: TAG: - scan scan-word parse-definition define-tag ; + scan f scan-word parse-definition define-tag ; + +SYNTAX: TAG-NS: + scan scan scan-word parse-definition define-tag ; SYNTAX: XML-NS: CREATE-WORD scan '[ f swap _ ] (( string -- name )) define-memoized ;