xpcomcore-rubygem 0.3.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/README.markdown +14 -0
  2. data/Rakefile +13 -11
  3. data/VERSION +1 -1
  4. data/bin/xpcomcore +7 -0
  5. data/lib/xpcomcore-rubygem.rb +9 -0
  6. data/lib/xpcomcore-rubygem/commands.rb +54 -0
  7. data/lib/xpcomcore-rubygem/commands/generate.rb +23 -0
  8. data/lib/xpcomcore-rubygem/commands/generate/application.rb +63 -0
  9. data/lib/xpcomcore-rubygem/commands/generate/jeweler_builder_command.rb +108 -0
  10. data/lib/xpcomcore-rubygem/commands/generate/library.rb +25 -0
  11. data/lib/xpcomcore-rubygem/commands/generate/template_helpers.rb +78 -0
  12. data/lib/xpcomcore-rubygem/commands/launch.rb +129 -0
  13. data/templates/application/application.ini.erb +12 -0
  14. data/templates/application/chrome/chrome.manifest.erb +1 -0
  15. data/templates/application/chrome/content/xul/main_window.xul.erb +6 -0
  16. data/{extension → templates/application}/components/bootstrapper.js +1 -1
  17. data/templates/application/defaults/preferences/prefs.js.erb +7 -0
  18. data/templates/shared/jsdoc_doc_task.erb +7 -0
  19. data/templates/shared/xultestrunner_test_task.erb +7 -0
  20. data/xpcomcore-rubygem.gemspec +48 -136
  21. data/xpcomcore/Rakefile +42 -19
  22. data/xpcomcore/bootstrapper.js +1 -3
  23. data/xpcomcore/{VERSION.yml → build_properties.yml} +3 -0
  24. data/xpcomcore/components/XPCOMCore.js +0 -2
  25. data/xpcomcore/doc/files.html +10 -10
  26. data/xpcomcore/doc/index.html +17 -17
  27. data/xpcomcore/doc/symbols/_global_.html +10 -9
  28. data/xpcomcore/doc/symbols/{Error.html → error.html} +10 -9
  29. data/xpcomcore/doc/symbols/{File.html → file.html} +13 -12
  30. data/xpcomcore/doc/symbols/{File.NoSuchFileError.html → file.nosuchfileerror.html} +13 -12
  31. data/xpcomcore/doc/symbols/{Kernel.html → kernel.html} +48 -47
  32. data/xpcomcore/doc/symbols/{LoadError.html → loaderror.html} +13 -12
  33. data/xpcomcore/doc/symbols/{SelfConceptError.html → selfconcepterror.html} +13 -12
  34. data/xpcomcore/doc/symbols/{Sys.html → sys.html} +12 -11
  35. data/xpcomcore/doc/symbols/{XPCBuiltins.html → xpcbuiltins.html} +11 -10
  36. metadata +61 -135
  37. data/README.rdoc +0 -18
  38. data/bin/xpcomcore-firefox +0 -4
  39. data/bin/xpcomcore-rubygem-install +0 -205
  40. data/extension/README.txt +0 -1
  41. data/extension/install.rdf +0 -16
  42. data/xpcomcore/etc/jsdoc-toolkit/README.txt +0 -186
  43. data/xpcomcore/etc/jsdoc-toolkit/app/frame.js +0 -33
  44. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +0 -102
  45. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +0 -144
  46. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +0 -84
  47. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +0 -153
  48. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +0 -10
  49. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +0 -134
  50. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +0 -26
  51. data/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +0 -93
  52. data/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +0 -129
  53. data/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +0 -26
  54. data/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +0 -26
  55. data/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +0 -159
  56. data/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +0 -16
  57. data/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +0 -292
  58. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +0 -104
  59. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +0 -200
  60. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +0 -294
  61. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +0 -126
  62. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +0 -109
  63. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +0 -144
  64. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +0 -145
  65. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +0 -33
  66. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +0 -645
  67. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +0 -241
  68. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +0 -41
  69. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +0 -18
  70. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +0 -332
  71. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +0 -133
  72. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +0 -32
  73. data/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +0 -474
  74. data/xpcomcore/etc/jsdoc-toolkit/app/main.js +0 -111
  75. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +0 -20
  76. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +0 -16
  77. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +0 -10
  78. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +0 -62
  79. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +0 -10
  80. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +0 -31
  81. data/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +0 -43
  82. data/xpcomcore/etc/jsdoc-toolkit/app/run.js +0 -348
  83. data/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +0 -144
  84. data/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +0 -13
  85. data/xpcomcore/etc/jsdoc-toolkit/app/test.js +0 -325
  86. data/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +0 -24
  87. data/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +0 -14
  88. data/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +0 -31
  89. data/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +0 -26
  90. data/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +0 -46
  91. data/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +0 -23
  92. data/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +0 -22
  93. data/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +0 -18
  94. data/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +0 -10
  95. data/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +0 -12
  96. data/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +0 -54
  97. data/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +0 -14
  98. data/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +0 -39
  99. data/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +0 -33
  100. data/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +0 -13
  101. data/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +0 -25
  102. data/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +0 -10
  103. data/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +0 -16
  104. data/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +0 -477
  105. data/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +0 -33
  106. data/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +0 -19
  107. data/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +0 -17
  108. data/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +0 -17
  109. data/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +0 -19
  110. data/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +0 -23
  111. data/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +0 -13
  112. data/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +0 -20
  113. data/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +0 -20
  114. data/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +0 -37
  115. data/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +0 -8
  116. data/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +0 -17
  117. data/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +0 -9
  118. data/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +0 -13
  119. data/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +0 -24
  120. data/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +0 -10
  121. data/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +0 -5
  122. data/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +0 -5
  123. data/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +0 -42
  124. data/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +0 -2
  125. data/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +0 -22
  126. data/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +0 -13
  127. data/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +0 -31
  128. data/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +0 -23
  129. data/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +0 -14
  130. data/xpcomcore/etc/jsdoc-toolkit/changes.txt +0 -96
  131. data/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +0 -31
  132. data/xpcomcore/etc/jsdoc-toolkit/java/build.xml +0 -36
  133. data/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +0 -36
  134. data/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
  135. data/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +0 -21
  136. data/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +0 -21
  137. data/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
  138. data/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
  139. data/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +0 -52
  140. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +0 -17
  141. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +0 -56
  142. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +0 -646
  143. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +0 -39
  144. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +0 -200
  145. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +0 -162
  146. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +0 -2
  147. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +0 -19
  148. data/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +0 -35
