nokogiri 1.1.1-java
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.
- data/History.ja.txt +99 -0
- data/History.txt +99 -0
- data/Manifest.txt +141 -0
- data/README.ja.txt +100 -0
- data/README.txt +109 -0
- data/Rakefile +354 -0
- data/ext/nokogiri/extconf.rb +93 -0
- data/ext/nokogiri/html_document.c +86 -0
- data/ext/nokogiri/html_document.h +10 -0
- data/ext/nokogiri/html_sax_parser.c +36 -0
- data/ext/nokogiri/html_sax_parser.h +11 -0
- data/ext/nokogiri/native.c +41 -0
- data/ext/nokogiri/native.h +50 -0
- data/ext/nokogiri/xml_cdata.c +44 -0
- data/ext/nokogiri/xml_cdata.h +9 -0
- data/ext/nokogiri/xml_comment.c +42 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +206 -0
- data/ext/nokogiri/xml_document.h +10 -0
- data/ext/nokogiri/xml_dtd.c +121 -0
- data/ext/nokogiri/xml_dtd.h +8 -0
- data/ext/nokogiri/xml_io.c +17 -0
- data/ext/nokogiri/xml_io.h +9 -0
- data/ext/nokogiri/xml_node.c +727 -0
- data/ext/nokogiri/xml_node.h +13 -0
- data/ext/nokogiri/xml_node_set.c +118 -0
- data/ext/nokogiri/xml_node_set.h +9 -0
- data/ext/nokogiri/xml_reader.c +465 -0
- data/ext/nokogiri/xml_reader.h +10 -0
- data/ext/nokogiri/xml_sax_parser.c +201 -0
- data/ext/nokogiri/xml_sax_parser.h +10 -0
- data/ext/nokogiri/xml_syntax_error.c +199 -0
- data/ext/nokogiri/xml_syntax_error.h +11 -0
- data/ext/nokogiri/xml_text.c +40 -0
- data/ext/nokogiri/xml_text.h +9 -0
- data/ext/nokogiri/xml_xpath.c +53 -0
- data/ext/nokogiri/xml_xpath.h +11 -0
- data/ext/nokogiri/xml_xpath_context.c +214 -0
- data/ext/nokogiri/xml_xpath_context.h +9 -0
- data/ext/nokogiri/xslt_stylesheet.c +123 -0
- data/ext/nokogiri/xslt_stylesheet.h +9 -0
- data/lib/action-nokogiri.rb +30 -0
- data/lib/nokogiri.rb +72 -0
- data/lib/nokogiri/css.rb +25 -0
- data/lib/nokogiri/css/generated_parser.rb +721 -0
- data/lib/nokogiri/css/generated_tokenizer.rb +159 -0
- data/lib/nokogiri/css/node.rb +97 -0
- data/lib/nokogiri/css/parser.rb +64 -0
- data/lib/nokogiri/css/parser.y +216 -0
- data/lib/nokogiri/css/syntax_error.rb +6 -0
- data/lib/nokogiri/css/tokenizer.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rex +63 -0
- data/lib/nokogiri/css/xpath_visitor.rb +168 -0
- data/lib/nokogiri/decorators.rb +2 -0
- data/lib/nokogiri/decorators/hpricot.rb +3 -0
- data/lib/nokogiri/decorators/hpricot/node.rb +56 -0
- data/lib/nokogiri/decorators/hpricot/node_set.rb +54 -0
- data/lib/nokogiri/decorators/hpricot/xpath_visitor.rb +28 -0
- data/lib/nokogiri/decorators/slop.rb +31 -0
- data/lib/nokogiri/hpricot.rb +51 -0
- data/lib/nokogiri/html.rb +105 -0
- data/lib/nokogiri/html/builder.rb +9 -0
- data/lib/nokogiri/html/document.rb +9 -0
- data/lib/nokogiri/html/sax/parser.rb +21 -0
- data/lib/nokogiri/version.rb +3 -0
- data/lib/nokogiri/xml.rb +83 -0
- data/lib/nokogiri/xml/after_handler.rb +18 -0
- data/lib/nokogiri/xml/attr.rb +10 -0
- data/lib/nokogiri/xml/before_handler.rb +33 -0
- data/lib/nokogiri/xml/builder.rb +84 -0
- data/lib/nokogiri/xml/cdata.rb +9 -0
- data/lib/nokogiri/xml/comment.rb +6 -0
- data/lib/nokogiri/xml/document.rb +55 -0
- data/lib/nokogiri/xml/dtd.rb +6 -0
- data/lib/nokogiri/xml/element.rb +6 -0
- data/lib/nokogiri/xml/entity_declaration.rb +9 -0
- data/lib/nokogiri/xml/node.rb +333 -0
- data/lib/nokogiri/xml/node_set.rb +197 -0
- data/lib/nokogiri/xml/notation.rb +6 -0
- data/lib/nokogiri/xml/reader.rb +20 -0
- data/lib/nokogiri/xml/sax.rb +9 -0
- data/lib/nokogiri/xml/sax/document.rb +59 -0
- data/lib/nokogiri/xml/sax/parser.rb +37 -0
- data/lib/nokogiri/xml/syntax_error.rb +21 -0
- data/lib/nokogiri/xml/text.rb +6 -0
- data/lib/nokogiri/xml/xpath.rb +10 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +8 -0
- data/lib/nokogiri/xml/xpath_context.rb +14 -0
- data/lib/nokogiri/xslt.rb +28 -0
- data/lib/nokogiri/xslt/stylesheet.rb +6 -0
- data/test/css/test_nthiness.rb +159 -0
- data/test/css/test_parser.rb +237 -0
- data/test/css/test_tokenizer.rb +162 -0
- data/test/css/test_xpath_visitor.rb +64 -0
- data/test/files/dont_hurt_em_why.xml +422 -0
- data/test/files/exslt.xml +8 -0
- data/test/files/exslt.xslt +35 -0
- data/test/files/staff.xml +59 -0
- data/test/files/staff.xslt +32 -0
- data/test/files/tlm.html +850 -0
- data/test/helper.rb +78 -0
- data/test/hpricot/files/basic.xhtml +17 -0
- data/test/hpricot/files/boingboing.html +2266 -0
- data/test/hpricot/files/cy0.html +3653 -0
- data/test/hpricot/files/immob.html +400 -0
- data/test/hpricot/files/pace_application.html +1320 -0
- data/test/hpricot/files/tenderlove.html +16 -0
- data/test/hpricot/files/uswebgen.html +220 -0
- data/test/hpricot/files/utf8.html +1054 -0
- data/test/hpricot/files/week9.html +1723 -0
- data/test/hpricot/files/why.xml +19 -0
- data/test/hpricot/load_files.rb +11 -0
- data/test/hpricot/test_alter.rb +67 -0
- data/test/hpricot/test_builder.rb +27 -0
- data/test/hpricot/test_parser.rb +426 -0
- data/test/hpricot/test_paths.rb +15 -0
- data/test/hpricot/test_preserved.rb +77 -0
- data/test/hpricot/test_xml.rb +30 -0
- data/test/html/sax/test_parser.rb +27 -0
- data/test/html/test_builder.rb +89 -0
- data/test/html/test_document.rb +150 -0
- data/test/html/test_node.rb +21 -0
- data/test/test_convert_xpath.rb +185 -0
- data/test/test_css_cache.rb +57 -0
- data/test/test_gc.rb +15 -0
- data/test/test_memory_leak.rb +38 -0
- data/test/test_nokogiri.rb +97 -0
- data/test/test_reader.rb +222 -0
- data/test/test_xslt_transforms.rb +93 -0
- data/test/xml/sax/test_parser.rb +95 -0
- data/test/xml/test_attr.rb +15 -0
- data/test/xml/test_builder.rb +16 -0
- data/test/xml/test_cdata.rb +18 -0
- data/test/xml/test_comment.rb +16 -0
- data/test/xml/test_document.rb +195 -0
- data/test/xml/test_dtd.rb +43 -0
- data/test/xml/test_node.rb +394 -0
- data/test/xml/test_node_set.rb +143 -0
- data/test/xml/test_text.rb +13 -0
- data/test/xml/test_xpath.rb +105 -0
- data/vendor/hoe.rb +1020 -0
- metadata +233 -0
data/lib/nokogiri.rb
ADDED
@@ -0,0 +1,72 @@
|
|
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
|
+
), ENV['PATH']].compact.join(';') if RUBY_PLATFORM =~ /mswin/i
|
14
|
+
|
15
|
+
require 'nokogiri/native' unless RUBY_PLATFORM =~ /java/
|
16
|
+
|
17
|
+
module Nokogiri
|
18
|
+
class << self
|
19
|
+
attr_accessor :error_handler
|
20
|
+
|
21
|
+
###
|
22
|
+
# Parse an HTML or XML document. +string+ contains the document.
|
23
|
+
def parse string, url = nil, encoding = nil, options = nil
|
24
|
+
doc =
|
25
|
+
if string =~ /^\s*<[^Hh>]*html/i # Probably html
|
26
|
+
Nokogiri::HTML.parse(string, url, encoding, options || 2145)
|
27
|
+
else
|
28
|
+
Nokogiri::XML.parse(string, url, encoding, options || 2159)
|
29
|
+
end
|
30
|
+
yield doc if block_given?
|
31
|
+
doc
|
32
|
+
end
|
33
|
+
|
34
|
+
def make input = nil, opts = {}, &blk
|
35
|
+
if input
|
36
|
+
Nokogiri::XML::Node.new_from_str(input)
|
37
|
+
else
|
38
|
+
Nokogiri(&blk)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
###
|
43
|
+
# Parse a document and add the Slop decorator. The Slop decorator
|
44
|
+
# implements method_missing such that methods may be used instead of CSS
|
45
|
+
# or XPath. For example:
|
46
|
+
#
|
47
|
+
# doc = Nokogiri::Slop(<<-eohtml)
|
48
|
+
# <html>
|
49
|
+
# <body>
|
50
|
+
# <p>first</p>
|
51
|
+
# <p>second</p>
|
52
|
+
# </body>
|
53
|
+
# </html>
|
54
|
+
# eohtml
|
55
|
+
# assert_equal('second', doc.html.body.p[1].text)
|
56
|
+
#
|
57
|
+
def Slop(*args, &block)
|
58
|
+
Nokogiri(*args, &block).slop!
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
self.error_handler = lambda { |syntax_error| }
|
63
|
+
end
|
64
|
+
|
65
|
+
def Nokogiri(*args, &block)
|
66
|
+
if block_given?
|
67
|
+
builder = Nokogiri::HTML::Builder.new(&block)
|
68
|
+
return builder.doc
|
69
|
+
else
|
70
|
+
Nokogiri.parse(*args)
|
71
|
+
end
|
72
|
+
end
|
data/lib/nokogiri/css.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'nokogiri/css/node'
|
2
|
+
require 'nokogiri/css/xpath_visitor'
|
3
|
+
require 'nokogiri/css/generated_parser'
|
4
|
+
require 'nokogiri/css/generated_tokenizer'
|
5
|
+
require 'nokogiri/css/tokenizer'
|
6
|
+
require 'nokogiri/css/parser'
|
7
|
+
require 'nokogiri/css/syntax_error'
|
8
|
+
|
9
|
+
module Nokogiri
|
10
|
+
module CSS
|
11
|
+
class << self
|
12
|
+
###
|
13
|
+
# Parse this CSS selector in +selector+. Returns an AST.
|
14
|
+
def parse selector
|
15
|
+
Parser.new.parse selector
|
16
|
+
end
|
17
|
+
|
18
|
+
###
|
19
|
+
# Get the XPath for +selector+.
|
20
|
+
def xpath_for selector, options={}
|
21
|
+
Parser.new.xpath_for selector, options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,721 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.6
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
|
10
|
+
module Nokogiri
|
11
|
+
module CSS
|
12
|
+
class GeneratedParser < Racc::Parser
|
13
|
+
##### State transition tables begin ###
|
14
|
+
|
15
|
+
racc_action_table = [
|
16
|
+
5, 28, 27, 22, 10, 5, 27, 5, 24, 1,
|
17
|
+
43, 10, 31, 29, 49, 27, 1, 5, 27, 53,
|
18
|
+
54, 31, 87, 89, 31, 59, 67, 87, 89, 54,
|
19
|
+
10, 68, 102, 101, 26, 7, 9, 12, 15, 10,
|
20
|
+
7, 18, 7, 9, 12, 15, 10, 10, 18, 90,
|
21
|
+
92, 93, 7, 86, 90, 92, 93, 5, 86, 43,
|
22
|
+
43, 10, 9, 85, 15, 10, 1, 18, 85, 10,
|
23
|
+
43, 9, 57, 15, 43, 43, 18, 44, 9, 9,
|
24
|
+
15, 15, 56, 18, 18, 38, 39, 40, 43, 43,
|
25
|
+
44, 72, 7, 9, 12, 15, 73, 9, 18, 15,
|
26
|
+
43, 9, 18, 15, 43, 55, 18, 43, 43, 43,
|
27
|
+
52, 34, 82, 35, 36, 51, 44, 43, 32, 95,
|
28
|
+
43, 97, 43, 99, 100, 15, 43, 43 ]
|
29
|
+
|
30
|
+
racc_action_check = [
|
31
|
+
0, 6, 5, 5, 0, 18, 74, 58, 5, 0,
|
32
|
+
38, 58, 74, 6, 18, 7, 58, 42, 75, 24,
|
33
|
+
24, 7, 77, 77, 75, 30, 42, 78, 78, 31,
|
34
|
+
14, 42, 98, 98, 5, 0, 0, 0, 0, 70,
|
35
|
+
18, 0, 58, 58, 58, 58, 16, 11, 58, 77,
|
36
|
+
77, 77, 42, 77, 78, 78, 78, 37, 78, 34,
|
37
|
+
35, 37, 14, 77, 14, 3, 37, 14, 78, 4,
|
38
|
+
36, 70, 28, 70, 29, 39, 70, 16, 16, 11,
|
39
|
+
16, 11, 27, 16, 11, 13, 13, 13, 43, 44,
|
40
|
+
46, 51, 37, 37, 37, 37, 53, 3, 37, 3,
|
41
|
+
54, 4, 3, 4, 56, 25, 4, 66, 67, 68,
|
42
|
+
23, 13, 73, 13, 13, 22, 17, 15, 9, 79,
|
43
|
+
81, 88, 91, 94, 96, 2, 101, 102 ]
|
44
|
+
|
45
|
+
racc_action_pointer = [
|
46
|
+
-2, nil, 85, 59, 63, -8, 1, 5, nil, 107,
|
47
|
+
nil, 41, nil, 78, 24, 108, 40, 79, 3, nil,
|
48
|
+
nil, nil, 108, 68, 8, 63, nil, 70, 72, 65,
|
49
|
+
-17, 17, nil, nil, 50, 51, 61, 55, 1, 66,
|
50
|
+
nil, nil, 15, 79, 80, nil, 53, nil, nil, nil,
|
51
|
+
nil, 75, nil, 89, 91, nil, 95, nil, 5, nil,
|
52
|
+
nil, nil, nil, nil, nil, nil, 98, 99, 100, nil,
|
53
|
+
33, nil, nil, 96, -4, 8, nil, 19, 24, 78,
|
54
|
+
nil, 111, nil, nil, nil, nil, nil, nil, 80, nil,
|
55
|
+
nil, 113, nil, nil, 82, nil, 82, nil, 22, nil,
|
56
|
+
nil, 117, 118, nil, nil ]
|
57
|
+
|
58
|
+
racc_action_default = [
|
59
|
+
-63, -19, -12, -46, -45, -63, -63, -63, -2, -63,
|
60
|
+
-48, -47, -20, -17, -44, -62, -39, -15, -63, -13,
|
61
|
+
-42, -41, -35, -63, -30, -63, -24, -31, -63, -62,
|
62
|
+
-63, -30, -18, -43, -62, -62, -62, -63, -62, -62,
|
63
|
+
-6, -40, -63, -62, -62, -9, -38, -11, -14, -37,
|
64
|
+
-36, -63, -25, -34, -62, -26, -62, 105, -63, -27,
|
65
|
+
-5, -8, -7, -16, -3, -4, -62, -62, -62, -61,
|
66
|
+
-63, -10, -33, -63, -63, -63, -1, -51, -51, -63,
|
67
|
+
-60, -62, -32, -28, -29, -52, -56, -57, -63, -58,
|
68
|
+
-53, -62, -54, -55, -63, -23, -63, -22, -63, -21,
|
69
|
+
-59, -62, -62, -49, -50 ]
|
70
|
+
|
71
|
+
racc_goto_table = [
|
72
|
+
42, 23, 50, 30, 6, 20, 21, 8, 47, 48,
|
73
|
+
88, 94, 19, 33, 58, 45, 41, 37, 46, 60,
|
74
|
+
61, 62, 25, 64, 65, 81, 66, nil, 69, 70,
|
75
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 71, 74,
|
76
|
+
nil, 75, nil, nil, 63, nil, nil, nil, nil, nil,
|
77
|
+
nil, 77, 78, 79, nil, nil, nil, nil, nil, nil,
|
78
|
+
nil, nil, nil, nil, nil, 76, 96, nil, nil, nil,
|
79
|
+
83, 84, 80, nil, nil, nil, 98, nil, nil, nil,
|
80
|
+
nil, nil, nil, nil, nil, nil, 103, 104 ]
|
81
|
+
|
82
|
+
racc_goto_check = [
|
83
|
+
2, 14, 10, 14, 1, 8, 8, 3, 9, 9,
|
84
|
+
13, 13, 11, 8, 2, 7, 8, 4, 8, 2,
|
85
|
+
2, 2, 15, 2, 2, 19, 10, nil, 2, 2,
|
86
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 9, 2,
|
87
|
+
nil, 2, nil, nil, 3, nil, nil, nil, nil, nil,
|
88
|
+
nil, 2, 2, 2, nil, nil, nil, nil, nil, nil,
|
89
|
+
nil, nil, nil, nil, nil, 3, 2, nil, nil, nil,
|
90
|
+
14, 14, 8, nil, nil, nil, 2, nil, nil, nil,
|
91
|
+
nil, nil, nil, nil, nil, nil, 2, 2 ]
|
92
|
+
|
93
|
+
racc_goto_pointer = [
|
94
|
+
nil, 4, -15, 7, 4, nil, nil, -1, 2, -8,
|
95
|
+
-16, 10, nil, -67, -4, 17, nil, nil, nil, -45 ]
|
96
|
+
|
97
|
+
racc_goto_default = [
|
98
|
+
nil, nil, nil, nil, nil, 13, 16, nil, 17, nil,
|
99
|
+
2, 3, 4, nil, nil, nil, 11, 14, 91, nil ]
|
100
|
+
|
101
|
+
racc_reduce_table = [
|
102
|
+
0, 0, :racc_error,
|
103
|
+
4, 46, :_reduce_1,
|
104
|
+
1, 46, :_reduce_2,
|
105
|
+
2, 49, :_reduce_3,
|
106
|
+
2, 49, :_reduce_4,
|
107
|
+
2, 49, :_reduce_5,
|
108
|
+
1, 49, :_reduce_6,
|
109
|
+
2, 49, :_reduce_7,
|
110
|
+
2, 49, :_reduce_8,
|
111
|
+
2, 50, :_reduce_9,
|
112
|
+
3, 50, :_reduce_10,
|
113
|
+
2, 50, :_reduce_11,
|
114
|
+
1, 50, :_reduce_none,
|
115
|
+
2, 50, :_reduce_13,
|
116
|
+
2, 50, :_reduce_14,
|
117
|
+
1, 50, :_reduce_15,
|
118
|
+
3, 48, :_reduce_16,
|
119
|
+
1, 48, :_reduce_none,
|
120
|
+
2, 57, :_reduce_18,
|
121
|
+
1, 51, :_reduce_19,
|
122
|
+
1, 51, :_reduce_20,
|
123
|
+
6, 56, :_reduce_21,
|
124
|
+
6, 56, :_reduce_22,
|
125
|
+
5, 56, :_reduce_23,
|
126
|
+
2, 55, :_reduce_24,
|
127
|
+
3, 55, :_reduce_25,
|
128
|
+
3, 55, :_reduce_26,
|
129
|
+
3, 55, :_reduce_27,
|
130
|
+
4, 59, :_reduce_28,
|
131
|
+
4, 59, :_reduce_29,
|
132
|
+
1, 59, :_reduce_none,
|
133
|
+
1, 59, :_reduce_none,
|
134
|
+
4, 60, :_reduce_32,
|
135
|
+
3, 60, :_reduce_33,
|
136
|
+
2, 60, :_reduce_34,
|
137
|
+
1, 60, :_reduce_35,
|
138
|
+
2, 61, :_reduce_36,
|
139
|
+
2, 61, :_reduce_37,
|
140
|
+
1, 52, :_reduce_none,
|
141
|
+
0, 52, :_reduce_none,
|
142
|
+
2, 53, :_reduce_40,
|
143
|
+
2, 53, :_reduce_41,
|
144
|
+
2, 53, :_reduce_42,
|
145
|
+
2, 53, :_reduce_43,
|
146
|
+
1, 53, :_reduce_none,
|
147
|
+
1, 53, :_reduce_none,
|
148
|
+
1, 53, :_reduce_none,
|
149
|
+
1, 53, :_reduce_none,
|
150
|
+
1, 62, :_reduce_48,
|
151
|
+
4, 58, :_reduce_49,
|
152
|
+
4, 58, :_reduce_50,
|
153
|
+
0, 58, :_reduce_none,
|
154
|
+
1, 63, :_reduce_none,
|
155
|
+
1, 63, :_reduce_none,
|
156
|
+
1, 63, :_reduce_none,
|
157
|
+
1, 63, :_reduce_none,
|
158
|
+
1, 63, :_reduce_none,
|
159
|
+
1, 63, :_reduce_none,
|
160
|
+
1, 63, :_reduce_none,
|
161
|
+
5, 54, :_reduce_59,
|
162
|
+
1, 64, :_reduce_none,
|
163
|
+
2, 47, :_reduce_none,
|
164
|
+
0, 47, :_reduce_none ]
|
165
|
+
|
166
|
+
racc_reduce_n = 63
|
167
|
+
|
168
|
+
racc_shift_n = 105
|
169
|
+
|
170
|
+
racc_token_table = {
|
171
|
+
false => 0,
|
172
|
+
:error => 1,
|
173
|
+
:FUNCTION => 2,
|
174
|
+
:INCLUDES => 3,
|
175
|
+
:DASHMATCH => 4,
|
176
|
+
:LBRACE => 5,
|
177
|
+
:HASH => 6,
|
178
|
+
:PLUS => 7,
|
179
|
+
:GREATER => 8,
|
180
|
+
:S => 9,
|
181
|
+
:STRING => 10,
|
182
|
+
:IDENT => 11,
|
183
|
+
:COMMA => 12,
|
184
|
+
:URI => 13,
|
185
|
+
:CDO => 14,
|
186
|
+
:CDC => 15,
|
187
|
+
:NUMBER => 16,
|
188
|
+
:PERCENTAGE => 17,
|
189
|
+
:LENGTH => 18,
|
190
|
+
:EMS => 19,
|
191
|
+
:EXS => 20,
|
192
|
+
:ANGLE => 21,
|
193
|
+
:TIME => 22,
|
194
|
+
:FREQ => 23,
|
195
|
+
:IMPORTANT_SYM => 24,
|
196
|
+
:IMPORT_SYM => 25,
|
197
|
+
:MEDIA_SYM => 26,
|
198
|
+
:PAGE_SYM => 27,
|
199
|
+
:CHARSET_SYM => 28,
|
200
|
+
:DIMENSION => 29,
|
201
|
+
:PREFIXMATCH => 30,
|
202
|
+
:SUFFIXMATCH => 31,
|
203
|
+
:SUBSTRINGMATCH => 32,
|
204
|
+
:TILDE => 33,
|
205
|
+
:NOT_EQUAL => 34,
|
206
|
+
:SLASH => 35,
|
207
|
+
:DOUBLESLASH => 36,
|
208
|
+
:NOT => 37,
|
209
|
+
"." => 38,
|
210
|
+
"*" => 39,
|
211
|
+
"[" => 40,
|
212
|
+
"]" => 41,
|
213
|
+
")" => 42,
|
214
|
+
":" => 43,
|
215
|
+
"=" => 44 }
|
216
|
+
|
217
|
+
racc_nt_base = 45
|
218
|
+
|
219
|
+
racc_use_result_var = true
|
220
|
+
|
221
|
+
Racc_arg = [
|
222
|
+
racc_action_table,
|
223
|
+
racc_action_check,
|
224
|
+
racc_action_default,
|
225
|
+
racc_action_pointer,
|
226
|
+
racc_goto_table,
|
227
|
+
racc_goto_check,
|
228
|
+
racc_goto_default,
|
229
|
+
racc_goto_pointer,
|
230
|
+
racc_nt_base,
|
231
|
+
racc_reduce_table,
|
232
|
+
racc_token_table,
|
233
|
+
racc_shift_n,
|
234
|
+
racc_reduce_n,
|
235
|
+
racc_use_result_var ]
|
236
|
+
|
237
|
+
Racc_token_to_s_table = [
|
238
|
+
"$end",
|
239
|
+
"error",
|
240
|
+
"FUNCTION",
|
241
|
+
"INCLUDES",
|
242
|
+
"DASHMATCH",
|
243
|
+
"LBRACE",
|
244
|
+
"HASH",
|
245
|
+
"PLUS",
|
246
|
+
"GREATER",
|
247
|
+
"S",
|
248
|
+
"STRING",
|
249
|
+
"IDENT",
|
250
|
+
"COMMA",
|
251
|
+
"URI",
|
252
|
+
"CDO",
|
253
|
+
"CDC",
|
254
|
+
"NUMBER",
|
255
|
+
"PERCENTAGE",
|
256
|
+
"LENGTH",
|
257
|
+
"EMS",
|
258
|
+
"EXS",
|
259
|
+
"ANGLE",
|
260
|
+
"TIME",
|
261
|
+
"FREQ",
|
262
|
+
"IMPORTANT_SYM",
|
263
|
+
"IMPORT_SYM",
|
264
|
+
"MEDIA_SYM",
|
265
|
+
"PAGE_SYM",
|
266
|
+
"CHARSET_SYM",
|
267
|
+
"DIMENSION",
|
268
|
+
"PREFIXMATCH",
|
269
|
+
"SUFFIXMATCH",
|
270
|
+
"SUBSTRINGMATCH",
|
271
|
+
"TILDE",
|
272
|
+
"NOT_EQUAL",
|
273
|
+
"SLASH",
|
274
|
+
"DOUBLESLASH",
|
275
|
+
"NOT",
|
276
|
+
"\".\"",
|
277
|
+
"\"*\"",
|
278
|
+
"\"[\"",
|
279
|
+
"\"]\"",
|
280
|
+
"\")\"",
|
281
|
+
"\":\"",
|
282
|
+
"\"=\"",
|
283
|
+
"$start",
|
284
|
+
"selector",
|
285
|
+
"s_0toN",
|
286
|
+
"simple_selector_1toN",
|
287
|
+
"combinator",
|
288
|
+
"simple_selector",
|
289
|
+
"element_name",
|
290
|
+
"hcap_0toN",
|
291
|
+
"hcap_1toN",
|
292
|
+
"negation",
|
293
|
+
"function",
|
294
|
+
"attrib",
|
295
|
+
"class",
|
296
|
+
"attrib_val_0or1",
|
297
|
+
"expr",
|
298
|
+
"an_plus_b",
|
299
|
+
"pseudo",
|
300
|
+
"attribute_id",
|
301
|
+
"eql_incl_dash",
|
302
|
+
"negation_arg" ]
|
303
|
+
|
304
|
+
Racc_debug_parser = false
|
305
|
+
|
306
|
+
##### State transition tables end #####
|
307
|
+
|
308
|
+
# reduce 0 omitted
|
309
|
+
|
310
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
311
|
+
def _reduce_1(val, _values, result)
|
312
|
+
result = [val.first, val.last].flatten
|
313
|
+
|
314
|
+
result
|
315
|
+
end
|
316
|
+
.,.,
|
317
|
+
|
318
|
+
module_eval(<<'.,.,', 'parser.y', 13)
|
319
|
+
def _reduce_2(val, _values, result)
|
320
|
+
result = val.flatten
|
321
|
+
result
|
322
|
+
end
|
323
|
+
.,.,
|
324
|
+
|
325
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
326
|
+
def _reduce_3(val, _values, result)
|
327
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
328
|
+
result
|
329
|
+
end
|
330
|
+
.,.,
|
331
|
+
|
332
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
333
|
+
def _reduce_4(val, _values, result)
|
334
|
+
result = :CHILD_SELECTOR
|
335
|
+
result
|
336
|
+
end
|
337
|
+
.,.,
|
338
|
+
|
339
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
340
|
+
def _reduce_5(val, _values, result)
|
341
|
+
result = :PRECEDING_SELECTOR
|
342
|
+
result
|
343
|
+
end
|
344
|
+
.,.,
|
345
|
+
|
346
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
347
|
+
def _reduce_6(val, _values, result)
|
348
|
+
result = :DESCENDANT_SELECTOR
|
349
|
+
result
|
350
|
+
end
|
351
|
+
.,.,
|
352
|
+
|
353
|
+
module_eval(<<'.,.,', 'parser.y', 20)
|
354
|
+
def _reduce_7(val, _values, result)
|
355
|
+
result = :DESCENDANT_SELECTOR
|
356
|
+
result
|
357
|
+
end
|
358
|
+
.,.,
|
359
|
+
|
360
|
+
module_eval(<<'.,.,', 'parser.y', 21)
|
361
|
+
def _reduce_8(val, _values, result)
|
362
|
+
result = :CHILD_SELECTOR
|
363
|
+
result
|
364
|
+
end
|
365
|
+
.,.,
|
366
|
+
|
367
|
+
module_eval(<<'.,.,', 'parser.y', 25)
|
368
|
+
def _reduce_9(val, _values, result)
|
369
|
+
result = if val[1].nil?
|
370
|
+
val.first
|
371
|
+
else
|
372
|
+
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
373
|
+
end
|
374
|
+
|
375
|
+
result
|
376
|
+
end
|
377
|
+
.,.,
|
378
|
+
|
379
|
+
module_eval(<<'.,.,', 'parser.y', 32)
|
380
|
+
def _reduce_10(val, _values, result)
|
381
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
382
|
+
[
|
383
|
+
val.first,
|
384
|
+
Node.new(:COMBINATOR, [val[1], val.last])
|
385
|
+
]
|
386
|
+
)
|
387
|
+
|
388
|
+
result
|
389
|
+
end
|
390
|
+
.,.,
|
391
|
+
|
392
|
+
module_eval(<<'.,.,', 'parser.y', 40)
|
393
|
+
def _reduce_11(val, _values, result)
|
394
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
395
|
+
|
396
|
+
result
|
397
|
+
end
|
398
|
+
.,.,
|
399
|
+
|
400
|
+
# reduce 12 omitted
|
401
|
+
|
402
|
+
module_eval(<<'.,.,', 'parser.y', 44)
|
403
|
+
def _reduce_13(val, _values, result)
|
404
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
405
|
+
|
406
|
+
result
|
407
|
+
end
|
408
|
+
.,.,
|
409
|
+
|
410
|
+
module_eval(<<'.,.,', 'parser.y', 47)
|
411
|
+
def _reduce_14(val, _values, result)
|
412
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
413
|
+
[
|
414
|
+
Node.new(:ELEMENT_NAME, ['*']),
|
415
|
+
Node.new(:COMBINATOR, val)
|
416
|
+
]
|
417
|
+
)
|
418
|
+
|
419
|
+
result
|
420
|
+
end
|
421
|
+
.,.,
|
422
|
+
|
423
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
424
|
+
def _reduce_15(val, _values, result)
|
425
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
426
|
+
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
427
|
+
)
|
428
|
+
|
429
|
+
result
|
430
|
+
end
|
431
|
+
.,.,
|
432
|
+
|
433
|
+
module_eval(<<'.,.,', 'parser.y', 62)
|
434
|
+
def _reduce_16(val, _values, result)
|
435
|
+
result = Node.new(val[1], [val.first, val.last])
|
436
|
+
|
437
|
+
result
|
438
|
+
end
|
439
|
+
.,.,
|
440
|
+
|
441
|
+
# reduce 17 omitted
|
442
|
+
|
443
|
+
module_eval(<<'.,.,', 'parser.y', 67)
|
444
|
+
def _reduce_18(val, _values, result)
|
445
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
446
|
+
result
|
447
|
+
end
|
448
|
+
.,.,
|
449
|
+
|
450
|
+
module_eval(<<'.,.,', 'parser.y', 70)
|
451
|
+
def _reduce_19(val, _values, result)
|
452
|
+
result = Node.new(:ELEMENT_NAME, val)
|
453
|
+
result
|
454
|
+
end
|
455
|
+
.,.,
|
456
|
+
|
457
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
458
|
+
def _reduce_20(val, _values, result)
|
459
|
+
result = Node.new(:ELEMENT_NAME, val)
|
460
|
+
result
|
461
|
+
end
|
462
|
+
.,.,
|
463
|
+
|
464
|
+
module_eval(<<'.,.,', 'parser.y', 75)
|
465
|
+
def _reduce_21(val, _values, result)
|
466
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
467
|
+
[Node.new(:ELEMENT_NAME, [val[2]])] + (val[4] || [])
|
468
|
+
)
|
469
|
+
|
470
|
+
result
|
471
|
+
end
|
472
|
+
.,.,
|
473
|
+
|
474
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
475
|
+
def _reduce_22(val, _values, result)
|
476
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
477
|
+
[val[2]] + (val[4] || [])
|
478
|
+
)
|
479
|
+
|
480
|
+
result
|
481
|
+
end
|
482
|
+
.,.,
|
483
|
+
|
484
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
485
|
+
def _reduce_23(val, _values, result)
|
486
|
+
# Non standard, but hpricot supports it.
|
487
|
+
result = Node.new(:PSEUDO_CLASS,
|
488
|
+
[Node.new(:FUNCTION, ['nth-child(', val[2]])]
|
489
|
+
)
|
490
|
+
|
491
|
+
result
|
492
|
+
end
|
493
|
+
.,.,
|
494
|
+
|
495
|
+
module_eval(<<'.,.,', 'parser.y', 93)
|
496
|
+
def _reduce_24(val, _values, result)
|
497
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
498
|
+
|
499
|
+
result
|
500
|
+
end
|
501
|
+
.,.,
|
502
|
+
|
503
|
+
module_eval(<<'.,.,', 'parser.y', 96)
|
504
|
+
def _reduce_25(val, _values, result)
|
505
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
506
|
+
|
507
|
+
result
|
508
|
+
end
|
509
|
+
.,.,
|
510
|
+
|
511
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
512
|
+
def _reduce_26(val, _values, result)
|
513
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
514
|
+
|
515
|
+
result
|
516
|
+
end
|
517
|
+
.,.,
|
518
|
+
|
519
|
+
module_eval(<<'.,.,', 'parser.y', 102)
|
520
|
+
def _reduce_27(val, _values, result)
|
521
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
522
|
+
|
523
|
+
result
|
524
|
+
end
|
525
|
+
.,.,
|
526
|
+
|
527
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
528
|
+
def _reduce_28(val, _values, result)
|
529
|
+
result = [val.first, val.last]
|
530
|
+
result
|
531
|
+
end
|
532
|
+
.,.,
|
533
|
+
|
534
|
+
module_eval(<<'.,.,', 'parser.y', 107)
|
535
|
+
def _reduce_29(val, _values, result)
|
536
|
+
result = [val.first, val.last]
|
537
|
+
result
|
538
|
+
end
|
539
|
+
.,.,
|
540
|
+
|
541
|
+
# reduce 30 omitted
|
542
|
+
|
543
|
+
# reduce 31 omitted
|
544
|
+
|
545
|
+
module_eval(<<'.,.,', 'parser.y', 114)
|
546
|
+
def _reduce_32(val, _values, result)
|
547
|
+
if val[1] == 'n'
|
548
|
+
result = Node.new(:AN_PLUS_B, val)
|
549
|
+
else
|
550
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
551
|
+
end
|
552
|
+
|
553
|
+
result
|
554
|
+
end
|
555
|
+
.,.,
|
556
|
+
|
557
|
+
module_eval(<<'.,.,', 'parser.y', 120)
|
558
|
+
def _reduce_33(val, _values, result)
|
559
|
+
# n+3, -n+3
|
560
|
+
if val[0] == 'n'
|
561
|
+
val.unshift("1")
|
562
|
+
result = Node.new(:AN_PLUS_B, val)
|
563
|
+
elsif val[0] == '-n'
|
564
|
+
val[0] = 'n'
|
565
|
+
val.unshift("-1")
|
566
|
+
result = Node.new(:AN_PLUS_B, val)
|
567
|
+
else
|
568
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
569
|
+
end
|
570
|
+
|
571
|
+
result
|
572
|
+
end
|
573
|
+
.,.,
|
574
|
+
|
575
|
+
module_eval(<<'.,.,', 'parser.y', 134)
|
576
|
+
def _reduce_34(val, _values, result)
|
577
|
+
if val[1] == 'n'
|
578
|
+
val << "+"
|
579
|
+
val << "0"
|
580
|
+
result = Node.new(:AN_PLUS_B, val)
|
581
|
+
else
|
582
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
583
|
+
end
|
584
|
+
|
585
|
+
result
|
586
|
+
end
|
587
|
+
.,.,
|
588
|
+
|
589
|
+
module_eval(<<'.,.,', 'parser.y', 144)
|
590
|
+
def _reduce_35(val, _values, result)
|
591
|
+
if val[0] == 'even'
|
592
|
+
val = ["2","n","+","0"]
|
593
|
+
result = Node.new(:AN_PLUS_B, val)
|
594
|
+
elsif val[0] == 'odd'
|
595
|
+
val = ["2","n","+","1"]
|
596
|
+
result = Node.new(:AN_PLUS_B, val)
|
597
|
+
else
|
598
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[0]}'"
|
599
|
+
end
|
600
|
+
|
601
|
+
result
|
602
|
+
end
|
603
|
+
.,.,
|
604
|
+
|
605
|
+
module_eval(<<'.,.,', 'parser.y', 157)
|
606
|
+
def _reduce_36(val, _values, result)
|
607
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
608
|
+
|
609
|
+
result
|
610
|
+
end
|
611
|
+
.,.,
|
612
|
+
|
613
|
+
module_eval(<<'.,.,', 'parser.y', 159)
|
614
|
+
def _reduce_37(val, _values, result)
|
615
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
616
|
+
result
|
617
|
+
end
|
618
|
+
.,.,
|
619
|
+
|
620
|
+
# reduce 38 omitted
|
621
|
+
|
622
|
+
# reduce 39 omitted
|
623
|
+
|
624
|
+
module_eval(<<'.,.,', 'parser.y', 167)
|
625
|
+
def _reduce_40(val, _values, result)
|
626
|
+
result = Node.new(:COMBINATOR, val)
|
627
|
+
|
628
|
+
result
|
629
|
+
end
|
630
|
+
.,.,
|
631
|
+
|
632
|
+
module_eval(<<'.,.,', 'parser.y', 170)
|
633
|
+
def _reduce_41(val, _values, result)
|
634
|
+
result = Node.new(:COMBINATOR, val)
|
635
|
+
|
636
|
+
result
|
637
|
+
end
|
638
|
+
.,.,
|
639
|
+
|
640
|
+
module_eval(<<'.,.,', 'parser.y', 173)
|
641
|
+
def _reduce_42(val, _values, result)
|
642
|
+
result = Node.new(:COMBINATOR, val)
|
643
|
+
|
644
|
+
result
|
645
|
+
end
|
646
|
+
.,.,
|
647
|
+
|
648
|
+
module_eval(<<'.,.,', 'parser.y', 176)
|
649
|
+
def _reduce_43(val, _values, result)
|
650
|
+
result = Node.new(:COMBINATOR, val)
|
651
|
+
|
652
|
+
result
|
653
|
+
end
|
654
|
+
.,.,
|
655
|
+
|
656
|
+
# reduce 44 omitted
|
657
|
+
|
658
|
+
# reduce 45 omitted
|
659
|
+
|
660
|
+
# reduce 46 omitted
|
661
|
+
|
662
|
+
# reduce 47 omitted
|
663
|
+
|
664
|
+
module_eval(<<'.,.,', 'parser.y', 184)
|
665
|
+
def _reduce_48(val, _values, result)
|
666
|
+
result = Node.new(:ID, val)
|
667
|
+
result
|
668
|
+
end
|
669
|
+
.,.,
|
670
|
+
|
671
|
+
module_eval(<<'.,.,', 'parser.y', 187)
|
672
|
+
def _reduce_49(val, _values, result)
|
673
|
+
result = [val.first, val[2]]
|
674
|
+
result
|
675
|
+
end
|
676
|
+
.,.,
|
677
|
+
|
678
|
+
module_eval(<<'.,.,', 'parser.y', 188)
|
679
|
+
def _reduce_50(val, _values, result)
|
680
|
+
result = [val.first, val[2]]
|
681
|
+
result
|
682
|
+
end
|
683
|
+
.,.,
|
684
|
+
|
685
|
+
# reduce 51 omitted
|
686
|
+
|
687
|
+
# reduce 52 omitted
|
688
|
+
|
689
|
+
# reduce 53 omitted
|
690
|
+
|
691
|
+
# reduce 54 omitted
|
692
|
+
|
693
|
+
# reduce 55 omitted
|
694
|
+
|
695
|
+
# reduce 56 omitted
|
696
|
+
|
697
|
+
# reduce 57 omitted
|
698
|
+
|
699
|
+
# reduce 58 omitted
|
700
|
+
|
701
|
+
module_eval(<<'.,.,', 'parser.y', 202)
|
702
|
+
def _reduce_59(val, _values, result)
|
703
|
+
result = Node.new(:NOT, [val[2]])
|
704
|
+
|
705
|
+
result
|
706
|
+
end
|
707
|
+
.,.,
|
708
|
+
|
709
|
+
# reduce 60 omitted
|
710
|
+
|
711
|
+
# reduce 61 omitted
|
712
|
+
|
713
|
+
# reduce 62 omitted
|
714
|
+
|
715
|
+
def _reduce_none(val, _values, result)
|
716
|
+
val[0]
|
717
|
+
end
|
718
|
+
|
719
|
+
end # class GeneratedParser
|
720
|
+
end # module CSS
|
721
|
+
end # module Nokogiri
|