]> gitweb.factorcode.org Git - factor.git/commitdiff
Summaries for XML internal vocabs
authorDaniel Ehrenberg <littledan@Macintosh-103.local>
Fri, 23 Jan 2009 01:04:48 +0000 (19:04 -0600)
committerDaniel Ehrenberg <littledan@Macintosh-103.local>
Fri, 23 Jan 2009 01:04:48 +0000 (19:04 -0600)
15 files changed:
basis/xml/autoencoding/summary.txt [new file with mode: 0644]
basis/xml/char-classes/summary.txt [new file with mode: 0644]
basis/xml/data/data.factor
basis/xml/data/summary.txt [new file with mode: 0644]
basis/xml/dtd/summary.txt [new file with mode: 0644]
basis/xml/elements/summary.txt [new file with mode: 0644]
basis/xml/entities/summary.txt [new file with mode: 0644]
basis/xml/errors/summary.txt [new file with mode: 0644]
basis/xml/name/authors.txt [new file with mode: 0644]
basis/xml/name/summary.txt [new file with mode: 0644]
basis/xml/state/summary.txt [new file with mode: 0644]
basis/xml/tests/templating.factor
basis/xml/tokenize/summary.txt [new file with mode: 0644]
basis/xml/utilities/summary.txt [new file with mode: 0644]
basis/xml/writer/summary.txt [new file with mode: 0644]

diff --git a/basis/xml/autoencoding/summary.txt b/basis/xml/autoencoding/summary.txt
new file mode 100644 (file)
index 0000000..c7517b1
--- /dev/null
@@ -0,0 +1 @@
+Implements the automatic detection of encodings of XML documents
diff --git a/basis/xml/char-classes/summary.txt b/basis/xml/char-classes/summary.txt
new file mode 100644 (file)
index 0000000..8f70bdd
--- /dev/null
@@ -0,0 +1 @@
+XML-related character classes
index 68e91743d3eac084e1687580f5a721fecccebccb..8c024d938e09aab2781c83339a78ed15a674d9fd 100644 (file)
@@ -1,11 +1,16 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! Copyright (C) 2005, 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences sequences.private assocs arrays
 delegate.protocols delegate vectors accessors multiline
-macros words quotations combinators slots fry ;
+macros words quotations combinators slots fry strings ;
 IN: xml.data
 
-TUPLE: name space main url ;
+UNION: nullable-string string POSTPONE: f ;
+
+TUPLE: name
+    { space nullable-string }
+    { main string }
+    { url nullable-string } ;
 C: <name> name
 
 : ?= ( object/f object/f -- ? )
@@ -25,48 +30,7 @@ C: <name> name
 : assure-name ( string/name -- name )
     dup name? [ <null-name> ] unless ;
 
-TUPLE: opener name attrs ;
-C: <opener> opener
-
-TUPLE: closer name ;
-C: <closer> closer
-
-TUPLE: contained name attrs ;
-C: <contained> contained
-
-TUPLE: comment text ;
-C: <comment> comment
-
-TUPLE: directive ;
-
-TUPLE: element-decl < directive name content-spec ;
-C: <element-decl> element-decl
-
-TUPLE: attlist-decl < directive name att-defs ;
-C: <attlist-decl> attlist-decl
-
-TUPLE: entity-decl < directive name def pe? ;
-C: <entity-decl> entity-decl
-
-TUPLE: system-id system-literal ;
-C: <system-id> system-id
-
-TUPLE: public-id pubid-literal system-literal ;
-C: <public-id> public-id
-
-TUPLE: doctype-decl < directive name external-id internal-subset ;
-C: <doctype-decl> doctype-decl
-
-TUPLE: notation-decl < directive name id ;
-C: <notation-decl> notation-decl
-
-TUPLE: instruction text ;
-C: <instruction> instruction
-
-TUPLE: prolog version encoding standalone ;
-C: <prolog> prolog
-
-TUPLE: attrs alist ;
+TUPLE: attrs { alist sequence } ;
 C: <attrs> attrs
 
 : attr@ ( key alist -- index {key,value} )
@@ -105,7 +69,66 @@ M: attrs clone
 
 INSTANCE: attrs assoc
 
-TUPLE: tag name attrs children ;
+TUPLE: opener { name name } { attrs attrs } ;
+C: <opener> opener
+
+TUPLE: closer { name name } ;
+C: <closer> closer
+
+TUPLE: contained { name name } { attrs attrs } ;
+C: <contained> contained
+
+TUPLE: comment { text string } ;
+C: <comment> comment
+
+TUPLE: directive ;
+
+TUPLE: element-decl < directive
+    { name string } { content-spec string } ;
+C: <element-decl> element-decl
+
+TUPLE: attlist-decl < directive
+    { name string } { att-defs string } ;
+C: <attlist-decl> attlist-decl
+
+UNION: boolean t POSTPONE: f ;
+
+TUPLE: entity-decl < directive
+    { name string }
+    { def string }
+    { pe? boolean } ;
+C: <entity-decl> entity-decl
+
+TUPLE: system-id { system-literal string } ;
+C: <system-id> system-id
+
+TUPLE: public-id { pubid-literal string } { system-literal string } ;
+C: <public-id> public-id
+
+UNION: id system-id public-id POSTPONE: f ;
+
+TUPLE: doctype-decl < directive
+    { name string }
+    { external-id id }
+    { internal-subset sequence } ;
+C: <doctype-decl> doctype-decl
+
+TUPLE: notation-decl < directive name id ;
+C: <notation-decl> notation-decl
+
+TUPLE: instruction { text string } ;
+C: <instruction> instruction
+
+TUPLE: prolog
+    { version string }
+    { encoding string }
+    { standalone boolean } ;
+C: <prolog> prolog
+
+TUPLE: tag
+    { name name }
+    { attrs attrs }
+    { children sequence } ;
 
 : <tag> ( name attrs children -- tag )
     [ assure-name ] [ T{ attrs } assoc-like ] [ ] tri*
