nokogiri 1.0.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (127) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +120 -0
  3. data/README.ja.txt +86 -0
  4. data/README.txt +87 -0
  5. data/Rakefile +264 -0
  6. data/ext/nokogiri/extconf.rb +59 -0
  7. data/ext/nokogiri/html_document.c +83 -0
  8. data/ext/nokogiri/html_document.h +10 -0
  9. data/ext/nokogiri/html_sax_parser.c +32 -0
  10. data/ext/nokogiri/html_sax_parser.h +11 -0
  11. data/ext/nokogiri/iconv.dll +0 -0
  12. data/ext/nokogiri/libexslt.dll +0 -0
  13. data/ext/nokogiri/libxml2.dll +0 -0
  14. data/ext/nokogiri/libxslt.dll +0 -0
  15. data/ext/nokogiri/native.c +40 -0
  16. data/ext/nokogiri/native.h +51 -0
  17. data/ext/nokogiri/native.so +0 -0
  18. data/ext/nokogiri/xml_cdata.c +52 -0
  19. data/ext/nokogiri/xml_cdata.h +9 -0
  20. data/ext/nokogiri/xml_document.c +159 -0
  21. data/ext/nokogiri/xml_document.h +10 -0
  22. data/ext/nokogiri/xml_dtd.c +117 -0
  23. data/ext/nokogiri/xml_dtd.h +8 -0
  24. data/ext/nokogiri/xml_node.c +709 -0
  25. data/ext/nokogiri/xml_node.h +15 -0
  26. data/ext/nokogiri/xml_node_set.c +124 -0
  27. data/ext/nokogiri/xml_node_set.h +9 -0
  28. data/ext/nokogiri/xml_reader.c +429 -0
  29. data/ext/nokogiri/xml_reader.h +10 -0
  30. data/ext/nokogiri/xml_sax_parser.c +174 -0
  31. data/ext/nokogiri/xml_sax_parser.h +10 -0
  32. data/ext/nokogiri/xml_syntax_error.c +194 -0
  33. data/ext/nokogiri/xml_syntax_error.h +11 -0
  34. data/ext/nokogiri/xml_text.c +29 -0
  35. data/ext/nokogiri/xml_text.h +9 -0
  36. data/ext/nokogiri/xml_xpath.c +46 -0
  37. data/ext/nokogiri/xml_xpath.h +11 -0
  38. data/ext/nokogiri/xml_xpath_context.c +81 -0
  39. data/ext/nokogiri/xml_xpath_context.h +9 -0
  40. data/ext/nokogiri/xslt_stylesheet.c +108 -0
  41. data/ext/nokogiri/xslt_stylesheet.h +9 -0
  42. data/ext/nokogiri/zlib1.dll +0 -0
  43. data/lib/nokogiri.rb +51 -0
  44. data/lib/nokogiri/css.rb +6 -0
  45. data/lib/nokogiri/css/generated_parser.rb +653 -0
  46. data/lib/nokogiri/css/generated_tokenizer.rb +159 -0
  47. data/lib/nokogiri/css/node.rb +95 -0
  48. data/lib/nokogiri/css/parser.rb +24 -0
  49. data/lib/nokogiri/css/parser.y +198 -0
  50. data/lib/nokogiri/css/tokenizer.rb +9 -0
  51. data/lib/nokogiri/css/tokenizer.rex +63 -0
  52. data/lib/nokogiri/css/xpath_visitor.rb +165 -0
  53. data/lib/nokogiri/decorators.rb +1 -0
  54. data/lib/nokogiri/decorators/hpricot.rb +3 -0
  55. data/lib/nokogiri/decorators/hpricot/node.rb +58 -0
  56. data/lib/nokogiri/decorators/hpricot/node_set.rb +14 -0
  57. data/lib/nokogiri/decorators/hpricot/xpath_visitor.rb +17 -0
  58. data/lib/nokogiri/hpricot.rb +47 -0
  59. data/lib/nokogiri/html.rb +95 -0
  60. data/lib/nokogiri/html/builder.rb +9 -0
  61. data/lib/nokogiri/html/document.rb +9 -0
  62. data/lib/nokogiri/html/sax/parser.rb +21 -0
  63. data/lib/nokogiri/version.rb +3 -0
  64. data/lib/nokogiri/xml.rb +67 -0
  65. data/lib/nokogiri/xml/after_handler.rb +18 -0
  66. data/lib/nokogiri/xml/before_handler.rb +32 -0
  67. data/lib/nokogiri/xml/builder.rb +79 -0
  68. data/lib/nokogiri/xml/cdata.rb +9 -0
  69. data/lib/nokogiri/xml/document.rb +30 -0
  70. data/lib/nokogiri/xml/dtd.rb +6 -0
  71. data/lib/nokogiri/xml/element.rb +6 -0
  72. data/lib/nokogiri/xml/entity_declaration.rb +9 -0
  73. data/lib/nokogiri/xml/node.rb +195 -0
  74. data/lib/nokogiri/xml/node_set.rb +183 -0
  75. data/lib/nokogiri/xml/notation.rb +6 -0
  76. data/lib/nokogiri/xml/reader.rb +14 -0
  77. data/lib/nokogiri/xml/sax.rb +9 -0
  78. data/lib/nokogiri/xml/sax/document.rb +59 -0
  79. data/lib/nokogiri/xml/sax/parser.rb +33 -0
  80. data/lib/nokogiri/xml/syntax_error.rb +21 -0
  81. data/lib/nokogiri/xml/text.rb +6 -0
  82. data/lib/nokogiri/xml/xpath.rb +6 -0
  83. data/lib/nokogiri/xml/xpath_context.rb +14 -0
  84. data/lib/nokogiri/xslt.rb +11 -0
  85. data/lib/nokogiri/xslt/stylesheet.rb +6 -0
  86. data/nokogiri.gemspec +34 -0
  87. data/test/css/test_nthiness.rb +159 -0
  88. data/test/css/test_parser.rb +224 -0
  89. data/test/css/test_tokenizer.rb +162 -0
  90. data/test/css/test_xpath_visitor.rb +54 -0
  91. data/test/files/staff.xml +59 -0
  92. data/test/files/staff.xslt +32 -0
  93. data/test/files/tlm.html +850 -0
  94. data/test/helper.rb +70 -0
  95. data/test/hpricot/files/basic.xhtml +17 -0
  96. data/test/hpricot/files/boingboing.html +2266 -0
  97. data/test/hpricot/files/cy0.html +3653 -0
  98. data/test/hpricot/files/immob.html +400 -0
  99. data/test/hpricot/files/pace_application.html +1320 -0
  100. data/test/hpricot/files/tenderlove.html +16 -0
  101. data/test/hpricot/files/uswebgen.html +220 -0
  102. data/test/hpricot/files/utf8.html +1054 -0
  103. data/test/hpricot/files/week9.html +1723 -0
  104. data/test/hpricot/files/why.xml +19 -0
  105. data/test/hpricot/load_files.rb +7 -0
  106. data/test/hpricot/test_alter.rb +67 -0
  107. data/test/hpricot/test_builder.rb +27 -0
  108. data/test/hpricot/test_parser.rb +423 -0
  109. data/test/hpricot/test_paths.rb +15 -0
  110. data/test/hpricot/test_preserved.rb +78 -0
  111. data/test/hpricot/test_xml.rb +30 -0
  112. data/test/html/sax/test_parser.rb +27 -0
  113. data/test/html/test_builder.rb +78 -0
  114. data/test/html/test_document.rb +86 -0
  115. data/test/test_convert_xpath.rb +180 -0
  116. data/test/test_nokogiri.rb +36 -0
  117. data/test/test_reader.rb +222 -0
  118. data/test/test_xslt_transforms.rb +29 -0
  119. data/test/xml/sax/test_parser.rb +93 -0
  120. data/test/xml/test_builder.rb +16 -0
  121. data/test/xml/test_cdata.rb +18 -0
  122. data/test/xml/test_document.rb +171 -0
  123. data/test/xml/test_dtd.rb +43 -0
  124. data/test/xml/test_node.rb +223 -0
  125. data/test/xml/test_node_set.rb +116 -0
  126. data/test/xml/test_text.rb +13 -0
  127. metadata +217 -0