@@ -1,159 +0,0 @@
1
- LOG.inform("XMLDOC.DomReader loaded");
2
-
3
- XMLDOC.DomReader = function(root) {
4
-
5
- this.dom = root;
6
-
7
- /**
8
- * The current node the reader is on
9
- */
10
- this.node = root;
11
-
12
- /**
13
- * Get the current node the reader is on
14
- * @type XMLDOC.Parser.node
15
- */
16
- XMLDOC.DomReader.prototype.getNode = function() {
17
- return this.node;
18
- };
19
-
20
- /**
21
- * Set the node the reader should be positioned on.
22
- * @param node {XMLDOC.Parser.node}
23
- */
24
- XMLDOC.DomReader.prototype.setNode = function(node) {
25
- this.node = node;
26
- };
27
-
28
- /**
29
- * A helper method to make sure the current node will
30
- * never return null, unless null is passed as the root.
31
- * @param step {String} An expression to evaluate - should return a node or null
32
- */
33
- XMLDOC.DomReader.prototype.navigate = function(step) {
34
- var n;
35
- if ((n = step) != null)
36
- {
37
- this.node = n;
38
- return this.node;
39
- }
40
- return null;
41
- };
42
-
43
- /**
44
- * Get the root node of the current node's document.
45
- */
46
- XMLDOC.DomReader.prototype.root = function() {
47
- this.navigate(this.dom);
48
- };
49
-
50
- /**
51
- * Get the parent of the current node.
52
- */
53
- XMLDOC.DomReader.prototype.parent = function() {
54
- return this.navigate(this.node.parentNode());
55
- };
56
-
57
- /**
58
- * Get the first child of the current node.
59
- */
60
- XMLDOC.DomReader.prototype.firstChild = function() {
61
- return this.navigate(this.node.firstChild());
62
- };
63
-
64
- /**
65
- * Get the last child of the current node.
66
- */
67
- XMLDOC.DomReader.prototype.lastChild = function() {
68
- return this.navigate(this.node.lastChild());
69
- };
70
-
71
- /**
72
- * Get the next sibling of the current node.
73
- */
74
- XMLDOC.DomReader.prototype.nextSibling = function() {
75
- return this.navigate(this.node.nextSibling());
76
- };
77
-
78
- /**
79
- * Get the previous sibling of the current node.
80
- */
81
- XMLDOC.DomReader.prototype.prevSibling = function() {
82
- return this.navigate(this.node.prevSibling());
83
- };
84
-
85
- //===============================================================================================
86
- // Support methods
87
-
88
- /**
89
- * Walk the tree starting with the current node, calling the plug-in for
90
- * each node visited. Each time the plug-in is called, the DomReader
91
- * is passed as the only parameter. Use the {@link XMLDOC.DomReader#getNode} method
92
- * to access the current node. <i>This method uses a depth first traversal pattern.</i>
93
- *
94
- * @param srcFile {String} The source file being evaluated
95
- */
96
- XMLDOC.DomReader.prototype.getSymbols = function(srcFile)
97
- {
98
- XMLDOC.DomReader.symbols = [];
99
- XMLDOC.DomReader.currentFile = srcFile;
100
- JSDOC.Symbol.srcFile = (srcFile || "");
101
-
102
- if (defined(JSDOC.PluginManager)) {
103
- JSDOC.PluginManager.run("onDomGetSymbols", this);
104
- }
105
-
106
- return XMLDOC.DomReader.symbols;
107
- };
108
-
109
- /**
110
- * Find the node with the given name using a depth first traversal.
111
- * Does not modify the DomReader's current node.
112
- *
113
- * @param name {String} The name of the node to find
114
- * @return the node that was found, or null if not found
115
- */
116
- XMLDOC.DomReader.prototype.findNode = function(name)
117
- {
118
- var findNode = null;
119
-
120
- // Start at the current node and move into the subtree,
121
- // looking for the node with the given name
122
- function deeper(node, find)
123
- {
124
- var look = null;
125
-
126
- if (node) {
127
- if (node.name == find)
128
- {
129
- return node;
130
- }
131
-
132
- if (node.firstChild())
133
- {
134
- look = deeper(node.firstChild(), find);
135
- }
136
-
137
- if (!look && node.nextSibling())
138
- {
139
- look = deeper(node.nextSibling(), find);
140
- }
141
- }
142
-
143
- return look;
144
- }
145
-
146
- return deeper(this.getNode().firstChild(), name);
147
- };
148
-
149
- /**
150
- * Find the next node with the given name using a depth first traversal.
151
- *
152
- * @param name {String} The name of the node to find
153
- */
154
- XMLDOC.DomReader.prototype.findPreviousNode = function(name)
155
- {
156
- };
157
-
158
- };
159
-
@@ -1,16 +0,0 @@
1
- LOG.inform("XMLDOC.symbolize loaded");
2
-
3
- /**
4
- * Convert the source file to a set of symbols
5
- */
6
- XMLDOC.symbolize = function(srcFile, src) {
7
-
8
- LOG.inform("Symbolizing file '" + srcFile + "'");
9
-
10
- // XML files already have a defined structure, so we don't need to
11
- // do anything but parse them. The DOM reader can create a symbol
12
- // table from the parsed XML.
13
- var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src));
14
- return dr.getSymbols(srcFile);
15
-
16
- };
@@ -1,292 +0,0 @@
1
- LOG.inform("XMLDOC.Parser loaded");
2
-
3
- /**
4
- * XML Parser object. Returns an {@link #XMLDOC.Parser.node} which is
5
- * the root element of the parsed document.
6
- * <p/>
7
- * By default, this parser will only handle well formed XML. To
8
- * allow the parser to handle HTML, set the <tt>XMLDOC.Parser.strictMode</tt>
9
- * variable to <tt>false</tt> before calling <tt>XMLDOC.Parser.parse()</tt>.
10
- * <p/>
11
- * <i>Note: If you pass poorly formed XML, it will cause the parser to throw
12
- * an exception.</i>
13
- *
14
- * @author Brett Fattori (bfattori@fry.com)
15
- * @author $Author: micmath $
16
- * @version $Revision: 497 $
17
- */
18
- XMLDOC.Parser = {};
19
-
20
- /**
21
- * Strict mode setting. Setting this to false allows HTML-style source to
22
- * be parsed. Normally, well formed XML has defined end tags, or empty tags
23
- * are properly formed. Default: <tt>true</tt>
24
- * @type Boolean
25
- */
26
- XMLDOC.Parser.strictMode = true;
27
-
28
- /**
29
- * A node in an XML Document. Node types are ROOT, ELEMENT, COMMENT, PI, and TEXT.
30
- * @param parent {XMLDOC.Parser.node} The parent node
31
- * @param name {String} The node name
32
- * @param type {String} One of the types
33
- */
34
- XMLDOC.Parser.node = function(parent, name, type)
35
- {
36
- this.name = name;
37
- this.type = type || "ELEMENT";
38
- this.parent = parent;
39
- this.charData = "";
40
- this.attrs = {};
41
- this.nodes = [];
42
- this.cPtr = 0;
43
-
44
- XMLDOC.Parser.node.prototype.getAttributeNames = function() {
45
- var a = [];
46
- for (var o in this.attrs)
47
- {
48
- a.push(o);
49
- }
50
-
51
- return a;
52
- };
53
-
54
- XMLDOC.Parser.node.prototype.getAttribute = function(attr) {
55
- return this.attrs[attr];
56
- };
57
-
58
- XMLDOC.Parser.node.prototype.setAttribute = function(attr, val) {
59
- this.attrs[attr] = val;
60
- };
61
-
62
- XMLDOC.Parser.node.prototype.getChild = function(idx) {
63
- return this.nodes[idx];
64
- };
65
-
66
- XMLDOC.Parser.node.prototype.parentNode = function() {
67
- return this.parent;
68
- };
69
-
70
- XMLDOC.Parser.node.prototype.firstChild = function() {
71
- return this.nodes[0];
72
- };
73
-
74
- XMLDOC.Parser.node.prototype.lastChild = function() {
75
- return this.nodes[this.nodes.length - 1];
76
- };
77
-
78
- XMLDOC.Parser.node.prototype.nextSibling = function() {
79
- var p = this.parent;
80
- if (p && (p.nodes.indexOf(this) + 1 != p.nodes.length))
81
- {
82
- return p.getChild(p.nodes.indexOf(this) + 1);
83
- }
84
- return null;
85
- };
86
-
87
- XMLDOC.Parser.node.prototype.prevSibling = function() {
88
- var p = this.parent;
89
- if (p && (p.nodes.indexOf(this) - 1 >= 0))
90
- {
91
- return p.getChild(p.nodes.indexOf(this) - 1);
92
- }
93
- return null;
94
- };
95
- };
96
-
97
- /**
98
- * Parse an XML Document from the specified source. The XML should be
99
- * well formed, unless strict mode is disabled, then the parser will
100
- * handle HTML-style XML documents.
101
- * @param src {String} The source to parse
102
- */
103
- XMLDOC.Parser.parse = function(src)
104
- {
105
- var A = [];
106
-
107
- // Normailize whitespace
108
- A = src.split("\r\n");
109
- src = A.join("\n");
110
- A = src.split("\r");
111
- src = A.join("\n");
112
-
113
- // Remove XML and DOCTYPE specifier
114
- src.replace(/<\?XML .*\?>/i, "");
115
- src.replace(/<!DOCTYPE .*\>/i, "");
116
-
117
- // The document is the root node and cannot be modified or removed
118
- var doc = new XMLDOC.Parser.node(null, "ROOT", "DOCUMENT");
119
-
120
- // Let's break it down
121
- XMLDOC.Parser.eat(doc, src);
122
-
123
- return doc;
124
- };
125
-
126
- /**
127
- * The XML fragment processing routine. This method is private and should not be called
128
- * directly.
129
- * @param parentNode {XMLDOC.Parser.node} The node which is the parent of this fragment
130
- * @param src {String} The source within the fragment to process
131
- * @private
132
- */
133
- XMLDOC.Parser.eat = function(parentNode, src)
134
- {
135
- // A simple tag def
136
- var reTag = new RegExp("<(!|)(\\?|--|)((.|\\s)*?)\\2>","g");
137
-
138
- // Special tag types
139
- var reCommentTag = /<!--((.|\s)*?)-->/;
140
- var rePITag = /<\?((.|\s)*?)\?>/;
141
-
142
- // A start tag (with potential empty marker)
143
- var reStartTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*(\/)?>/;
144
-
145
- // An empty HTML style tag (not proper XML, but we'll accept it so we can process HTML)
146
- var reHTMLEmptyTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*>/;
147
-
148
- // Fully enclosing tag with nested tags
149
- var reEnclosingTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*?)\4)*>((.|\s)*?)<\/\1>/;
150
-
151
- // Breaks down attributes
152
- var reAttributes = new RegExp(" +([\\w_\\-]*)=(\"|')(.*?)\\2","g");
153
-
154
- // Find us a tag
155
- var tag;
156
- while ((tag = reTag.exec(src)) != null)
157
- {
158
- if (tag.index > 0)
159
- {
160
- // The next tag has some text before it
161
- var text = src.substring(0, tag.index).replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
162
-
163
- if (text.length > 0 && (text != "\n"))
164
- {
165
- var txtnode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
166
- txtnode.charData = text;
167
-
168
- // Append the new text node
169
- parentNode.nodes.push(txtnode);
170
- }
171
-
172
- // Reset the lastIndex of reTag
173
- reTag.lastIndex -= src.substring(0, tag.index).length;
174
-
175
- // Eat the text
176
- src = src.substring(tag.index);
177
- }
178
-
179
- if (reCommentTag.test(tag[0]))
180
- {
181
- // Is this a comment?
182
- var comment = new XMLDOC.Parser.node(parentNode, "", "COMMENT");
183
- comment.charData = reCommentTag.exec(tag[0])[1];
184
-
185
- // Append the comment
186
- parentNode.nodes.push(comment);
187
-
188
- // Move the lastIndex of reTag
189
- reTag.lastIndex -= tag[0].length;
190
-
191
- // Eat the tag
192
- src = src.replace(reCommentTag, "");
193
- }
194
- else if (rePITag.test(tag[0]))
195
- {
196
- // Is this a processing instruction?
197
- var pi = new XMLDOC.Parser.node(parentNode, "", "PI");
198
- pi.charData = rePITag.exec(tag[0])[1];
199
-
200
- // Append the processing instruction
201
- parentNode.nodes.push(pi);
202
-
203
- // Move the lastIndex of reTag
204
- reTag.lastIndex -= tag[0].length;
205
-
206
- // Eat the tag
207
- src = src.replace(rePITag, "");
208
- }
209
- else if (reStartTag.test(tag[0]))
210
- {
211
- // Break it down
212
- var e = reStartTag.exec(tag[0]);
213
- var elem = new XMLDOC.Parser.node(parentNode, e[1], "ELEMENT");
214
-
215
- // Get attributes from the tag
216
- var a;
217
- while ((a = reAttributes.exec(e[2])) != null )
218
- {
219
- elem.attrs[a[1]] = a[3];
220
- }
221
-
222
- // Is this an empty XML-style tag?
223
- if (e[6] == "/")
224
- {
225
- // Append the empty element
226
- parentNode.nodes.push(elem);
227
-
228
- // Move the lastIndex of reTag (include the start tag length)
229
- reTag.lastIndex -= e[0].length;
230
-
231
- // Eat the tag
232
- src = src.replace(reStartTag, "");
233
- }
234
- else
235
- {
236
- // Check for malformed XML tags
237
- var htmlParsed = false;
238
- var htmlStartTag = reHTMLEmptyTag.exec(src);
239
-
240
- // See if there isn't an end tag within this block
241
- var reHTMLEndTag = new RegExp("</" + htmlStartTag[1] + ">");
242
- var htmlEndTag = reHTMLEndTag.exec(src);
243
-
244
- if (XMLDOC.Parser.strictMode && htmlEndTag == null)
245
- {
246
- // Poorly formed XML fails in strict mode
247
- var err = new Error("Malformed XML passed to XMLDOC.Parser... Error contains malformed 'src'");
248
- err.src = src;
249
- throw err;
250
- }
251
- else if (htmlEndTag == null)
252
- {
253
- // This is an HTML-style empty tag, store the element for it in non-strict mode
254
- parentNode.nodes.push(elem);
255
-
256
- // Eat the tag
257
- src = src.replace(reHTMLEmptyTag, "");
258
- htmlParsed = true;
259
- }
260
-
261
- // If we didn't parse HTML-style, it must be an enclosing tag
262
- if (!htmlParsed)
263
- {
264
- var enc = reEnclosingTag.exec(src);
265
-
266
- // Go deeper into the document
267
- XMLDOC.Parser.eat(elem, enc[6]);
268
-
269
- // Append the new element node
270
- parentNode.nodes.push(elem);
271
-
272
- // Eat the tag
273
- src = src.replace(reEnclosingTag, "");
274
- }
275
- }
276
-
277
- // Reset the lastIndex of reTag
278
- reTag.lastIndex = 0;
279
- }
280
- }
281
-
282
- // No tag was found... append the text if there is any
283
- src = src.replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
284
- if (src.length > 0 && (src != "\n"))
285
- {
286
- var txtNode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
287
- txtNode.charData = src;
288
-
289
- // Append the new text node
290
- parentNode.nodes.push(txtNode);
291
- }
292
- };