@@ -137,7 +160,11 @@ MACRO: clone-slots ( class -- tuple )
 M: tag clone
     tag clone-slots ;
 
-TUPLE: xml prolog before body after ;
+TUPLE: xml
+    { prolog prolog }
+    { before sequence }
+    { body tag }
+    { after sequence } ;
 C: <xml> xml
 
 CONSULT: sequence-protocol xml body>> ;
diff --git a/basis/xml/data/summary.txt b/basis/xml/data/summary.txt
new file mode 100644 (file)
index 0000000..d8f0f0d
--- /dev/null
@@ -0,0 +1 @@
+Contains XML data types and basic tools for manipulation
diff --git a/basis/xml/dtd/summary.txt b/basis/xml/dtd/summary.txt
new file mode 100644 (file)
index 0000000..8b0745f
--- /dev/null
@@ -0,0 +1 @@
+Implements the parsing of directives in DTDs
diff --git a/basis/xml/elements/summary.txt b/basis/xml/elements/summary.txt
new file mode 100644 (file)
index 0000000..c85b023
--- /dev/null
@@ -0,0 +1 @@
+Implements the parsing of XML tags
diff --git a/basis/xml/entities/summary.txt b/basis/xml/entities/summary.txt
new file mode 100644 (file)
index 0000000..4ff3e75
--- /dev/null
@@ -0,0 +1 @@
+Contains built-in XML entities
diff --git a/basis/xml/errors/summary.txt b/basis/xml/errors/summary.txt
new file mode 100644 (file)
index 0000000..6bab352
--- /dev/null
@@ -0,0 +1 @@
+XML parsing errors
diff --git a/basis/xml/name/authors.txt b/basis/xml/name/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/basis/xml/name/summary.txt b/basis/xml/name/summary.txt
new file mode 100644 (file)
index 0000000..4a75904
--- /dev/null
@@ -0,0 +1 @@
+Implements parsing XML names
diff --git a/basis/xml/state/summary.txt b/basis/xml/state/summary.txt
new file mode 100644 (file)
index 0000000..cfdd722
--- /dev/null
@@ -0,0 +1 @@
+Primitive device for storing the state of the XML parser
index f0af650e4f59ec68013d882c1d31daf48d009be5..b35d7372e3fd1cca657602d093f748c736e65d0a 100644 (file)
@@ -1,5 +1,5 @@
-USING: kernel xml sequences assocs tools.test io arrays namespaces
-accessors xml.data xml.utilities xml.writer generic sequences.deep ;
+USING: kernel xml sequences assocs tools.test io arrays namespaces fry
+accessors xml.data xml.utilities xml.writer generic sequences.deep multiline ;
 IN: xml.tests
 
 : sub-tag
@@ -20,24 +20,39 @@ M: object (r-ref) drop ;
 
 ! Example
 
-: sample-doc ( -- string )
-    {
-        "<html xmlns:f='http://littledan.onigirihouse.com/namespaces/replace'>"
-        "<body>"
-        "<span f:sub='foo'/>"
-        "<div f:sub='bar'/>"
-        "<p f:sub='baz'>paragraph</p>"
-        "</body></html>"
-    } concat ;
+STRING: sample-doc
+<html xmlns:f='http://littledan.onigirihouse.com/namespaces/replace'>
+<body>
+<span f:sub='foo'/>
+<div f:sub='bar'/>
+<p f:sub='baz'>paragraph</p>
+</body></html>
+;
+
+STRING: expected-result
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns:f="http://littledan.onigirihouse.com/namespaces/replace">
+  <body>
+    <span f:sub="foo">
+      foo
+    </span>
+    <div f:sub="bar">
+      blah
+      <a/>
+    </div>
+    <p f:sub="baz"/>
+  </body>
+</html>
+;
 
 : test-refs ( -- string )
     [
         H{
             { "foo" { "foo" } }
-            { "bar" { "blah" T{ tag f T{ name f "" "a" "" } f f } } }
+            { "bar" { "blah" T{ tag f T{ name f "" "a" "" } T{ attrs } f } } }
             { "baz" f }
         } ref-table set
-        sample-doc string>xml dup template xml>string
+        sample-doc string>xml dup template pprint-xml>string
     ] with-scope ;
 
-[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><html xmlns:f=\"http://littledan.onigirihouse.com/namespaces/replace\"><body><span f:sub=\"foo\">foo</span><div f:sub=\"bar\">blah<a/></div><p f:sub=\"baz\"/></body></html>" ] [ test-refs ] unit-test
+expected-result '[ _ ] [ test-refs ] unit-test
diff --git a/basis/xml/tokenize/summary.txt b/basis/xml/tokenize/summary.txt
new file mode 100644 (file)
index 0000000..cc5361a
--- /dev/null
@@ -0,0 +1 @@
+Basic tools for parsing XML
diff --git a/basis/xml/utilities/summary.txt b/basis/xml/utilities/summary.txt
new file mode 100644 (file)
index 0000000..a671132
--- /dev/null
@@ -0,0 +1 @@
+Utilities for manipulating an XML DOM tree
diff --git a/basis/xml/writer/summary.txt b/basis/xml/writer/summary.txt
new file mode 100644 (file)
index 0000000..04d0471
--- /dev/null
@@ -0,0 +1 @@
+Tools for printing XML, including prettyprinting