nokogiri 1.5.3.rc3-java → 1.5.3.rc4-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/CHANGELOG.ja.rdoc +9 -0
- data/CHANGELOG.rdoc +11 -2
- data/Manifest.txt +0 -1
- data/ROADMAP.md +11 -0
- data/STANDARD_RESPONSES.md +2 -2
- data/ext/java/nokogiri/XmlAttr.java +11 -1
- data/ext/java/nokogiri/XmlNamespace.java +25 -0
- data/ext/java/nokogiri/XmlNode.java +5 -1
- data/ext/java/nokogiri/XmlReader.java +19 -4
- data/ext/java/nokogiri/XmlSaxPushParser.java +88 -57
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +1 -0
- data/ext/nokogiri/xml_io.c +1 -1
- data/ext/nokogiri/xml_namespace.c +0 -6
- data/lib/nokogiri/css/node.rb +3 -0
- data/lib/nokogiri/css/parser.rb +229 -209
- data/lib/nokogiri/css/parser.y +7 -1
- data/lib/nokogiri/css/xpath_visitor.rb +2 -2
- data/lib/nokogiri/html/document.rb +2 -1
- data/lib/nokogiri/html/element_description_defaults.rb +1 -1
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +1 -1
- data/lib/nokogiri/xml/parse_options.rb +2 -2
- data/test/css/test_parser.rb +27 -0
- data/test/html/test_document.rb +18 -2
- data/test/test_reader.rb +63 -0
- data/test/xml/sax/test_push_parser.rb +1 -0
- data/test/xml/test_node.rb +21 -0
- metadata +2 -3
- data/ext/java/nokogiri/internals/PushInputStream.java +0 -411
@@ -255,6 +255,7 @@ public class NokogiriHelpers {
|
|
255
255
|
* this for us.
|
256
256
|
*/
|
257
257
|
public static String rubyStringToString(IRubyObject str) {
|
258
|
+
if (str.isNil()) return null;
|
258
259
|
//return rubyStringToString(str.convertToString());
|
259
260
|
return toJavaString(str.convertToString());
|
260
261
|
}
|
data/ext/nokogiri/xml_io.c
CHANGED
@@ -25,7 +25,7 @@ int io_read_callback(void * ctx, char * buffer, int len) {
|
|
25
25
|
safe_len = str_len > (size_t)len ? (size_t)len : str_len;
|
26
26
|
memcpy(buffer, StringValuePtr(string), safe_len);
|
27
27
|
|
28
|
-
return safe_len;
|
28
|
+
return (int)safe_len;
|
29
29
|
}
|
30
30
|
|
31
31
|
VALUE write_check(VALUE *args) {
|
@@ -11,13 +11,10 @@ VALUE cNokogiriXmlNamespace ;
|
|
11
11
|
static VALUE prefix(VALUE self)
|
12
12
|
{
|
13
13
|
xmlNsPtr ns;
|
14
|
-
xmlDocPtr doc;
|
15
14
|
|
16
15
|
Data_Get_Struct(self, xmlNs, ns);
|
17
16
|
if(!ns->prefix) return Qnil;
|
18
17
|
|
19
|
-
Data_Get_Struct(rb_iv_get(self, "@document"), xmlDoc, doc);
|
20
|
-
|
21
18
|
return NOKOGIRI_STR_NEW2(ns->prefix);
|
22
19
|
}
|
23
20
|
|
@@ -30,13 +27,10 @@ static VALUE prefix(VALUE self)
|
|
30
27
|
static VALUE href(VALUE self)
|
31
28
|
{
|
32
29
|
xmlNsPtr ns;
|
33
|
-
xmlDocPtr doc;
|
34
30
|
|
35
31
|
Data_Get_Struct(self, xmlNs, ns);
|
36
32
|
if(!ns->href) return Qnil;
|
37
33
|
|
38
|
-
Data_Get_Struct(rb_iv_get(self, "@document"), xmlDoc, doc);
|
39
|
-
|
40
34
|
return NOKOGIRI_STR_NEW2(ns->href);
|
41
35
|
}
|
42
36
|
|
data/lib/nokogiri/css/node.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Nokogiri
|
2
2
|
module CSS
|
3
3
|
class Node
|
4
|
+
ALLOW_COMBINATOR_ON_SELF = [:DIRECT_ADJACENT_SELECTOR, :FOLLOWING_SELECTOR, :CHILD_SELECTOR]
|
5
|
+
|
4
6
|
# Get the type of this node
|
5
7
|
attr_accessor :type
|
6
8
|
# Get the value of this node
|
@@ -21,6 +23,7 @@ module Nokogiri
|
|
21
23
|
# Convert this CSS node to xpath with +prefix+ using +visitor+
|
22
24
|
def to_xpath prefix = '//', visitor = XPathVisitor.new
|
23
25
|
self.preprocess!
|
26
|
+
prefix = '.' if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil?
|
24
27
|
prefix + visitor.accept(self)
|
25
28
|
end
|
26
29
|
|
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -14,172 +14,180 @@ module Nokogiri
|
|
14
14
|
##### State transition tables begin ###
|
15
15
|
|
16
16
|
racc_action_table = [
|
17
|
-
|
18
|
-
6,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
6, 62, 7, 63, 14, 19, 23, 26, 20, 2,
|
18
|
+
71, 14, 6, 63, 85, 17, 14, 22, 25, 28,
|
19
|
+
83, 2, 7, 72, 11, 13, 15, -26, 20, 7,
|
20
|
+
49, 28, 13, 70, 7, 20, 11, 13, 15, 6,
|
21
|
+
20, 64, 65, 14, 19, 23, 26, 64, 2, 36,
|
22
|
+
59, 6, 60, 67, 17, 14, 22, 25, 28, 90,
|
23
|
+
2, 7, 6, 11, 13, 15, 14, 20, 66, 67,
|
24
|
+
28, 2, 91, 7, 14, 11, 13, 15, 14, 20,
|
25
|
+
69, 28, 6, 2, 7, 68, 11, 13, 15, 14,
|
26
|
+
20, 37, 7, 39, 94, 13, 7, 14, 20, 13,
|
27
|
+
15, 28, 20, 6, 49, 14, 11, 7, 36, 59,
|
28
|
+
13, 60, 53, 20, 14, 7, 36, 59, 13, 60,
|
29
|
+
95, 20, 28, 7, 101, 100, 13, 11, 49, 20,
|
30
|
+
74, 76, 7, 36, 31, 13, 33, 50, 20, 74,
|
31
|
+
76, 75, 77, 79, 98, 80, 32, 99, 42, 73,
|
32
|
+
75, 77, 79, 102, 80, 19, 23, 26, 73, 36,
|
33
|
+
59, -26, 60, 104, 105, 17, nil, 22, 25 ]
|
32
34
|
|
33
35
|
racc_action_check = [
|
34
|
-
0, 21,
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
44,
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
0, 29, 21, 45, 0, 0, 0, 0, 21, 0,
|
37
|
+
38, 24, 63, 29, 45, 0, 63, 0, 0, 0,
|
38
|
+
42, 63, 0, 39, 0, 0, 0, 37, 0, 24,
|
39
|
+
47, 63, 24, 36, 63, 24, 63, 63, 63, 11,
|
40
|
+
63, 59, 31, 11, 11, 11, 11, 31, 11, 70,
|
41
|
+
70, 9, 70, 60, 11, 9, 11, 11, 11, 61,
|
42
|
+
9, 11, 44, 11, 11, 11, 44, 11, 33, 33,
|
43
|
+
9, 44, 62, 9, 87, 9, 9, 9, 49, 9,
|
44
|
+
35, 44, 7, 49, 44, 34, 44, 44, 44, 12,
|
45
|
+
44, 7, 87, 7, 65, 87, 49, 27, 87, 49,
|
46
|
+
49, 7, 49, 20, 12, 18, 7, 12, 64, 64,
|
47
|
+
12, 64, 20, 12, 1, 27, 28, 28, 27, 28,
|
48
|
+
66, 27, 20, 18, 81, 81, 18, 20, 16, 18,
|
49
|
+
41, 41, 1, 6, 6, 1, 6, 13, 1, 40,
|
50
|
+
40, 41, 41, 41, 71, 41, 6, 78, 8, 41,
|
51
|
+
40, 40, 40, 82, 40, 10, 10, 10, 40, 67,
|
52
|
+
67, 2, 67, 89, 95, 10, nil, 10, 10 ]
|
49
53
|
|
50
54
|
racc_action_pointer = [
|
51
|
-
-2,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
nil, nil, nil, nil, nil, nil,
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
nil, nil,
|
61
|
-
nil, nil, nil ]
|
55
|
+
-2, 108, 132, nil, nil, nil, 123, 80, 119, 49,
|
56
|
+
148, 37, 83, 126, nil, nil, 107, nil, 99, nil,
|
57
|
+
101, -22, nil, nil, 5, nil, nil, 91, 106, 1,
|
58
|
+
nil, 35, nil, 57, 62, 57, 21, -2, -19, -2,
|
59
|
+
136, 127, 9, nil, 60, -9, nil, 9, nil, 72,
|
60
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 29,
|
61
|
+
41, 36, 72, 10, 98, 81, 113, 149, nil, nil,
|
62
|
+
39, 133, nil, nil, nil, nil, nil, nil, 122, nil,
|
63
|
+
nil, 114, 128, nil, nil, nil, nil, 68, nil, 140,
|
64
|
+
nil, nil, nil, nil, nil, 151, nil, nil, nil, nil,
|
65
|
+
nil, nil, nil, nil, nil, nil ]
|
62
66
|
|
63
67
|
racc_action_default = [
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
68
|
+
-27, -56, -25, -3, -22, -2, -74, -27, -74, -27,
|
69
|
+
-20, -27, -50, -74, -59, -23, -17, -6, -55, -4,
|
70
|
+
-74, -13, -9, -5, -58, -8, -7, -57, -74, -74,
|
71
|
+
-52, -43, -33, -41, -74, -74, -42, -32, -74, -74,
|
72
|
+
-62, -62, -74, -18, -27, -74, -10, -49, -12, -27,
|
73
|
+
-21, -16, -51, -48, -47, -14, -15, -54, -53, -43,
|
74
|
+
-41, -74, -74, -27, -74, -74, -46, -74, -34, -35,
|
75
|
+
-74, -74, -30, -63, -68, -64, -69, -65, -74, -66,
|
76
|
+
-67, -74, -74, -24, -19, -37, -11, -71, -73, -74,
|
77
|
+
-36, 106, -1, -40, -45, -74, -38, -39, -31, -28,
|
78
|
+
-60, -61, -29, -72, -70, -44 ]
|
75
79
|
|
76
80
|
racc_goto_table = [
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
nil, nil, nil, nil, nil, nil, 84,
|
81
|
+
30, 43, 34, 48, 29, 41, 55, 51, 78, 82,
|
82
|
+
46, 47, 56, 38, 40, 45, 87, 52, 54, 44,
|
83
|
+
35, 89, nil, 57, 61, nil, 58, nil, nil, nil,
|
84
|
+
nil, nil, nil, nil, nil, nil, 84, nil, 86, nil,
|
85
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 88, nil,
|
86
|
+
nil, nil, nil, nil, nil, 92, nil, nil, nil, nil,
|
87
|
+
93, nil, nil, 96, nil, nil, 97, nil, nil, nil,
|
81
88
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
82
|
-
nil, nil, nil, nil, nil, nil,
|
83
|
-
nil, 93, nil, nil, 94, nil, nil, nil, nil, nil,
|
84
|
-
nil, nil, nil, nil, nil, 100 ]
|
89
|
+
nil, nil, nil, nil, nil, nil, 103 ]
|
85
90
|
|
86
91
|
racc_goto_check = [
|
87
|
-
|
88
|
-
7,
|
89
|
-
|
90
|
-
nil, nil, nil, nil, nil, nil,
|
92
|
+
8, 2, 18, 9, 1, 10, 11, 9, 17, 17,
|
93
|
+
7, 8, 12, 15, 16, 1, 6, 8, 10, 4,
|
94
|
+
19, 22, nil, 8, 18, nil, 8, nil, nil, nil,
|
95
|
+
nil, nil, nil, nil, nil, nil, 2, nil, 9, nil,
|
96
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 8, nil,
|
97
|
+
nil, nil, nil, nil, nil, 2, nil, nil, nil, nil,
|
98
|
+
18, nil, nil, 18, nil, nil, 18, nil, nil, nil,
|
91
99
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
92
|
-
nil, nil, nil, nil, nil, nil,
|
93
|
-
nil, 17, nil, nil, 17, nil, nil, nil, nil, nil,
|
94
|
-
nil, nil, nil, nil, nil, 7 ]
|
100
|
+
nil, nil, nil, nil, nil, nil, 8 ]
|
95
101
|
|
96
102
|
racc_goto_pointer = [
|
97
|
-
nil,
|
98
|
-
-
|
99
|
-
nil, -
|
103
|
+
nil, 4, -8, nil, 9, nil, -33, -2, -1, -9,
|
104
|
+
-2, -15, -9, nil, nil, 6, 7, -32, -4, 14,
|
105
|
+
nil, nil, -28 ]
|
100
106
|
|
101
107
|
racc_goto_default = [
|
102
|
-
nil, nil, 3,
|
103
|
-
|
104
|
-
|
108
|
+
nil, nil, 3, 5, 9, 10, 12, nil, 16, nil,
|
109
|
+
21, 24, 27, 1, 4, 8, nil, nil, nil, nil,
|
110
|
+
18, 81, nil ]
|
105
111
|
|
106
112
|
racc_reduce_table = [
|
107
113
|
0, 0, :racc_error,
|
108
114
|
3, 32, :_reduce_1,
|
109
115
|
1, 32, :_reduce_2,
|
110
|
-
1,
|
111
|
-
1,
|
112
|
-
1,
|
113
|
-
1,
|
114
|
-
1,
|
115
|
-
1,
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
2, 35, :_reduce_13,
|
121
|
-
2, 35, :_reduce_14,
|
122
|
-
2, 35, :_reduce_15,
|
123
|
-
1, 35, :_reduce_16,
|
124
|
-
3, 33, :_reduce_17,
|
125
|
-
1, 33, :_reduce_none,
|
126
|
-
2, 43, :_reduce_19,
|
116
|
+
1, 32, :_reduce_3,
|
117
|
+
1, 35, :_reduce_4,
|
118
|
+
1, 35, :_reduce_5,
|
119
|
+
1, 35, :_reduce_6,
|
120
|
+
1, 35, :_reduce_7,
|
121
|
+
1, 35, :_reduce_8,
|
122
|
+
1, 35, :_reduce_9,
|
123
|
+
2, 36, :_reduce_10,
|
124
|
+
3, 36, :_reduce_11,
|
125
|
+
2, 36, :_reduce_12,
|
127
126
|
1, 36, :_reduce_none,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
1,
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
3, 46, :_reduce_29,
|
137
|
-
1, 46, :_reduce_30,
|
138
|
-
2, 40, :_reduce_31,
|
139
|
-
3, 40, :_reduce_32,
|
140
|
-
3, 40, :_reduce_33,
|
141
|
-
3, 40, :_reduce_34,
|
142
|
-
3, 40, :_reduce_35,
|
143
|
-
3, 48, :_reduce_36,
|
144
|
-
3, 48, :_reduce_37,
|
145
|
-
3, 48, :_reduce_38,
|
146
|
-
1, 48, :_reduce_none,
|
147
|
-
1, 48, :_reduce_none,
|
148
|
-
1, 48, :_reduce_41,
|
149
|
-
4, 49, :_reduce_42,
|
150
|
-
3, 49, :_reduce_43,
|
151
|
-
2, 49, :_reduce_44,
|
152
|
-
2, 41, :_reduce_45,
|
153
|
-
2, 41, :_reduce_46,
|
127
|
+
2, 36, :_reduce_14,
|
128
|
+
2, 36, :_reduce_15,
|
129
|
+
2, 36, :_reduce_16,
|
130
|
+
1, 36, :_reduce_17,
|
131
|
+
2, 34, :_reduce_18,
|
132
|
+
3, 33, :_reduce_19,
|
133
|
+
1, 33, :_reduce_none,
|
134
|
+
2, 44, :_reduce_21,
|
154
135
|
1, 37, :_reduce_none,
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
136
|
+
1, 37, :_reduce_23,
|
137
|
+
3, 45, :_reduce_24,
|
138
|
+
1, 45, :_reduce_25,
|
139
|
+
1, 46, :_reduce_26,
|
140
|
+
0, 46, :_reduce_none,
|
141
|
+
4, 43, :_reduce_28,
|
142
|
+
4, 43, :_reduce_29,
|
143
|
+
3, 43, :_reduce_30,
|
144
|
+
3, 47, :_reduce_31,
|
145
|
+
1, 47, :_reduce_32,
|
146
|
+
2, 41, :_reduce_33,
|
147
|
+
3, 41, :_reduce_34,
|
148
|
+
3, 41, :_reduce_35,
|
149
|
+
3, 41, :_reduce_36,
|
150
|
+
3, 41, :_reduce_37,
|
151
|
+
3, 49, :_reduce_38,
|
152
|
+
3, 49, :_reduce_39,
|
153
|
+
3, 49, :_reduce_40,
|
154
|
+
1, 49, :_reduce_none,
|
155
|
+
1, 49, :_reduce_none,
|
156
|
+
1, 49, :_reduce_43,
|
157
|
+
4, 50, :_reduce_44,
|
158
|
+
3, 50, :_reduce_45,
|
159
|
+
2, 50, :_reduce_46,
|
160
|
+
2, 42, :_reduce_47,
|
161
|
+
2, 42, :_reduce_48,
|
162
162
|
1, 38, :_reduce_none,
|
163
|
-
|
164
|
-
|
165
|
-
2,
|
166
|
-
2,
|
167
|
-
|
168
|
-
1,
|
169
|
-
1,
|
170
|
-
1,
|
171
|
-
1,
|
172
|
-
1, 51, :
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
1, 52, :
|
177
|
-
|
178
|
-
1, 52, :
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
163
|
+
0, 38, :_reduce_none,
|
164
|
+
2, 39, :_reduce_51,
|
165
|
+
2, 39, :_reduce_52,
|
166
|
+
2, 39, :_reduce_53,
|
167
|
+
2, 39, :_reduce_54,
|
168
|
+
1, 39, :_reduce_none,
|
169
|
+
1, 39, :_reduce_none,
|
170
|
+
1, 39, :_reduce_none,
|
171
|
+
1, 39, :_reduce_none,
|
172
|
+
1, 51, :_reduce_59,
|
173
|
+
2, 48, :_reduce_60,
|
174
|
+
2, 48, :_reduce_61,
|
175
|
+
0, 48, :_reduce_none,
|
176
|
+
1, 52, :_reduce_63,
|
177
|
+
1, 52, :_reduce_64,
|
178
|
+
1, 52, :_reduce_65,
|
179
|
+
1, 52, :_reduce_66,
|
180
|
+
1, 52, :_reduce_67,
|
181
|
+
1, 52, :_reduce_68,
|
182
|
+
1, 52, :_reduce_69,
|
183
|
+
3, 40, :_reduce_70,
|
184
|
+
1, 53, :_reduce_none,
|
185
|
+
2, 53, :_reduce_none,
|
186
|
+
1, 53, :_reduce_none ]
|
187
|
+
|
188
|
+
racc_reduce_n = 74
|
189
|
+
|
190
|
+
racc_shift_n = 106
|
183
191
|
|
184
192
|
racc_token_table = {
|
185
193
|
false => 0,
|
@@ -269,6 +277,7 @@ Racc_token_to_s_table = [
|
|
269
277
|
"$start",
|
270
278
|
"selector",
|
271
279
|
"simple_selector_1toN",
|
280
|
+
"prefixless_combinator_selector",
|
272
281
|
"combinator",
|
273
282
|
"simple_selector",
|
274
283
|
"element_name",
|
@@ -307,22 +316,22 @@ def _reduce_2(val, _values, result)
|
|
307
316
|
end
|
308
317
|
|
309
318
|
def _reduce_3(val, _values, result)
|
310
|
-
result =
|
319
|
+
result = val.flatten
|
311
320
|
result
|
312
321
|
end
|
313
322
|
|
314
323
|
def _reduce_4(val, _values, result)
|
315
|
-
result = :
|
324
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
316
325
|
result
|
317
326
|
end
|
318
327
|
|
319
328
|
def _reduce_5(val, _values, result)
|
320
|
-
result = :
|
329
|
+
result = :CHILD_SELECTOR
|
321
330
|
result
|
322
331
|
end
|
323
332
|
|
324
333
|
def _reduce_6(val, _values, result)
|
325
|
-
result = :
|
334
|
+
result = :FOLLOWING_SELECTOR
|
326
335
|
result
|
327
336
|
end
|
328
337
|
|
@@ -332,11 +341,16 @@ def _reduce_7(val, _values, result)
|
|
332
341
|
end
|
333
342
|
|
334
343
|
def _reduce_8(val, _values, result)
|
335
|
-
result = :
|
344
|
+
result = :DESCENDANT_SELECTOR
|
336
345
|
result
|
337
346
|
end
|
338
347
|
|
339
348
|
def _reduce_9(val, _values, result)
|
349
|
+
result = :CHILD_SELECTOR
|
350
|
+
result
|
351
|
+
end
|
352
|
+
|
353
|
+
def _reduce_10(val, _values, result)
|
340
354
|
result = if val[1].nil?
|
341
355
|
val.first
|
342
356
|
else
|
@@ -346,7 +360,7 @@ def _reduce_9(val, _values, result)
|
|
346
360
|
result
|
347
361
|
end
|
348
362
|
|
349
|
-
def
|
363
|
+
def _reduce_11(val, _values, result)
|
350
364
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
351
365
|
[
|
352
366
|
val.first,
|
@@ -357,27 +371,27 @@ def _reduce_10(val, _values, result)
|
|
357
371
|
result
|
358
372
|
end
|
359
373
|
|
360
|
-
def
|
374
|
+
def _reduce_12(val, _values, result)
|
361
375
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
362
376
|
|
363
377
|
result
|
364
378
|
end
|
365
379
|
|
366
|
-
# reduce
|
380
|
+
# reduce 13 omitted
|
367
381
|
|
368
|
-
def
|
382
|
+
def _reduce_14(val, _values, result)
|
369
383
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
370
384
|
|
371
385
|
result
|
372
386
|
end
|
373
387
|
|
374
|
-
def
|
388
|
+
def _reduce_15(val, _values, result)
|
375
389
|
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
376
390
|
|
377
391
|
result
|
378
392
|
end
|
379
393
|
|
380
|
-
def
|
394
|
+
def _reduce_16(val, _values, result)
|
381
395
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
382
396
|
[
|
383
397
|
Node.new(:ELEMENT_NAME, ['*']),
|
@@ -388,7 +402,7 @@ def _reduce_15(val, _values, result)
|
|
388
402
|
result
|
389
403
|
end
|
390
404
|
|
391
|
-
def
|
405
|
+
def _reduce_17(val, _values, result)
|
392
406
|
result = Node.new(:CONDITIONAL_SELECTOR,
|
393
407
|
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
394
408
|
)
|
@@ -396,27 +410,33 @@ def _reduce_16(val, _values, result)
|
|
396
410
|
result
|
397
411
|
end
|
398
412
|
|
399
|
-
def
|
400
|
-
result = Node.new(val
|
413
|
+
def _reduce_18(val, _values, result)
|
414
|
+
result = Node.new(val.first, [nil, val.last])
|
401
415
|
|
402
416
|
result
|
403
417
|
end
|
404
418
|
|
405
|
-
# reduce 18 omitted
|
406
|
-
|
407
419
|
def _reduce_19(val, _values, result)
|
408
|
-
|
420
|
+
result = Node.new(val[1], [val.first, val.last])
|
421
|
+
|
409
422
|
result
|
410
423
|
end
|
411
424
|
|
412
425
|
# reduce 20 omitted
|
413
426
|
|
414
427
|
def _reduce_21(val, _values, result)
|
428
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
429
|
+
result
|
430
|
+
end
|
431
|
+
|
432
|
+
# reduce 22 omitted
|
433
|
+
|
434
|
+
def _reduce_23(val, _values, result)
|
415
435
|
result = Node.new(:ELEMENT_NAME, val)
|
416
436
|
result
|
417
437
|
end
|
418
438
|
|
419
|
-
def
|
439
|
+
def _reduce_24(val, _values, result)
|
420
440
|
result = Node.new(:ELEMENT_NAME,
|
421
441
|
[[val.first, val.last].compact.join(':')]
|
422
442
|
)
|
@@ -424,21 +444,21 @@ def _reduce_22(val, _values, result)
|
|
424
444
|
result
|
425
445
|
end
|
426
446
|
|
427
|
-
def
|
447
|
+
def _reduce_25(val, _values, result)
|
428
448
|
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
429
449
|
result = Node.new(:ELEMENT_NAME, [name])
|
430
450
|
|
431
451
|
result
|
432
452
|
end
|
433
453
|
|
434
|
-
def
|
454
|
+
def _reduce_26(val, _values, result)
|
435
455
|
result = val[0]
|
436
456
|
result
|
437
457
|
end
|
438
458
|
|
439
|
-
# reduce
|
459
|
+
# reduce 27 omitted
|
440
460
|
|
441
|
-
def
|
461
|
+
def _reduce_28(val, _values, result)
|
442
462
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
443
463
|
[val[1]] + (val[2] || [])
|
444
464
|
)
|
@@ -446,7 +466,7 @@ def _reduce_26(val, _values, result)
|
|
446
466
|
result
|
447
467
|
end
|
448
468
|
|
449
|
-
def
|
469
|
+
def _reduce_29(val, _values, result)
|
450
470
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
451
471
|
[val[1]] + (val[2] || [])
|
452
472
|
)
|
@@ -454,7 +474,7 @@ def _reduce_27(val, _values, result)
|
|
454
474
|
result
|
455
475
|
end
|
456
476
|
|
457
|
-
def
|
477
|
+
def _reduce_30(val, _values, result)
|
458
478
|
# Non standard, but hpricot supports it.
|
459
479
|
result = Node.new(:PSEUDO_CLASS,
|
460
480
|
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
@@ -463,7 +483,7 @@ def _reduce_28(val, _values, result)
|
|
463
483
|
result
|
464
484
|
end
|
465
485
|
|
466
|
-
def
|
486
|
+
def _reduce_31(val, _values, result)
|
467
487
|
result = Node.new(:ELEMENT_NAME,
|
468
488
|
[[val.first, val.last].compact.join(':')]
|
469
489
|
)
|
@@ -471,7 +491,7 @@ def _reduce_29(val, _values, result)
|
|
471
491
|
result
|
472
492
|
end
|
473
493
|
|
474
|
-
def
|
494
|
+
def _reduce_32(val, _values, result)
|
475
495
|
# Default namespace is not applied to attributes.
|
476
496
|
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
477
497
|
result = Node.new(:ELEMENT_NAME, [val.first])
|
@@ -479,56 +499,56 @@ def _reduce_30(val, _values, result)
|
|
479
499
|
result
|
480
500
|
end
|
481
501
|
|
482
|
-
def
|
502
|
+
def _reduce_33(val, _values, result)
|
483
503
|
result = Node.new(:FUNCTION, [val.first.strip])
|
484
504
|
|
485
505
|
result
|
486
506
|
end
|
487
507
|
|
488
|
-
def
|
508
|
+
def _reduce_34(val, _values, result)
|
489
509
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
490
510
|
|
491
511
|
result
|
492
512
|
end
|
493
513
|
|
494
|
-
def
|
514
|
+
def _reduce_35(val, _values, result)
|
495
515
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
496
516
|
|
497
517
|
result
|
498
518
|
end
|
499
519
|
|
500
|
-
def
|
520
|
+
def _reduce_36(val, _values, result)
|
501
521
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
502
522
|
|
503
523
|
result
|
504
524
|
end
|
505
525
|
|
506
|
-
def
|
526
|
+
def _reduce_37(val, _values, result)
|
507
527
|
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
508
528
|
|
509
529
|
result
|
510
530
|
end
|
511
531
|
|
512
|
-
def
|
532
|
+
def _reduce_38(val, _values, result)
|
513
533
|
result = [val.first, val.last]
|
514
534
|
result
|
515
535
|
end
|
516
536
|
|
517
|
-
def
|
537
|
+
def _reduce_39(val, _values, result)
|
518
538
|
result = [val.first, val.last]
|
519
539
|
result
|
520
540
|
end
|
521
541
|
|
522
|
-
def
|
542
|
+
def _reduce_40(val, _values, result)
|
523
543
|
result = [val.first, val.last]
|
524
544
|
result
|
525
545
|
end
|
526
546
|
|
527
|
-
# reduce
|
547
|
+
# reduce 41 omitted
|
528
548
|
|
529
|
-
# reduce
|
549
|
+
# reduce 42 omitted
|
530
550
|
|
531
|
-
def
|
551
|
+
def _reduce_43(val, _values, result)
|
532
552
|
if val[0] == 'even'
|
533
553
|
val = ["2","n","+","0"]
|
534
554
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -546,7 +566,7 @@ def _reduce_41(val, _values, result)
|
|
546
566
|
result
|
547
567
|
end
|
548
568
|
|
549
|
-
def
|
569
|
+
def _reduce_44(val, _values, result)
|
550
570
|
if val[1] == 'n'
|
551
571
|
result = Node.new(:AN_PLUS_B, val)
|
552
572
|
else
|
@@ -556,7 +576,7 @@ def _reduce_42(val, _values, result)
|
|
556
576
|
result
|
557
577
|
end
|
558
578
|
|
559
|
-
def
|
579
|
+
def _reduce_45(val, _values, result)
|
560
580
|
# n+3, -n+3
|
561
581
|
if val[0] == 'n'
|
562
582
|
val.unshift("1")
|
@@ -572,7 +592,7 @@ def _reduce_43(val, _values, result)
|
|
572
592
|
result
|
573
593
|
end
|
574
594
|
|
575
|
-
def
|
595
|
+
def _reduce_46(val, _values, result)
|
576
596
|
if val[1] == 'n'
|
577
597
|
val << "+"
|
578
598
|
val << "0"
|
@@ -584,116 +604,116 @@ def _reduce_44(val, _values, result)
|
|
584
604
|
result
|
585
605
|
end
|
586
606
|
|
587
|
-
def
|
607
|
+
def _reduce_47(val, _values, result)
|
588
608
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
589
609
|
|
590
610
|
result
|
591
611
|
end
|
592
612
|
|
593
|
-
def
|
613
|
+
def _reduce_48(val, _values, result)
|
594
614
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
595
615
|
result
|
596
616
|
end
|
597
617
|
|
598
|
-
# reduce
|
618
|
+
# reduce 49 omitted
|
599
619
|
|
600
|
-
# reduce
|
620
|
+
# reduce 50 omitted
|
601
621
|
|
602
|
-
def
|
622
|
+
def _reduce_51(val, _values, result)
|
603
623
|
result = Node.new(:COMBINATOR, val)
|
604
624
|
|
605
625
|
result
|
606
626
|
end
|
607
627
|
|
608
|
-
def
|
628
|
+
def _reduce_52(val, _values, result)
|
609
629
|
result = Node.new(:COMBINATOR, val)
|
610
630
|
|
611
631
|
result
|
612
632
|
end
|
613
633
|
|
614
|
-
def
|
634
|
+
def _reduce_53(val, _values, result)
|
615
635
|
result = Node.new(:COMBINATOR, val)
|
616
636
|
|
617
637
|
result
|
618
638
|
end
|
619
639
|
|
620
|
-
def
|
640
|
+
def _reduce_54(val, _values, result)
|
621
641
|
result = Node.new(:COMBINATOR, val)
|
622
642
|
|
623
643
|
result
|
624
644
|
end
|
625
645
|
|
626
|
-
# reduce 53 omitted
|
627
|
-
|
628
|
-
# reduce 54 omitted
|
629
|
-
|
630
646
|
# reduce 55 omitted
|
631
647
|
|
632
648
|
# reduce 56 omitted
|
633
649
|
|
634
|
-
|
650
|
+
# reduce 57 omitted
|
651
|
+
|
652
|
+
# reduce 58 omitted
|
653
|
+
|
654
|
+
def _reduce_59(val, _values, result)
|
635
655
|
result = Node.new(:ID, val)
|
636
656
|
result
|
637
657
|
end
|
638
658
|
|
639
|
-
def
|
659
|
+
def _reduce_60(val, _values, result)
|
640
660
|
result = [val.first, val[1]]
|
641
661
|
result
|
642
662
|
end
|
643
663
|
|
644
|
-
def
|
664
|
+
def _reduce_61(val, _values, result)
|
645
665
|
result = [val.first, val[1]]
|
646
666
|
result
|
647
667
|
end
|
648
668
|
|
649
|
-
# reduce
|
669
|
+
# reduce 62 omitted
|
650
670
|
|
651
|
-
def
|
671
|
+
def _reduce_63(val, _values, result)
|
652
672
|
result = :equal
|
653
673
|
result
|
654
674
|
end
|
655
675
|
|
656
|
-
def
|
676
|
+
def _reduce_64(val, _values, result)
|
657
677
|
result = :prefix_match
|
658
678
|
result
|
659
679
|
end
|
660
680
|
|
661
|
-
def
|
681
|
+
def _reduce_65(val, _values, result)
|
662
682
|
result = :suffix_match
|
663
683
|
result
|
664
684
|
end
|
665
685
|
|
666
|
-
def
|
686
|
+
def _reduce_66(val, _values, result)
|
667
687
|
result = :substring_match
|
668
688
|
result
|
669
689
|
end
|
670
690
|
|
671
|
-
def
|
691
|
+
def _reduce_67(val, _values, result)
|
672
692
|
result = :not_equal
|
673
693
|
result
|
674
694
|
end
|
675
695
|
|
676
|
-
def
|
696
|
+
def _reduce_68(val, _values, result)
|
677
697
|
result = :includes
|
678
698
|
result
|
679
699
|
end
|
680
700
|
|
681
|
-
def
|
701
|
+
def _reduce_69(val, _values, result)
|
682
702
|
result = :dash_match
|
683
703
|
result
|
684
704
|
end
|
685
705
|
|
686
|
-
def
|
706
|
+
def _reduce_70(val, _values, result)
|
687
707
|
result = Node.new(:NOT, [val[1]])
|
688
708
|
|
689
709
|
result
|
690
710
|
end
|
691
711
|
|
692
|
-
# reduce
|
712
|
+
# reduce 71 omitted
|
693
713
|
|
694
|
-
# reduce
|
714
|
+
# reduce 72 omitted
|
695
715
|
|
696
|
-
# reduce
|
716
|
+
# reduce 73 omitted
|
697
717
|
|
698
718
|
def _reduce_none(val, _values, result)
|
699
719
|
val[0]
|