]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/xml/dtd/dtd.factor
factor: trim using lists
[factor.git] / basis / xml / dtd / dtd.factor
index a668717626c3509c8f59bf2ca8a1bf11f213555f..29ab7e482cde95e5c73ba3f24c2d61247b73dcd7 100644 (file)
@@ -1,13 +1,9 @@
 ! Copyright (C) 2005, 2009 Daniel Ehrenberg, Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: xml.tokenize xml.data xml.state kernel sequences ascii
-fry xml.errors combinators hashtables namespaces xml.entities
-strings ;
+USING: combinators hashtables kernel namespaces xml.data
+xml.errors xml.name xml.state xml.tokenize ;
 IN: xml.dtd
 
-: take-word ( -- string )
-    [ get-char blank? ] take-until ;
-
 : take-decl-contents ( -- first second )
     pass-blank take-word pass-blank ">" take-string ;
 
@@ -18,38 +14,17 @@ IN: xml.dtd
     take-decl-contents <attlist-decl> ;
 
 : take-notation-decl ( -- notation-decl )
-    take-decl-contents <notation-decl> ; 
-
-: take-until-one-of ( seps -- str sep )
-    '[ get-char _ member? ] take-until get-char ;
-
-: take-system-id ( -- system-id )
-    parse-quote <system-id> close ;
-
-: take-public-id ( -- public-id )
-    parse-quote parse-quote <public-id> close ;
+    take-decl-contents <notation-decl> ;
 
 UNION: dtd-acceptable
     directive comment instruction ;
 
-: (take-external-id) ( token -- external-id )
-    pass-blank {
-        { "SYSTEM" [ take-system-id ] }
-        { "PUBLIC" [ take-public-id ] }
-        [ bad-external-id ]
-    } case ;
-
-: take-external-id ( -- external-id )
-    take-word (take-external-id) ;
-
-: only-blanks ( str -- )
-    [ blank? ] all? [ bad-decl ] unless ;
 : take-entity-def ( var -- entity-name entity-def )
     [
         take-word pass-blank get-char {
             { CHAR: ' [ parse-quote ] }
-            { CHAR: " [ parse-quote ] }
-            [ drop take-external-id ]
+            { CHAR: \" [ parse-quote ] }
+            [ drop take-external-id close ]
         } case
    ] dip '[ swap _ [ ?set-at ] change ] 2keep ;