@@ -0,0 +1,11 @@
1
+ #ifndef NOKOGIRI_XML_XPATH
2
+ #define NOKOGIRI_XML_XPATH
3
+
4
+ #include <native.h>
5
+
6
+ void init_xml_xpath();
7
+ VALUE Nokogiri_wrap_xml_xpath(xmlXPathObjectPtr xpath);
8
+
9
+ extern VALUE cNokogiriXmlXpath;
10
+ #endif
11
+
@@ -0,0 +1,81 @@
1
+ #include <xml_xpath_context.h>
2
+
3
+ static void deallocate(xmlXPathContextPtr ctx)
4
+ {
5
+ NOKOGIRI_DEBUG_START(ctx);
6
+ xmlXPathFreeContext(ctx);
7
+ NOKOGIRI_DEBUG_END(ctx);
8
+ }
9
+
10
+ /*
11
+ * call-seq:
12
+ * register_ns(prefix, uri)
13
+ *
14
+ * Register the namespace with +prefix+ and +uri+.
15
+ */
16
+ static VALUE register_ns(VALUE self, VALUE prefix, VALUE uri)
17
+ {
18
+ xmlXPathContextPtr ctx;
19
+ Data_Get_Struct(self, xmlXPathContext, ctx);
20
+
21
+ xmlXPathRegisterNs( ctx,
22
+ (const xmlChar *)StringValuePtr(prefix),
23
+ (const xmlChar *)StringValuePtr(uri)
24
+ );
25
+ return self;
26
+ }
27
+
28
+ /*
29
+ * call-seq:
30
+ * evaluate(search_path)
31
+ *
32
+ * Evaluate the +search_path+ returning an XML::XPath object.
33
+ */
34
+ static VALUE evaluate(VALUE self, VALUE search_path)
35
+ {
36
+ xmlXPathContextPtr ctx;
37
+ Data_Get_Struct(self, xmlXPathContext, ctx);
38
+
39
+ xmlChar* query = (xmlChar *)StringValuePtr(search_path);
40
+ xmlXPathObjectPtr xpath = xmlXPathEvalExpression(query, ctx);
41
+ if(xpath == NULL) {
42
+ rb_raise(rb_eRuntimeError, "Couldn't evaluate expression '%s'", query);
43
+ }
44
+ return Nokogiri_wrap_xml_xpath(xpath);
45
+ }
46
+
47
+ /*
48
+ * call-seq:
49
+ * new(node)
50
+ *
51
+ * Create a new XPathContext with +node+ as the reference point.
52
+ */
53
+ static VALUE new(VALUE klass, VALUE nodeobj)
54
+ {
55
+ xmlXPathInit();
56
+
57
+ xmlNodePtr node ;
58
+ Data_Get_Struct(nodeobj, xmlNode, node);
59
+
60
+ xmlXPathContextPtr ctx = xmlXPathNewContext(node->doc);
61
+ ctx->node = node ;
62
+ return Data_Wrap_Struct(klass, 0, deallocate, ctx);
63
+ }
64
+
65
+ VALUE cNokogiriXmlXpathContext;
66
+ void init_xml_xpath_context(void)
67
+ {
68
+ VALUE module = rb_define_module("Nokogiri");
69
+ VALUE xml = rb_define_module_under(module, "XML");
70
+
71
+ /*
72
+ * XPathContext is the entry point for searching a Document by using XPath.
73
+ */
74
+ VALUE klass = rb_define_class_under(xml, "XPathContext", rb_cObject);
75
+
76
+ cNokogiriXmlXpathContext = klass;
77
+
78
+ rb_define_singleton_method(klass, "new", new, 1);
79
+ rb_define_method(klass, "evaluate", evaluate, 1);
80
+ rb_define_method(klass, "register_ns", register_ns, 2);
81
+ }
@@ -0,0 +1,9 @@
1
+ #ifndef NOKOGIRI_XML_XPATH_CONTEXT
2
+ #define NOKOGIRI_XML_XPATH_CONTEXT
3
+
4
+ #include <native.h>
5
+
6
+ void init_xml_xpath_context();
7
+
8
+ extern VALUE cNokogiriXmlXpathContext;
9
+ #endif
@@ -0,0 +1,108 @@
1
+ #include <xslt_stylesheet.h>
2
+
3
+ #include <libxslt/xsltInternals.h>
4
+ #include <libxslt/xsltutils.h>
5
+ #include <libxslt/transform.h>
6
+
7
+ static void dealloc(xsltStylesheetPtr doc)
8
+ {
9
+ NOKOGIRI_DEBUG_START(doc);
10
+ xsltFreeStylesheet(doc); // commented out for now.
11
+ NOKOGIRI_DEBUG_END(doc);
12
+ }
13
+
14
+ /*
15
+ * call-seq:
16
+ * parse_stylesheet_doc(document)
17
+ *
18
+ * Parse a stylesheet from +document+.
19
+ */
20
+ static VALUE parse_stylesheet_doc(VALUE klass, VALUE xmldocobj)
21
+ {
22
+ xmlDocPtr xml ;
23
+ xsltStylesheetPtr ss ;
24
+ Data_Get_Struct(xmldocobj, xmlDoc, xml);
25
+ ss = xsltParseStylesheetDoc(xmlCopyDoc(xml, 1)); /* 1 => recursive */
26
+ return Data_Wrap_Struct(klass, NULL, dealloc, ss);
27
+ }
28
+
29
+
30
+ /*
31
+ * call-seq:
32
+ * serialize(document)
33
+ *
34
+ * Serialize +document+ to an xml string.
35
+ */
36
+ static VALUE serialize(VALUE self, VALUE xmlobj)
37
+ {
38
+ xmlDocPtr xml ;
39
+ xsltStylesheetPtr ss ;
40
+ xmlChar* doc_ptr ;
41
+ int doc_len ;
42
+ VALUE rval ;
43
+
44
+ Data_Get_Struct(xmlobj, xmlDoc, xml);
45
+ Data_Get_Struct(self, xsltStylesheet, ss);
46
+ xsltSaveResultToString(&doc_ptr, &doc_len, xml, ss);
47
+ rval = rb_str_new((char*)doc_ptr, doc_len);
48
+ free(doc_ptr);
49
+ return rval ;
50
+ }
51
+
52
+
53
+ /*
54
+ * call-seq:
55
+ * apply_to(document, params)
56
+ *
57
+ * Apply an XSLT stylesheet to an XML::Document.
58
+ * +params+ is an array of strings used as XSLT parameters.
59
+ */
60
+ static VALUE apply_to(int argc, VALUE* argv, VALUE self)
61
+ {
62
+ VALUE xmldoc, paramobj ;
63
+ xmlDocPtr xml ;
64
+ xmlDocPtr result ;
65
+ xsltStylesheetPtr ss ;
66
+ const char** params ;
67
+ int param_len, j ;
68
+ VALUE resultobj ;
69
+
70
+ rb_scan_args(argc, argv, "11", &xmldoc, &paramobj);
71
+ if (paramobj == Qnil) { paramobj = rb_ary_new2(0) ; }
72
+
73
+ Data_Get_Struct(xmldoc, xmlDoc, xml);
74
+ Data_Get_Struct(self, xsltStylesheet, ss);
75
+
76
+ param_len = RARRAY_LEN(paramobj);
77
+ params = calloc((size_t)param_len+1, sizeof(char*));
78
+ for (j = 0 ; j < param_len ; j++) {
79
+ VALUE entry = rb_ary_entry(paramobj, j);
80
+ const char * ptr = StringValuePtr(entry);
81
+ params[j] = ptr;
82
+ }
83
+ params[param_len] = 0 ;
84
+
85
+ result = xsltApplyStylesheet(ss, xml, params);
86
+ free(params);
87
+ resultobj = Nokogiri_wrap_xml_document(0, result) ;
88
+ return rb_funcall(self, rb_intern("serialize"), 1, resultobj);
89
+ }
90
+
91
+ VALUE cNokogiriXsltStylesheet ;
92
+ void init_xslt_stylesheet()
93
+ {
94
+ /*
95
+ * HACK. This is so that rdoc will work with this C file.
96
+ */
97
+ /*
98
+ VALUE nokogiri = rb_define_module("Nokogiri");
99
+ VALUE xslt = rb_define_module_under(nokogiri, "XSLT");
100
+ VALUE klass = rb_define_class_under(xslt, "Stylesheet", rb_cObject);
101
+ */
102
+
103
+ VALUE klass = cNokogiriXsltStylesheet = rb_const_get(mNokogiriXslt, rb_intern("Stylesheet"));
104
+
105
+ rb_define_singleton_method(klass, "parse_stylesheet_doc", parse_stylesheet_doc, 1);
106
+ rb_define_method(klass, "serialize", serialize, 1);
107
+ rb_define_method(klass, "apply_to", apply_to, -1);
108
+ }
@@ -0,0 +1,9 @@
1
+ #ifndef NOKOGIRI_XSLT_STYLESHEET
2
+ #define NOKOGIRI_XSLT_STYLESHEET
3
+
4
+ #include <native.h>
5
+
6
+ void init_xslt_stylesheet();
7
+
8
+ extern VALUE cNokogiriXsltStylesheet ;
9
+ #endif
Binary file
data/lib/nokogiri.rb ADDED
@@ -0,0 +1,51 @@
1
+ require 'nokogiri/version'
2
+ require 'nokogiri/xml'
3
+ require 'nokogiri/xslt'
4
+ require 'nokogiri/html'
5
+ require 'nokogiri/decorators'
6
+ require 'nokogiri/css'
7
+ require 'nokogiri/html/builder'
8
+ require 'nokogiri/hpricot'
9
+
10
+ # Modify the PATH on windows so that the external DLLs will get loaded.
11
+ ENV['PATH'] += ";" + File.expand_path(
12
+ File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
13
+ ) if RUBY_PLATFORM =~ /mswin/i
14
+
15
+ require 'nokogiri/native'
16
+
17
+ module Nokogiri
18
+ class << self
19
+ attr_accessor :error_handler
20
+
21
+ def parse string, url = nil, encoding = nil, options = nil
22
+ doc =
23
+ if string =~ /^\s*<[^Hh>]*html/i # Probably html
24
+ Nokogiri::HTML.parse(string, url, encoding, options || 2145)
25
+ else
26
+ Nokogiri::XML.parse(string, url, encoding, options || 2159)
27
+ end
28
+ yield doc if block_given?
29
+ doc
30
+ end
31
+
32
+ def make input = nil, opts = {}, &blk
33
+ if input
34
+ Nokogiri::XML::Node.new_from_str(input)
35
+ else
36
+ Nokogiri(&blk)
37
+ end
38
+ end
39
+ end
40
+
41
+ self.error_handler = lambda { |syntax_error| }
42
+ end
43
+
44
+ def Nokogiri(*args, &block)
45
+ if block_given?
46
+ builder = Nokogiri::HTML::Builder.new(&block)
47
+ return builder.doc
48
+ else
49
+ Nokogiri::HTML.parse(*args)
50
+ end
51
+ end
@@ -0,0 +1,6 @@
1
+ require 'nokogiri/css/node'
2
+ require 'nokogiri/css/xpath_visitor'
3
+ require 'nokogiri/css/generated_tokenizer'
4
+ require 'nokogiri/css/generated_parser'
5
+ require 'nokogiri/css/tokenizer'
6
+ require 'nokogiri/css/parser'
@@ -0,0 +1,653 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.5
4
+ # from racc grammer file "lib/nokogiri/css/parser.y".
5
+ #
6
+
7
+ require 'racc/parser'
8
+
9
+
10
+ module Nokogiri
11
+
12
+ module CSS
13
+
14
+ class GeneratedParser < Racc::Parser
15
+
16
+ ##### racc 1.4.5 generates ###
17
+
18
+ racc_reduce_table = [
19
+ 0, 0, :racc_error,
20
+ 4, 46, :_reduce_1,
21
+ 1, 46, :_reduce_2,
22
+ 2, 49, :_reduce_3,
23
+ 2, 49, :_reduce_4,
24
+ 2, 49, :_reduce_5,
25
+ 1, 49, :_reduce_6,
26
+ 2, 49, :_reduce_7,
27
+ 2, 49, :_reduce_8,
28
+ 2, 50, :_reduce_9,
29
+ 2, 50, :_reduce_10,
30
+ 1, 50, :_reduce_none,
31
+ 2, 50, :_reduce_12,
32
+ 1, 50, :_reduce_13,
33
+ 3, 48, :_reduce_14,
34
+ 1, 48, :_reduce_none,
35
+ 2, 57, :_reduce_16,
36
+ 1, 51, :_reduce_17,
37
+ 1, 51, :_reduce_18,
38
+ 6, 55, :_reduce_19,
39
+ 6, 55, :_reduce_20,
40
+ 5, 55, :_reduce_21,
41
+ 2, 54, :_reduce_22,
42
+ 3, 54, :_reduce_23,
43
+ 3, 54, :_reduce_24,
44
+ 3, 54, :_reduce_25,
45
+ 1, 59, :_reduce_none,
46
+ 1, 59, :_reduce_none,
47
+ 4, 60, :_reduce_28,
48
+ 3, 60, :_reduce_29,
49
+ 2, 60, :_reduce_30,
50
+ 1, 60, :_reduce_31,
51
+ 2, 61, :_reduce_32,
52
+ 2, 61, :_reduce_33,
53
+ 1, 52, :_reduce_none,
54
+ 0, 52, :_reduce_none,
55
+ 2, 56, :_reduce_36,
56
+ 2, 56, :_reduce_37,
57
+ 2, 56, :_reduce_38,
58
+ 2, 56, :_reduce_39,
59
+ 1, 56, :_reduce_none,
60
+ 1, 56, :_reduce_none,
61
+ 1, 56, :_reduce_none,
62
+ 1, 56, :_reduce_none,
63
+ 1, 62, :_reduce_44,
64
+ 4, 58, :_reduce_45,
65
+ 4, 58, :_reduce_46,
66
+ 0, 58, :_reduce_none,
67
+ 1, 63, :_reduce_none,
68
+ 1, 63, :_reduce_none,
69
+ 1, 63, :_reduce_none,
70
+ 1, 63, :_reduce_none,
71
+ 1, 63, :_reduce_none,
72
+ 1, 63, :_reduce_none,
73
+ 1, 63, :_reduce_none,
74
+ 5, 53, :_reduce_55,
75
+ 1, 64, :_reduce_none,
76
+ 2, 47, :_reduce_none,
77
+ 0, 47, :_reduce_none ]
78
+
79
+ racc_reduce_n = 59
80
+
81
+ racc_shift_n = 97
82
+
83
+ racc_action_table = [
84
+ 5, 79, 81, 27, 10, 26, 94, 93, 42, 2,
85
+ 42, 30, 56, 5, 5, 28, 79, 81, 10, 42,
86
+ 42, 42, 47, 2, 51, 42, 42, 10, 82, 84,
87
+ 85, 52, 78, 10, 10, 7, 9, 12, 15, 42,
88
+ 10, 17, 77, 82, 84, 85, 10, 78, 7, 7,
89
+ 9, 12, 15, 42, 5, 17, 68, 77, 10, 9,
90
+ 69, 15, 10, 2, 17, 9, 9, 15, 15, 50,
91
+ 17, 17, 9, 5, 15, 26, 21, 17, 9, 54,
92
+ 15, 23, 63, 17, 37, 38, 39, 64, 42, 7,
93
+ 9, 12, 15, 44, 9, 17, 15, 42, 15, 17,
94
+ 76, 42, 86, 31, 42, 89, 42, 25, 7, 91,
95
+ 33, 92, 34, 35, 53, 42, 42 ]
96
+
97
+ racc_action_check = [
98
+ 0, 73, 73, 6, 0, 7, 90, 90, 63, 0,
99
+ 28, 7, 29, 17, 55, 6, 71, 71, 55, 33,
100
+ 34, 35, 17, 55, 22, 37, 38, 4, 73, 73,
101
+ 73, 23, 73, 1, 11, 0, 0, 0, 0, 42,
102
+ 67, 0, 73, 71, 71, 71, 14, 71, 17, 55,
103
+ 55, 55, 55, 44, 36, 55, 50, 71, 36, 4,
104
+ 52, 4, 16, 36, 4, 1, 11, 1, 11, 21,
105
+ 1, 11, 67, 41, 67, 5, 5, 67, 14, 27,
106
+ 14, 5, 41, 14, 13, 13, 13, 41, 64, 36,
107
+ 36, 36, 36, 16, 16, 36, 16, 65, 18, 16,
108
+ 69, 15, 72, 9, 75, 80, 83, 5, 41, 87,
109
+ 13, 88, 13, 13, 24, 93, 94 ]
110
+
111
+ racc_action_pointer = [
112
+ -2, 27, nil, nil, 21, 65, 3, -5, nil, 92,
113
+ nil, 28, nil, 77, 40, 92, 56, 11, 58, nil,
114
+ nil, 62, -18, 20, 72, nil, nil, 79, 1, -30,
115
+ nil, nil, nil, 10, 11, 12, 52, 16, 17, nil,
116
+ nil, 71, 30, nil, 44, nil, nil, nil, nil, nil,
117
+ 40, nil, 53, nil, nil, 12, nil, nil, nil, nil,
118
+ nil, nil, nil, -1, 79, 88, nil, 34, nil, 84,
119
+ nil, 13, 61, -2, nil, 95, nil, nil, nil, nil,
120
+ 64, nil, nil, 97, nil, nil, nil, 68, 69, nil,
121
+ -4, nil, nil, 106, 107, nil, nil ]
122
+
123
+ racc_action_default = [
124
+ -59, -42, -17, -13, -41, -59, -59, -59, -2, -59,
125
+ -44, -43, -18, -15, -40, -58, -35, -59, -11, -38,
126
+ -37, -31, -59, -26, -59, -22, -27, -59, -58, -59,
127
+ -26, -16, -39, -58, -58, -58, -59, -58, -58, -6,
128
+ -36, -59, -58, -34, -58, -9, -10, -33, -32, -12,
129
+ -59, -23, -30, -24, 97, -59, -25, -5, -8, -7,
130
+ -14, -3, -4, -58, -58, -58, -57, -59, -29, -59,
131
+ -1, -47, -59, -47, -56, -58, -28, -48, -52, -53,
132
+ -59, -54, -49, -58, -50, -51, -21, -59, -59, -19,
133
+ -59, -20, -55, -58, -58, -45, -46 ]
134
+
135
+ racc_goto_table = [
136
+ 41, 19, 8, 80, 20, 87, 48, 22, 6, 29,
137
+ 49, 32, 46, 55, 40, 45, 43, 36, 57, 58,
138
+ 59, 24, 61, 62, 75, nil, nil, 66, nil, 67,
139
+ 65, nil, nil, nil, nil, nil, nil, nil, 60, nil,
140
+ nil, nil, nil, nil, nil, nil, nil, nil, 71, 72,
141
+ 73, nil, nil, nil, nil, nil, nil, 70, nil, nil,
142
+ 88, nil, nil, nil, nil, nil, nil, 74, 90, nil,
143
+ nil, nil, nil, nil, nil, nil, nil, nil, 95, 96 ]
144
+
145
+ racc_goto_check = [
146
+ 2, 11, 3, 13, 11, 13, 9, 14, 1, 14,
147
+ 10, 11, 8, 2, 11, 7, 11, 4, 2, 2,
148
+ 2, 15, 2, 2, 19, nil, nil, 2, nil, 2,
149
+ 9, nil, nil, nil, nil, nil, nil, nil, 3, nil,
150
+ nil, nil, nil, nil, nil, nil, nil, nil, 2, 2,
151
+ 2, nil, nil, nil, nil, nil, nil, 3, nil, nil,
152
+ 2, nil, nil, nil, nil, nil, nil, 11, 2, nil,
153
+ nil, nil, nil, nil, nil, nil, nil, nil, 2, 2 ]
154
+
155
+ racc_goto_pointer = [
156
+ nil, 8, -15, 2, 4, nil, nil, -1, -4, -11,
157
+ -8, 0, nil, -68, 2, 16, nil, nil, nil, -43 ]
158
+
159
+ racc_goto_default = [
160
+ nil, nil, nil, nil, nil, 13, 16, nil, nil, 18,
161
+ 1, 3, 4, nil, nil, nil, 11, 14, 83, nil ]
162
+
163
+ racc_token_table = {
164
+ false => 0,
165
+ Object.new => 1,
166
+ :FUNCTION => 2,
167
+ :INCLUDES => 3,
168
+ :DASHMATCH => 4,
169
+ :LBRACE => 5,
170
+ :HASH => 6,
171
+ :PLUS => 7,
172
+ :GREATER => 8,
173
+ :S => 9,
174
+ :STRING => 10,
175
+ :IDENT => 11,
176
+ :COMMA => 12,
177
+ :URI => 13,
178
+ :CDO => 14,
179
+ :CDC => 15,
180
+ :NUMBER => 16,
181
+ :PERCENTAGE => 17,
182
+ :LENGTH => 18,
183
+ :EMS => 19,
184
+ :EXS => 20,
185
+ :ANGLE => 21,
186
+ :TIME => 22,
187
+ :FREQ => 23,
188
+ :IMPORTANT_SYM => 24,
189
+ :IMPORT_SYM => 25,
190
+ :MEDIA_SYM => 26,
191
+ :PAGE_SYM => 27,
192
+ :CHARSET_SYM => 28,
193
+ :DIMENSION => 29,
194
+ :PREFIXMATCH => 30,
195
+ :SUFFIXMATCH => 31,
196
+ :SUBSTRINGMATCH => 32,
197
+ :TILDE => 33,
198
+ :NOT_EQUAL => 34,
199
+ :SLASH => 35,
200
+ :DOUBLESLASH => 36,
201
+ :NOT => 37,
202
+ "." => 38,
203
+ "*" => 39,
204
+ "[" => 40,
205
+ "]" => 41,
206
+ ")" => 42,
207
+ ":" => 43,
208
+ "=" => 44 }
209
+
210
+ racc_use_result_var = true
211
+
212
+ racc_nt_base = 45
213
+
214
+ Racc_arg = [
215
+ racc_action_table,
216
+ racc_action_check,
217
+ racc_action_default,
218
+ racc_action_pointer,
219
+ racc_goto_table,
220
+ racc_goto_check,
221
+ racc_goto_default,
222
+ racc_goto_pointer,
223
+ racc_nt_base,
224
+ racc_reduce_table,
225
+ racc_token_table,
226
+ racc_shift_n,
227
+ racc_reduce_n,
228
+ racc_use_result_var ]
229
+
230
+ Racc_token_to_s_table = [
231
+ '$end',
232
+ 'error',
233
+ 'FUNCTION',
234
+ 'INCLUDES',
235
+ 'DASHMATCH',
236
+ 'LBRACE',
237
+ 'HASH',
238
+ 'PLUS',
239
+ 'GREATER',
240
+ 'S',
241
+ 'STRING',
242
+ 'IDENT',
243
+ 'COMMA',
244
+ 'URI',
245
+ 'CDO',
246
+ 'CDC',
247
+ 'NUMBER',
248
+ 'PERCENTAGE',
249
+ 'LENGTH',
250
+ 'EMS',
251
+ 'EXS',
252
+ 'ANGLE',
253
+ 'TIME',
254
+ 'FREQ',
255
+ 'IMPORTANT_SYM',
256
+ 'IMPORT_SYM',
257
+ 'MEDIA_SYM',
258
+ 'PAGE_SYM',
259
+ 'CHARSET_SYM',
260
+ 'DIMENSION',
261
+ 'PREFIXMATCH',
262
+ 'SUFFIXMATCH',
263
+ 'SUBSTRINGMATCH',
264
+ 'TILDE',
265
+ 'NOT_EQUAL',
266
+ 'SLASH',
267
+ 'DOUBLESLASH',
268
+ 'NOT',
269
+ '"."',
270
+ '"*"',
271
+ '"["',
272
+ '"]"',
273
+ '")"',
274
+ '":"',
275
+ '"="',
276
+ '$start',
277
+ 'selector',
278
+ 's_0toN',
279
+ 'simple_selector_1toN',
280
+ 'combinator',
281
+ 'simple_selector',
282
+ 'element_name',
283
+ 'hcap_0toN',
284
+ 'negation',
285
+ 'function',
286
+ 'attrib',
287
+ 'hcap_1toN',
288
+ 'class',
289
+ 'attrib_val_0or1',
290
+ 'expr',
291
+ 'an_plus_b',
292
+ 'pseudo',
293
+ 'attribute_id',
294
+ 'eql_incl_dash',
295
+ 'negation_arg']
296
+
297
+ Racc_debug_parser = false
298
+
299
+ ##### racc system variables end #####
300
+
301
+ # reduce 0 omitted
302
+
303
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 13
304
+ def _reduce_1( val, _values, result )
305
+ result = [val.first, val.last].flatten
306
+ result
307
+ end
308
+ .,.,
309
+
310
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 13
311
+ def _reduce_2( val, _values, result )
312
+ result = val.flatten
313
+ result
314
+ end
315
+ .,.,
316
+
317
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 16
318
+ def _reduce_3( val, _values, result )
319
+ result = :DIRECT_ADJACENT_SELECTOR
320
+ result
321
+ end
322
+ .,.,
323
+
324
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 17
325
+ def _reduce_4( val, _values, result )
326
+ result = :CHILD_SELECTOR
327
+ result
328
+ end
329
+ .,.,
330
+
331
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 18
332
+ def _reduce_5( val, _values, result )
333
+ result = :PRECEDING_SELECTOR
334
+ result
335
+ end
336
+ .,.,
337
+
338
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 19
339
+ def _reduce_6( val, _values, result )
340
+ result = :DESCENDANT_SELECTOR
341
+ result
342
+ end
343
+ .,.,
344
+
345
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 20
346
+ def _reduce_7( val, _values, result )
347
+ result = :DESCENDANT_SELECTOR
348
+ result
349
+ end
350
+ .,.,
351
+
352
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 21
353
+ def _reduce_8( val, _values, result )
354
+ result = :CHILD_SELECTOR
355
+ result
356
+ end
357
+ .,.,
358
+
359
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 31
360
+ def _reduce_9( val, _values, result )
361
+ result = if val[1].nil?
362
+ val.first
363
+ else
364
+ Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
365
+ end
366
+ result
367
+ end
368
+ .,.,
369
+
370
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 34
371
+ def _reduce_10( val, _values, result )
372
+ result = Node.new(:CONDITIONAL_SELECTOR, val)
373
+ result
374
+ end
375
+ .,.,
376
+
377
+ # reduce 11 omitted
378
+
379
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 38
380
+ def _reduce_12( val, _values, result )
381
+ result = Node.new(:CONDITIONAL_SELECTOR, val)
382
+ result
383
+ end
384
+ .,.,
385
+
386
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 43
387
+ def _reduce_13( val, _values, result )
388
+ result = Node.new(:CONDITIONAL_SELECTOR,
389
+ [Node.new(:ELEMENT_NAME, ['*']), val.first]
390
+ )
391
+ result
392
+ end
393
+ .,.,
394
+
395
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 48
396
+ def _reduce_14( val, _values, result )
397
+ result = Node.new(val[1], [val.first, val.last])
398
+ result
399
+ end
400
+ .,.,
401
+
402
+ # reduce 15 omitted
403
+
404
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 51
405
+ def _reduce_16( val, _values, result )
406
+ result = Node.new(:CLASS_CONDITION, [val[1]])
407
+ result
408
+ end
409
+ .,.,
410
+
411
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 54
412
+ def _reduce_17( val, _values, result )
413
+ result = Node.new(:ELEMENT_NAME, val)
414
+ result
415
+ end
416
+ .,.,
417
+
418
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 55
419
+ def _reduce_18( val, _values, result )
420
+ result = Node.new(:ELEMENT_NAME, val)
421
+ result
422
+ end
423
+ .,.,
424
+
425
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 63
426
+ def _reduce_19( val, _values, result )
427
+ result = Node.new(:ATTRIBUTE_CONDITION,
428
+ [Node.new(:ELEMENT_NAME, [val[2]])] + (val[4] || [])
429
+ )
430
+ result
431
+ end
432
+ .,.,
433
+
434
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 68
435
+ def _reduce_20( val, _values, result )
436
+ result = Node.new(:ATTRIBUTE_CONDITION,
437
+ [val[2]] + (val[4] || [])
438
+ )
439
+ result
440
+ end
441
+ .,.,
442
+
443
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 74
444
+ def _reduce_21( val, _values, result )
445
+ # Non standard, but hpricot supports it.
446
+ result = Node.new(:PSEUDO_CLASS,
447
+ [Node.new(:FUNCTION, ['nth-child(', val[2]])]
448
+ )
449
+ result
450
+ end
451
+ .,.,
452
+
453
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 79
454
+ def _reduce_22( val, _values, result )
455
+ result = Node.new(:FUNCTION, [val.first.strip])
456
+ result
457
+ end
458
+ .,.,
459
+
460
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 82
461
+ def _reduce_23( val, _values, result )
462
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
463
+ result
464
+ end
465
+ .,.,
466
+
467
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 85
468
+ def _reduce_24( val, _values, result )
469
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
470
+ result
471
+ end
472
+ .,.,
473
+
474
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 88
475
+ def _reduce_25( val, _values, result )
476
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
477
+ result
478
+ end
479
+ .,.,
480
+
481
+ # reduce 26 omitted
482
+
483
+ # reduce 27 omitted
484
+
485
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 102
486
+ def _reduce_28( val, _values, result )
487
+ if val[1] == 'n'
488
+ result = Node.new(:AN_PLUS_B, val)
489
+ else
490
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
491
+ end
492
+ result
493
+ end
494
+ .,.,
495
+
496
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 113
497
+ def _reduce_29( val, _values, result )
498
+ # n+3, -n+3
499
+ if val[0] == 'n'
500
+ val.unshift("1")
501
+ result = Node.new(:AN_PLUS_B, val)
502
+ elsif val[0] == '-n'
503
+ val[0] = 'n'
504
+ val.unshift("-1")
505
+ result = Node.new(:AN_PLUS_B, val)
506
+ else
507
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
508
+ end
509
+ result
510
+ end
511
+ .,.,
512
+
513
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 124
514
+ def _reduce_30( val, _values, result )
515
+ if val[1] == 'n'
516
+ val << "+"
517
+ val << "0"
518
+ result = Node.new(:AN_PLUS_B, val)
519
+ else
520
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
521
+ end
522
+ result
523
+ end
524
+ .,.,
525
+
526
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 136
527
+ def _reduce_31( val, _values, result )
528
+ if val[0] == 'even'
529
+ val = ["2","n","+","0"]
530
+ result = Node.new(:AN_PLUS_B, val)
531
+ elsif val[0] == 'odd'
532
+ val = ["2","n","+","1"]
533
+ result = Node.new(:AN_PLUS_B, val)
534
+ else
535
+ raise Racc::ParseError, "parse error on IDENT '#{val[0]}'"
536
+ end
537
+ result
538
+ end
539
+ .,.,
540
+
541
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
542
+ def _reduce_32( val, _values, result )
543
+ result = Node.new(:PSEUDO_CLASS, [val[1]])
544
+ result
545
+ end
546
+ .,.,
547
+
548
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
549
+ def _reduce_33( val, _values, result )
550
+ result = Node.new(:PSEUDO_CLASS, [val[1]])
551
+ result
552
+ end
553
+ .,.,
554
+
555
+ # reduce 34 omitted
556
+
557
+ # reduce 35 omitted
558
+
559
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 151
560
+ def _reduce_36( val, _values, result )
561
+ result = Node.new(:COMBINATOR, val)
562
+ result
563
+ end
564
+ .,.,
565
+
566
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 154
567
+ def _reduce_37( val, _values, result )
568
+ result = Node.new(:COMBINATOR, val)
569
+ result
570
+ end
571
+ .,.,
572
+
573
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 157
574
+ def _reduce_38( val, _values, result )
575
+ result = Node.new(:COMBINATOR, val)
576
+ result
577
+ end
578
+ .,.,
579
+
580
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 160
581
+ def _reduce_39( val, _values, result )
582
+ result = Node.new(:COMBINATOR, val)
583
+ result
584
+ end
585
+ .,.,
586
+
587
+ # reduce 40 omitted
588
+
589
+ # reduce 41 omitted
590
+
591
+ # reduce 42 omitted
592
+
593
+ # reduce 43 omitted
594
+
595
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 166
596
+ def _reduce_44( val, _values, result )
597
+ result = Node.new(:ID, val)
598
+ result
599
+ end
600
+ .,.,
601
+
602
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 169
603
+ def _reduce_45( val, _values, result )
604
+ result = [val.first, val[2]]
605
+ result
606
+ end
607
+ .,.,
608
+
609
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 170
610
+ def _reduce_46( val, _values, result )
611
+ result = [val.first, val[2]]
612
+ result
613
+ end
614
+ .,.,
615
+
616
+ # reduce 47 omitted
617
+
618
+ # reduce 48 omitted
619
+
620
+ # reduce 49 omitted
621
+
622
+ # reduce 50 omitted
623
+
624
+ # reduce 51 omitted
625
+
626
+ # reduce 52 omitted
627
+
628
+ # reduce 53 omitted
629
+
630
+ # reduce 54 omitted
631
+
632
+ module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 186
633
+ def _reduce_55( val, _values, result )
634
+ result = Node.new(:NOT, [val[2]])
635
+ result
636
+ end
637
+ .,.,
638
+
639
+ # reduce 56 omitted
640
+
641
+ # reduce 57 omitted
642
+
643
+ # reduce 58 omitted
644
+
645
+ def _reduce_none( val, _values, result )
646
+ result
647
+ end
648
+
649
+ end # class GeneratedParser
650
+
651
+ end # module CSS
652
+
653
+ end # module Nokogiri