nokogiri 1.1.1 → 1.2.0
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 +34 -0
- data/History.txt +36 -0
- data/Manifest.txt +21 -0
- data/README.ja.txt +1 -1
- data/README.txt +1 -1
- data/Rakefile +27 -89
- data/ext/nokogiri/extconf.rb +48 -63
- data/ext/nokogiri/html_document.c +90 -29
- data/ext/nokogiri/html_sax_parser.c +23 -2
- data/ext/nokogiri/native.c +18 -8
- data/ext/nokogiri/native.h +22 -0
- data/ext/nokogiri/xml_attr.c +83 -0
- data/ext/nokogiri/xml_attr.h +9 -0
- data/ext/nokogiri/xml_cdata.c +1 -1
- data/ext/nokogiri/xml_document.c +84 -18
- data/ext/nokogiri/xml_document_fragment.c +38 -0
- data/ext/nokogiri/xml_document_fragment.h +10 -0
- data/ext/nokogiri/xml_dtd.c +2 -22
- data/ext/nokogiri/xml_entity_reference.c +41 -0
- data/ext/nokogiri/xml_entity_reference.h +9 -0
- data/ext/nokogiri/xml_io.c +10 -3
- data/ext/nokogiri/xml_io.h +1 -0
- data/ext/nokogiri/xml_node.c +116 -66
- data/ext/nokogiri/xml_node_set.c +5 -1
- data/ext/nokogiri/xml_processing_instruction.c +44 -0
- data/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/ext/nokogiri/xml_reader.c +20 -4
- data/ext/nokogiri/xml_sax_parser.c +51 -15
- data/ext/nokogiri/xml_sax_push_parser.c +85 -0
- data/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +12 -8
- data/ext/nokogiri/xml_syntax_error.h +2 -1
- data/ext/nokogiri/xml_xpath_context.c +11 -2
- data/ext/nokogiri/xslt_stylesheet.c +1 -6
- data/lib/nokogiri.rb +10 -13
- data/lib/nokogiri/css.rb +1 -1
- data/lib/nokogiri/css/generated_parser.rb +287 -295
- data/lib/nokogiri/css/generated_tokenizer.rb +36 -51
- data/lib/nokogiri/css/node.rb +1 -3
- data/lib/nokogiri/css/parser.rb +21 -12
- data/lib/nokogiri/css/parser.y +55 -44
- data/lib/nokogiri/css/syntax_error.rb +2 -1
- data/lib/nokogiri/css/tokenizer.rex +23 -32
- data/lib/nokogiri/decorators/hpricot/node_set.rb +1 -1
- data/lib/nokogiri/html.rb +10 -4
- data/lib/nokogiri/html/document.rb +6 -2
- data/lib/nokogiri/syntax_error.rb +4 -0
- data/lib/nokogiri/version.rb +2 -1
- data/lib/nokogiri/xml.rb +3 -1
- data/lib/nokogiri/xml/attr.rb +3 -4
- data/lib/nokogiri/xml/cdata.rb +1 -1
- data/lib/nokogiri/xml/document.rb +4 -7
- data/lib/nokogiri/xml/document_fragment.rb +9 -0
- data/lib/nokogiri/xml/dtd.rb +3 -0
- data/lib/nokogiri/xml/node.rb +144 -40
- data/lib/nokogiri/xml/node/save_options.rb +32 -0
- data/lib/nokogiri/xml/node_set.rb +11 -20
- data/lib/nokogiri/xml/processing_instruction.rb +6 -0
- data/lib/nokogiri/xml/reader.rb +5 -0
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +47 -0
- data/lib/nokogiri/xml/syntax_error.rb +3 -1
- data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -1
- data/tasks/test.rb +136 -0
- data/test/css/test_parser.rb +4 -0
- data/test/css/test_tokenizer.rb +30 -17
- data/test/css/test_xpath_visitor.rb +11 -0
- data/test/helper.rb +11 -0
- data/test/hpricot/test_builder.rb +2 -9
- data/test/hpricot/test_parser.rb +4 -4
- data/test/html/test_builder.rb +7 -7
- data/test/html/test_document.rb +90 -4
- data/test/html/test_node.rb +1 -0
- data/test/test_css_cache.rb +1 -3
- data/test/test_reader.rb +19 -1
- data/test/test_xslt_transforms.rb +1 -1
- data/test/xml/node/test_save_options.rb +20 -0
- data/test/xml/sax/test_parser.rb +17 -0
- data/test/xml/sax/test_push_parser.rb +67 -0
- data/test/xml/test_attr.rb +16 -0
- data/test/xml/test_cdata.rb +1 -1
- data/test/xml/test_document.rb +45 -0
- data/test/xml/test_document_fragment.rb +18 -0
- data/test/xml/test_dtd.rb +2 -4
- data/test/xml/test_entity_reference.rb +16 -0
- data/test/xml/test_node.rb +149 -80
- data/test/xml/test_processing_instruction.rb +24 -0
- metadata +28 -2
data/lib/nokogiri/css.rb
CHANGED
@@ -13,159 +13,153 @@ module Nokogiri
|
|
13
13
|
##### State transition tables begin ###
|
14
14
|
|
15
15
|
racc_action_table = [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
52,
|
28
|
-
|
16
|
+
4, 22, 24, 26, 10, 62, 4, 72, 50, 1,
|
17
|
+
10, 21, 4, 23, 25, 1, 10, 10, 59, 18,
|
18
|
+
51, 1, 5, 10, 8, 18, 11, 14, 5, 10,
|
19
|
+
8, 18, 11, 14, 5, 5, 8, 8, 11, 14,
|
20
|
+
14, 5, 10, 8, 4, 57, 14, 5, 10, 8,
|
21
|
+
56, 40, 14, 46, 10, 33, 52, 40, 54, 58,
|
22
|
+
5, 77, 8, 18, 4, 14, 5, 78, 8, 64,
|
23
|
+
66, 14, 5, 34, 8, 35, 49, 14, 64, 66,
|
24
|
+
65, 67, 69, 18, 70, 60, 61, 56, 63, 65,
|
25
|
+
67, 69, 80, 70, 61, 33, 28, 63, 32, 33,
|
26
|
+
52, 5, 54, 33, 52, 82, 54, 83, 31, 33,
|
27
|
+
52, 40, 54, 87, 86, 42, -22, 88, 89, 90,
|
28
|
+
91 ]
|
29
29
|
|
30
30
|
racc_action_check = [
|
31
|
-
0,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
0, 2, 2, 2, 0, 33, 20, 35, 17, 0,
|
32
|
+
20, 2, 51, 2, 2, 20, 51, 3, 30, 0,
|
33
|
+
17, 51, 0, 40, 0, 20, 0, 0, 20, 15,
|
34
|
+
20, 51, 20, 20, 51, 3, 51, 3, 51, 51,
|
35
|
+
3, 40, 6, 40, 14, 28, 40, 15, 7, 15,
|
36
|
+
28, 38, 15, 14, 13, 18, 18, 6, 18, 29,
|
37
|
+
6, 49, 6, 14, 5, 6, 7, 50, 7, 34,
|
38
|
+
34, 7, 13, 5, 13, 5, 16, 13, 36, 36,
|
39
|
+
34, 34, 34, 5, 34, 32, 32, 52, 34, 36,
|
40
|
+
36, 36, 53, 36, 54, 4, 4, 36, 4, 62,
|
41
|
+
62, 12, 62, 61, 61, 57, 61, 60, 4, 56,
|
42
|
+
56, 9, 56, 68, 68, 8, 1, 71, 73, 76,
|
43
|
+
83 ]
|
44
44
|
|
45
45
|
racc_action_pointer = [
|
46
|
-
-2,
|
47
|
-
nil,
|
48
|
-
nil, nil,
|
49
|
-
|
50
|
-
nil, nil,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
nil,
|
55
|
-
nil,
|
56
|
-
nil, 117, 118, nil, nil ]
|
46
|
+
-2, 89, -6, 11, 85, 62, 36, 42, 104, 90,
|
47
|
+
nil, nil, 77, 48, 42, 23, 49, 8, 45, nil,
|
48
|
+
4, nil, nil, nil, nil, nil, nil, nil, 38, 36,
|
49
|
+
-5, nil, 74, -7, 66, -18, 75, nil, 30, nil,
|
50
|
+
17, nil, nil, nil, nil, nil, nil, nil, nil, 50,
|
51
|
+
67, 10, 75, 69, 82, nil, 99, 92, nil, nil,
|
52
|
+
100, 93, 89, nil, nil, nil, nil, nil, 103, nil,
|
53
|
+
nil, 92, nil, 93, nil, nil, 96, nil, nil, nil,
|
54
|
+
nil, nil, nil, 107, nil, nil, nil, nil, nil, nil,
|
55
|
+
nil, nil ]
|
57
56
|
|
58
57
|
racc_action_default = [
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
|
64
|
-
-
|
65
|
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-59, -62, -62, -49, -50 ]
|
58
|
+
-23, -20, -17, -51, -65, -65, -43, -48, -65, -15,
|
59
|
+
-52, -21, -12, -50, -65, -49, -65, -65, -65, -2,
|
60
|
+
-23, -5, -3, -8, -4, -7, -6, -47, -36, -65,
|
61
|
+
-65, -27, -34, -35, -55, -65, -55, -9, -42, -11,
|
62
|
+
-65, -44, -18, -14, -13, -46, -41, -40, -45, -65,
|
63
|
+
-65, -23, -36, -65, -34, -16, -65, -65, -28, -29,
|
64
|
+
-39, -65, -65, -56, -61, -57, -62, -58, -65, -59,
|
65
|
+
-60, -65, -26, -65, -10, -64, -65, -19, 92, -1,
|
66
|
+
-30, -33, -38, -65, -31, -32, -53, -54, -24, -25,
|
67
|
+
-63, -37 ]
|
70
68
|
|
71
69
|
racc_goto_table = [
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
nil, nil, nil, nil, nil,
|
76
|
-
nil,
|
77
|
-
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 ]
|
70
|
+
29, 27, 19, 39, 38, 41, 43, 36, 71, 17,
|
71
|
+
73, 45, 44, 48, 53, 37, 47, 20, 30, 76,
|
72
|
+
nil, nil, 55, nil, nil, nil, nil, nil, nil, nil,
|
73
|
+
nil, nil, nil, nil, nil, 74, nil, nil, 75, nil,
|
74
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
+
nil, nil, 81, 79, nil, nil, nil, 84, 85 ]
|
81
76
|
|
82
77
|
racc_goto_check = [
|
83
|
-
|
84
|
-
13,
|
85
|
-
|
86
|
-
nil, nil, nil, nil, nil,
|
87
|
-
nil,
|
88
|
-
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 ]
|
78
|
+
14, 7, 2, 8, 7, 7, 8, 9, 13, 1,
|
79
|
+
13, 7, 10, 7, 14, 6, 9, 3, 15, 19,
|
80
|
+
nil, nil, 2, nil, nil, nil, nil, nil, nil, nil,
|
81
|
+
nil, nil, nil, nil, nil, 8, nil, nil, 7, nil,
|
82
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
83
|
+
nil, nil, 14, 2, nil, nil, nil, 14, 14 ]
|
92
84
|
|
93
85
|
racc_goto_pointer = [
|
94
|
-
nil,
|
95
|
-
|
86
|
+
nil, 9, 2, 15, nil, nil, 9, -2, -3, 2,
|
87
|
+
0, nil, nil, -26, -4, 14, nil, nil, nil, -21 ]
|
96
88
|
|
97
89
|
racc_goto_default = [
|
98
|
-
nil, nil, nil, nil, nil,
|
99
|
-
|
90
|
+
nil, nil, nil, nil, 2, 6, nil, 9, nil, 12,
|
91
|
+
13, 15, 16, nil, nil, nil, 3, 7, 68, nil ]
|
100
92
|
|
101
93
|
racc_reduce_table = [
|
102
94
|
0, 0, :racc_error,
|
103
|
-
|
104
|
-
1,
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
1,
|
109
|
-
|
110
|
-
|
111
|
-
2,
|
112
|
-
3,
|
113
|
-
2,
|
114
|
-
1,
|
115
|
-
2,
|
116
|
-
2,
|
117
|
-
1,
|
118
|
-
3,
|
95
|
+
3, 31, :_reduce_1,
|
96
|
+
1, 31, :_reduce_2,
|
97
|
+
1, 33, :_reduce_3,
|
98
|
+
1, 33, :_reduce_4,
|
99
|
+
1, 33, :_reduce_5,
|
100
|
+
1, 33, :_reduce_6,
|
101
|
+
1, 33, :_reduce_7,
|
102
|
+
1, 33, :_reduce_8,
|
103
|
+
2, 34, :_reduce_9,
|
104
|
+
3, 34, :_reduce_10,
|
105
|
+
2, 34, :_reduce_11,
|
106
|
+
1, 34, :_reduce_none,
|
107
|
+
2, 34, :_reduce_13,
|
108
|
+
2, 34, :_reduce_14,
|
109
|
+
1, 34, :_reduce_15,
|
110
|
+
3, 32, :_reduce_16,
|
111
|
+
1, 32, :_reduce_none,
|
112
|
+
2, 41, :_reduce_18,
|
113
|
+
3, 35, :_reduce_19,
|
114
|
+
1, 35, :_reduce_20,
|
115
|
+
1, 35, :_reduce_21,
|
116
|
+
1, 42, :_reduce_22,
|
117
|
+
0, 42, :_reduce_none,
|
118
|
+
4, 40, :_reduce_24,
|
119
|
+
4, 40, :_reduce_25,
|
120
|
+
3, 40, :_reduce_26,
|
121
|
+
2, 39, :_reduce_27,
|
122
|
+
3, 39, :_reduce_28,
|
123
|
+
3, 39, :_reduce_29,
|
124
|
+
3, 39, :_reduce_30,
|
125
|
+
3, 44, :_reduce_31,
|
126
|
+
3, 44, :_reduce_32,
|
127
|
+
3, 44, :_reduce_33,
|
128
|
+
1, 44, :_reduce_none,
|
129
|
+
1, 44, :_reduce_none,
|
130
|
+
1, 44, :_reduce_36,
|
131
|
+
4, 45, :_reduce_37,
|
132
|
+
3, 45, :_reduce_38,
|
133
|
+
2, 45, :_reduce_39,
|
134
|
+
2, 46, :_reduce_40,
|
135
|
+
2, 46, :_reduce_41,
|
136
|
+
1, 36, :_reduce_none,
|
137
|
+
0, 36, :_reduce_none,
|
138
|
+
2, 37, :_reduce_44,
|
139
|
+
2, 37, :_reduce_45,
|
140
|
+
2, 37, :_reduce_46,
|
141
|
+
2, 37, :_reduce_47,
|
142
|
+
1, 37, :_reduce_none,
|
143
|
+
1, 37, :_reduce_none,
|
144
|
+
1, 37, :_reduce_none,
|
145
|
+
1, 37, :_reduce_none,
|
146
|
+
1, 47, :_reduce_52,
|
147
|
+
2, 43, :_reduce_53,
|
148
|
+
2, 43, :_reduce_54,
|
149
|
+
0, 43, :_reduce_none,
|
119
150
|
1, 48, :_reduce_none,
|
120
|
-
|
121
|
-
1,
|
122
|
-
1,
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
151
|
+
1, 48, :_reduce_none,
|
152
|
+
1, 48, :_reduce_none,
|
153
|
+
1, 48, :_reduce_none,
|
154
|
+
1, 48, :_reduce_none,
|
155
|
+
1, 48, :_reduce_none,
|
156
|
+
1, 48, :_reduce_none,
|
157
|
+
3, 38, :_reduce_63,
|
158
|
+
1, 49, :_reduce_none ]
|
159
|
+
|
160
|
+
racc_reduce_n = 65
|
161
|
+
|
162
|
+
racc_shift_n = 92
|
169
163
|
|
170
164
|
racc_token_table = {
|
171
165
|
false => 0,
|
@@ -181,40 +175,25 @@ racc_token_table = {
|
|
181
175
|
:STRING => 10,
|
182
176
|
:IDENT => 11,
|
183
177
|
:COMMA => 12,
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
196
|
-
:
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
:
|
201
|
-
|
202
|
-
|
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
|
178
|
+
:NUMBER => 13,
|
179
|
+
:PREFIXMATCH => 14,
|
180
|
+
:SUFFIXMATCH => 15,
|
181
|
+
:SUBSTRINGMATCH => 16,
|
182
|
+
:TILDE => 17,
|
183
|
+
:NOT_EQUAL => 18,
|
184
|
+
:SLASH => 19,
|
185
|
+
:DOUBLESLASH => 20,
|
186
|
+
:NOT => 21,
|
187
|
+
:EQUAL => 22,
|
188
|
+
:RPAREN => 23,
|
189
|
+
:LSQUARE => 24,
|
190
|
+
:RSQUARE => 25,
|
191
|
+
"." => 26,
|
192
|
+
"|" => 27,
|
193
|
+
"*" => 28,
|
194
|
+
":" => 29 }
|
195
|
+
|
196
|
+
racc_nt_base = 30
|
218
197
|
|
219
198
|
racc_use_result_var = true
|
220
199
|
|
@@ -248,23 +227,7 @@ Racc_token_to_s_table = [
|
|
248
227
|
"STRING",
|
249
228
|
"IDENT",
|
250
229
|
"COMMA",
|
251
|
-
"URI",
|
252
|
-
"CDO",
|
253
|
-
"CDC",
|
254
230
|
"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
231
|
"PREFIXMATCH",
|
269
232
|
"SUFFIXMATCH",
|
270
233
|
"SUBSTRINGMATCH",
|
@@ -273,16 +236,16 @@ Racc_token_to_s_table = [
|
|
273
236
|
"SLASH",
|
274
237
|
"DOUBLESLASH",
|
275
238
|
"NOT",
|
239
|
+
"EQUAL",
|
240
|
+
"RPAREN",
|
241
|
+
"LSQUARE",
|
242
|
+
"RSQUARE",
|
276
243
|
"\".\"",
|
244
|
+
"\"|\"",
|
277
245
|
"\"*\"",
|
278
|
-
"\"[\"",
|
279
|
-
"\"]\"",
|
280
|
-
"\")\"",
|
281
246
|
"\":\"",
|
282
|
-
"\"=\"",
|
283
247
|
"$start",
|
284
248
|
"selector",
|
285
|
-
"s_0toN",
|
286
249
|
"simple_selector_1toN",
|
287
250
|
"combinator",
|
288
251
|
"simple_selector",
|
@@ -293,6 +256,7 @@ Racc_token_to_s_table = [
|
|
293
256
|
"function",
|
294
257
|
"attrib",
|
295
258
|
"class",
|
259
|
+
"namespace",
|
296
260
|
"attrib_val_0or1",
|
297
261
|
"expr",
|
298
262
|
"an_plus_b",
|
@@ -307,7 +271,7 @@ Racc_debug_parser = false
|
|
307
271
|
|
308
272
|
# reduce 0 omitted
|
309
273
|
|
310
|
-
module_eval(<<'.,.,', 'parser.y',
|
274
|
+
module_eval(<<'.,.,', 'parser.y', 9)
|
311
275
|
def _reduce_1(val, _values, result)
|
312
276
|
result = [val.first, val.last].flatten
|
313
277
|
|
@@ -315,56 +279,56 @@ module_eval(<<'.,.,', 'parser.y', 11)
|
|
315
279
|
end
|
316
280
|
.,.,
|
317
281
|
|
318
|
-
module_eval(<<'.,.,', 'parser.y',
|
282
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
319
283
|
def _reduce_2(val, _values, result)
|
320
284
|
result = val.flatten
|
321
285
|
result
|
322
286
|
end
|
323
287
|
.,.,
|
324
288
|
|
325
|
-
module_eval(<<'.,.,', 'parser.y',
|
289
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
326
290
|
def _reduce_3(val, _values, result)
|
327
291
|
result = :DIRECT_ADJACENT_SELECTOR
|
328
292
|
result
|
329
293
|
end
|
330
294
|
.,.,
|
331
295
|
|
332
|
-
module_eval(<<'.,.,', 'parser.y',
|
296
|
+
module_eval(<<'.,.,', 'parser.y', 15)
|
333
297
|
def _reduce_4(val, _values, result)
|
334
298
|
result = :CHILD_SELECTOR
|
335
299
|
result
|
336
300
|
end
|
337
301
|
.,.,
|
338
302
|
|
339
|
-
module_eval(<<'.,.,', 'parser.y',
|
303
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
340
304
|
def _reduce_5(val, _values, result)
|
341
305
|
result = :PRECEDING_SELECTOR
|
342
306
|
result
|
343
307
|
end
|
344
308
|
.,.,
|
345
309
|
|
346
|
-
module_eval(<<'.,.,', 'parser.y',
|
310
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
347
311
|
def _reduce_6(val, _values, result)
|
348
312
|
result = :DESCENDANT_SELECTOR
|
349
313
|
result
|
350
314
|
end
|
351
315
|
.,.,
|
352
316
|
|
353
|
-
module_eval(<<'.,.,', 'parser.y',
|
317
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
354
318
|
def _reduce_7(val, _values, result)
|
355
319
|
result = :DESCENDANT_SELECTOR
|
356
320
|
result
|
357
321
|
end
|
358
322
|
.,.,
|
359
323
|
|
360
|
-
module_eval(<<'.,.,', 'parser.y',
|
324
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
361
325
|
def _reduce_8(val, _values, result)
|
362
326
|
result = :CHILD_SELECTOR
|
363
327
|
result
|
364
328
|
end
|
365
329
|
.,.,
|
366
330
|
|
367
|
-
module_eval(<<'.,.,', 'parser.y',
|
331
|
+
module_eval(<<'.,.,', 'parser.y', 23)
|
368
332
|
def _reduce_9(val, _values, result)
|
369
333
|
result = if val[1].nil?
|
370
334
|
val.first
|
@@ -376,7 +340,7 @@ module_eval(<<'.,.,', 'parser.y', 25)
|
|
376
340
|
end
|
377
341
|
.,.,
|
378
342
|
|
379
|
-
module_eval(<<'.,.,', 'parser.y',
|
343
|
+
module_eval(<<'.,.,', 'parser.y', 30)
|
380
344
|
def _reduce_10(val, _values, result)
|
381
345
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
382
346
|
[
|
@@ -389,7 +353,7 @@ module_eval(<<'.,.,', 'parser.y', 32)
|
|
389
353
|
end
|
390
354
|
.,.,
|
391
355
|
|
392
|
-
module_eval(<<'.,.,', 'parser.y',
|
356
|
+
module_eval(<<'.,.,', 'parser.y', 38)
|
393
357
|
def _reduce_11(val, _values, result)
|
394
358
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
395
359
|
|
@@ -399,7 +363,7 @@ module_eval(<<'.,.,', 'parser.y', 40)
|
|
399
363
|
|
400
364
|
# reduce 12 omitted
|
401
365
|
|
402
|
-
module_eval(<<'.,.,', 'parser.y',
|
366
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
403
367
|
def _reduce_13(val, _values, result)
|
404
368
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
405
369
|
|
@@ -407,7 +371,7 @@ module_eval(<<'.,.,', 'parser.y', 44)
|
|
407
371
|
end
|
408
372
|
.,.,
|
409
373
|
|
410
|
-
module_eval(<<'.,.,', 'parser.y',
|
374
|
+
module_eval(<<'.,.,', 'parser.y', 45)
|
411
375
|
def _reduce_14(val, _values, result)
|
412
376
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
413
377
|
[
|
@@ -420,7 +384,7 @@ module_eval(<<'.,.,', 'parser.y', 47)
|
|
420
384
|
end
|
421
385
|
.,.,
|
422
386
|
|
423
|
-
module_eval(<<'.,.,', 'parser.y',
|
387
|
+
module_eval(<<'.,.,', 'parser.y', 53)
|
424
388
|
def _reduce_15(val, _values, result)
|
425
389
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
426
390
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
@@ -430,7 +394,7 @@ module_eval(<<'.,.,', 'parser.y', 55)
|
|
430
394
|
end
|
431
395
|
.,.,
|
432
396
|
|
433
|
-
module_eval(<<'.,.,', 'parser.y',
|
397
|
+
module_eval(<<'.,.,', 'parser.y', 60)
|
434
398
|
def _reduce_16(val, _values, result)
|
435
399
|
result = Node.new(val[1], [val.first, val.last])
|
436
400
|
|
@@ -440,110 +404,158 @@ module_eval(<<'.,.,', 'parser.y', 62)
|
|
440
404
|
|
441
405
|
# reduce 17 omitted
|
442
406
|
|
443
|
-
module_eval(<<'.,.,', 'parser.y',
|
407
|
+
module_eval(<<'.,.,', 'parser.y', 65)
|
444
408
|
def _reduce_18(val, _values, result)
|
445
409
|
result = Node.new(:CLASS_CONDITION, [val[1]])
|
446
410
|
result
|
447
411
|
end
|
448
412
|
.,.,
|
449
413
|
|
450
|
-
module_eval(<<'.,.,', 'parser.y',
|
414
|
+
module_eval(<<'.,.,', 'parser.y', 69)
|
451
415
|
def _reduce_19(val, _values, result)
|
452
|
-
|
416
|
+
result = Node.new(:ELEMENT_NAME,
|
417
|
+
[[val.first, val.last].compact.join(':')]
|
418
|
+
)
|
419
|
+
|
453
420
|
result
|
454
421
|
end
|
455
422
|
.,.,
|
456
423
|
|
457
|
-
module_eval(<<'.,.,', 'parser.y',
|
424
|
+
module_eval(<<'.,.,', 'parser.y', 74)
|
458
425
|
def _reduce_20(val, _values, result)
|
459
|
-
|
426
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
427
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
428
|
+
|
460
429
|
result
|
461
430
|
end
|
462
431
|
.,.,
|
463
432
|
|
464
|
-
module_eval(<<'.,.,', 'parser.y',
|
433
|
+
module_eval(<<'.,.,', 'parser.y', 77)
|
465
434
|
def _reduce_21(val, _values, result)
|
435
|
+
result = Node.new(:ELEMENT_NAME, val)
|
436
|
+
result
|
437
|
+
end
|
438
|
+
.,.,
|
439
|
+
|
440
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
441
|
+
def _reduce_22(val, _values, result)
|
442
|
+
result = val[0]
|
443
|
+
result
|
444
|
+
end
|
445
|
+
.,.,
|
446
|
+
|
447
|
+
# reduce 23 omitted
|
448
|
+
|
449
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
450
|
+
def _reduce_24(val, _values, result)
|
466
451
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
467
|
-
[Node.new(:ELEMENT_NAME, [val[
|
452
|
+
[Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
|
468
453
|
)
|
469
454
|
|
470
455
|
result
|
471
456
|
end
|
472
457
|
.,.,
|
473
458
|
|
474
|
-
module_eval(<<'.,.,', 'parser.y',
|
475
|
-
def
|
459
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
460
|
+
def _reduce_25(val, _values, result)
|
476
461
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
477
|
-
[val[
|
462
|
+
[val[1]] + (val[2] || [])
|
478
463
|
)
|
479
464
|
|
480
465
|
result
|
481
466
|
end
|
482
467
|
.,.,
|
483
468
|
|
484
|
-
module_eval(<<'.,.,', 'parser.y',
|
485
|
-
def
|
469
|
+
module_eval(<<'.,.,', 'parser.y', 95)
|
470
|
+
def _reduce_26(val, _values, result)
|
486
471
|
# Non standard, but hpricot supports it.
|
487
472
|
result = Node.new(:PSEUDO_CLASS,
|
488
|
-
[Node.new(:FUNCTION, ['nth-child(', val[
|
473
|
+
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
489
474
|
)
|
490
475
|
|
491
476
|
result
|
492
477
|
end
|
493
478
|
.,.,
|
494
479
|
|
495
|
-
module_eval(<<'.,.,', 'parser.y',
|
496
|
-
def
|
480
|
+
module_eval(<<'.,.,', 'parser.y', 103)
|
481
|
+
def _reduce_27(val, _values, result)
|
497
482
|
result = Node.new(:FUNCTION, [val.first.strip])
|
498
483
|
|
499
484
|
result
|
500
485
|
end
|
501
486
|
.,.,
|
502
487
|
|
503
|
-
module_eval(<<'.,.,', 'parser.y',
|
504
|
-
def
|
488
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
489
|
+
def _reduce_28(val, _values, result)
|
505
490
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
506
491
|
|
507
492
|
result
|
508
493
|
end
|
509
494
|
.,.,
|
510
495
|
|
511
|
-
module_eval(<<'.,.,', 'parser.y',
|
512
|
-
def
|
496
|
+
module_eval(<<'.,.,', 'parser.y', 109)
|
497
|
+
def _reduce_29(val, _values, result)
|
513
498
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
514
499
|
|
515
500
|
result
|
516
501
|
end
|
517
502
|
.,.,
|
518
503
|
|
519
|
-
module_eval(<<'.,.,', 'parser.y',
|
520
|
-
def
|
504
|
+
module_eval(<<'.,.,', 'parser.y', 112)
|
505
|
+
def _reduce_30(val, _values, result)
|
521
506
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
522
507
|
|
523
508
|
result
|
524
509
|
end
|
525
510
|
.,.,
|
526
511
|
|
527
|
-
module_eval(<<'.,.,', 'parser.y',
|
528
|
-
def
|
512
|
+
module_eval(<<'.,.,', 'parser.y', 116)
|
513
|
+
def _reduce_31(val, _values, result)
|
529
514
|
result = [val.first, val.last]
|
530
515
|
result
|
531
516
|
end
|
532
517
|
.,.,
|
533
518
|
|
534
|
-
module_eval(<<'.,.,', 'parser.y',
|
535
|
-
def
|
519
|
+
module_eval(<<'.,.,', 'parser.y', 117)
|
520
|
+
def _reduce_32(val, _values, result)
|
521
|
+
result = [val.first, val.last]
|
522
|
+
result
|
523
|
+
end
|
524
|
+
.,.,
|
525
|
+
|
526
|
+
module_eval(<<'.,.,', 'parser.y', 118)
|
527
|
+
def _reduce_33(val, _values, result)
|
536
528
|
result = [val.first, val.last]
|
537
529
|
result
|
538
530
|
end
|
539
531
|
.,.,
|
540
532
|
|
541
|
-
# reduce
|
533
|
+
# reduce 34 omitted
|
542
534
|
|
543
|
-
# reduce
|
535
|
+
# reduce 35 omitted
|
544
536
|
|
545
|
-
module_eval(<<'.,.,', 'parser.y',
|
546
|
-
def
|
537
|
+
module_eval(<<'.,.,', 'parser.y', 123)
|
538
|
+
def _reduce_36(val, _values, result)
|
539
|
+
if val[0] == 'even'
|
540
|
+
val = ["2","n","+","0"]
|
541
|
+
result = Node.new(:AN_PLUS_B, val)
|
542
|
+
elsif val[0] == 'odd'
|
543
|
+
val = ["2","n","+","1"]
|
544
|
+
result = Node.new(:AN_PLUS_B, val)
|
545
|
+
else
|
546
|
+
# This is not CSS standard. It allows us to support this:
|
547
|
+
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
548
|
+
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
549
|
+
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
550
|
+
result = val
|
551
|
+
end
|
552
|
+
|
553
|
+
result
|
554
|
+
end
|
555
|
+
.,.,
|
556
|
+
|
557
|
+
module_eval(<<'.,.,', 'parser.y', 141)
|
558
|
+
def _reduce_37(val, _values, result)
|
547
559
|
if val[1] == 'n'
|
548
560
|
result = Node.new(:AN_PLUS_B, val)
|
549
561
|
else
|
@@ -554,8 +566,8 @@ module_eval(<<'.,.,', 'parser.y', 114)
|
|
554
566
|
end
|
555
567
|
.,.,
|
556
568
|
|
557
|
-
module_eval(<<'.,.,', 'parser.y',
|
558
|
-
def
|
569
|
+
module_eval(<<'.,.,', 'parser.y', 147)
|
570
|
+
def _reduce_38(val, _values, result)
|
559
571
|
# n+3, -n+3
|
560
572
|
if val[0] == 'n'
|
561
573
|
val.unshift("1")
|
@@ -572,8 +584,8 @@ module_eval(<<'.,.,', 'parser.y', 120)
|
|
572
584
|
end
|
573
585
|
.,.,
|
574
586
|
|
575
|
-
module_eval(<<'.,.,', 'parser.y',
|
576
|
-
def
|
587
|
+
module_eval(<<'.,.,', 'parser.y', 161)
|
588
|
+
def _reduce_39(val, _values, result)
|
577
589
|
if val[1] == 'n'
|
578
590
|
val << "+"
|
579
591
|
val << "0"
|
@@ -586,110 +598,86 @@ module_eval(<<'.,.,', 'parser.y', 134)
|
|
586
598
|
end
|
587
599
|
.,.,
|
588
600
|
|
589
|
-
module_eval(<<'.,.,', 'parser.y',
|
590
|
-
def
|
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)
|
601
|
+
module_eval(<<'.,.,', 'parser.y', 172)
|
602
|
+
def _reduce_40(val, _values, result)
|
607
603
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
608
604
|
|
609
605
|
result
|
610
606
|
end
|
611
607
|
.,.,
|
612
608
|
|
613
|
-
module_eval(<<'.,.,', 'parser.y',
|
614
|
-
def
|
609
|
+
module_eval(<<'.,.,', 'parser.y', 174)
|
610
|
+
def _reduce_41(val, _values, result)
|
615
611
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
616
612
|
result
|
617
613
|
end
|
618
614
|
.,.,
|
619
615
|
|
620
|
-
# reduce
|
616
|
+
# reduce 42 omitted
|
621
617
|
|
622
|
-
# reduce
|
618
|
+
# reduce 43 omitted
|
623
619
|
|
624
|
-
module_eval(<<'.,.,', 'parser.y',
|
625
|
-
def
|
620
|
+
module_eval(<<'.,.,', 'parser.y', 182)
|
621
|
+
def _reduce_44(val, _values, result)
|
626
622
|
result = Node.new(:COMBINATOR, val)
|
627
623
|
|
628
624
|
result
|
629
625
|
end
|
630
626
|
.,.,
|
631
627
|
|
632
|
-
module_eval(<<'.,.,', 'parser.y',
|
633
|
-
def
|
628
|
+
module_eval(<<'.,.,', 'parser.y', 185)
|
629
|
+
def _reduce_45(val, _values, result)
|
634
630
|
result = Node.new(:COMBINATOR, val)
|
635
631
|
|
636
632
|
result
|
637
633
|
end
|
638
634
|
.,.,
|
639
635
|
|
640
|
-
module_eval(<<'.,.,', 'parser.y',
|
641
|
-
def
|
636
|
+
module_eval(<<'.,.,', 'parser.y', 188)
|
637
|
+
def _reduce_46(val, _values, result)
|
642
638
|
result = Node.new(:COMBINATOR, val)
|
643
639
|
|
644
640
|
result
|
645
641
|
end
|
646
642
|
.,.,
|
647
643
|
|
648
|
-
module_eval(<<'.,.,', 'parser.y',
|
649
|
-
def
|
644
|
+
module_eval(<<'.,.,', 'parser.y', 191)
|
645
|
+
def _reduce_47(val, _values, result)
|
650
646
|
result = Node.new(:COMBINATOR, val)
|
651
647
|
|
652
648
|
result
|
653
649
|
end
|
654
650
|
.,.,
|
655
651
|
|
656
|
-
# reduce
|
652
|
+
# reduce 48 omitted
|
657
653
|
|
658
|
-
# reduce
|
654
|
+
# reduce 49 omitted
|
659
655
|
|
660
|
-
# reduce
|
656
|
+
# reduce 50 omitted
|
661
657
|
|
662
|
-
# reduce
|
658
|
+
# reduce 51 omitted
|
663
659
|
|
664
|
-
module_eval(<<'.,.,', 'parser.y',
|
665
|
-
def
|
660
|
+
module_eval(<<'.,.,', 'parser.y', 199)
|
661
|
+
def _reduce_52(val, _values, result)
|
666
662
|
result = Node.new(:ID, val)
|
667
663
|
result
|
668
664
|
end
|
669
665
|
.,.,
|
670
666
|
|
671
|
-
module_eval(<<'.,.,', 'parser.y',
|
672
|
-
def
|
673
|
-
result = [val.first, val[
|
667
|
+
module_eval(<<'.,.,', 'parser.y', 202)
|
668
|
+
def _reduce_53(val, _values, result)
|
669
|
+
result = [val.first, val[1]]
|
674
670
|
result
|
675
671
|
end
|
676
672
|
.,.,
|
677
673
|
|
678
|
-
module_eval(<<'.,.,', 'parser.y',
|
679
|
-
def
|
680
|
-
result = [val.first, val[
|
674
|
+
module_eval(<<'.,.,', 'parser.y', 203)
|
675
|
+
def _reduce_54(val, _values, result)
|
676
|
+
result = [val.first, val[1]]
|
681
677
|
result
|
682
678
|
end
|
683
679
|
.,.,
|
684
680
|
|
685
|
-
# reduce 51 omitted
|
686
|
-
|
687
|
-
# reduce 52 omitted
|
688
|
-
|
689
|
-
# reduce 53 omitted
|
690
|
-
|
691
|
-
# reduce 54 omitted
|
692
|
-
|
693
681
|
# reduce 55 omitted
|
694
682
|
|
695
683
|
# reduce 56 omitted
|
@@ -698,13 +686,7 @@ module_eval(<<'.,.,', 'parser.y', 188)
|
|
698
686
|
|
699
687
|
# reduce 58 omitted
|
700
688
|
|
701
|
-
|
702
|
-
def _reduce_59(val, _values, result)
|
703
|
-
result = Node.new(:NOT, [val[2]])
|
704
|
-
|
705
|
-
result
|
706
|
-
end
|
707
|
-
.,.,
|
689
|
+
# reduce 59 omitted
|
708
690
|
|
709
691
|
# reduce 60 omitted
|
710
692
|
|
@@ -712,6 +694,16 @@ module_eval(<<'.,.,', 'parser.y', 202)
|
|
712
694
|
|
713
695
|
# reduce 62 omitted
|
714
696
|
|
697
|
+
module_eval(<<'.,.,', 'parser.y', 217)
|
698
|
+
def _reduce_63(val, _values, result)
|
699
|
+
result = Node.new(:NOT, [val[1]])
|
700
|
+
|
701
|
+
result
|
702
|
+
end
|
703
|
+
.,.,
|
704
|
+
|
705
|
+
# reduce 64 omitted
|
706
|
+
|
715
707
|
def _reduce_none(val, _values, result)
|
716
708
|
val[0]
|
717
709
|
end
|