thbar-hpricot 0.8.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/CHANGELOG +104 -0
  2. data/COPYING +18 -0
  3. data/README.md +276 -0
  4. data/Rakefile +234 -0
  5. data/ext/fast_xs/FastXsService.java +1123 -0
  6. data/ext/fast_xs/extconf.rb +4 -0
  7. data/ext/fast_xs/fast_xs.c +210 -0
  8. data/ext/hpricot_scan/HpricotCss.java +850 -0
  9. data/ext/hpricot_scan/HpricotScanService.java +2099 -0
  10. data/ext/hpricot_scan/extconf.rb +9 -0
  11. data/ext/hpricot_scan/hpricot_common.rl +76 -0
  12. data/ext/hpricot_scan/hpricot_css.c +3511 -0
  13. data/ext/hpricot_scan/hpricot_css.java.rl +155 -0
  14. data/ext/hpricot_scan/hpricot_css.rl +120 -0
  15. data/ext/hpricot_scan/hpricot_scan.c +7045 -0
  16. data/ext/hpricot_scan/hpricot_scan.h +79 -0
  17. data/ext/hpricot_scan/hpricot_scan.java.rl +1161 -0
  18. data/ext/hpricot_scan/hpricot_scan.rl +902 -0
  19. data/extras/hpricot.png +0 -0
  20. data/lib/hpricot.rb +26 -0
  21. data/lib/hpricot/blankslate.rb +63 -0
  22. data/lib/hpricot/builder.rb +216 -0
  23. data/lib/hpricot/elements.rb +514 -0
  24. data/lib/hpricot/htmlinfo.rb +691 -0
  25. data/lib/hpricot/inspect.rb +103 -0
  26. data/lib/hpricot/modules.rb +40 -0
  27. data/lib/hpricot/parse.rb +38 -0
  28. data/lib/hpricot/tag.rb +219 -0
  29. data/lib/hpricot/tags.rb +164 -0
  30. data/lib/hpricot/traverse.rb +839 -0
  31. data/lib/hpricot/xchar.rb +94 -0
  32. data/test/files/basic.xhtml +17 -0
  33. data/test/files/boingboing.html +2266 -0
  34. data/test/files/cy0.html +3653 -0
  35. data/test/files/immob.html +400 -0
  36. data/test/files/pace_application.html +1320 -0
  37. data/test/files/tenderlove.html +16 -0
  38. data/test/files/uswebgen.html +220 -0
  39. data/test/files/utf8.html +1054 -0
  40. data/test/files/week9.html +1723 -0
  41. data/test/files/why.xml +19 -0
  42. data/test/load_files.rb +7 -0
  43. data/test/nokogiri-bench.rb +64 -0
  44. data/test/test_alter.rb +96 -0
  45. data/test/test_builder.rb +37 -0
  46. data/test/test_parser.rb +457 -0
  47. data/test/test_paths.rb +25 -0
  48. data/test/test_preserved.rb +88 -0
  49. data/test/test_xml.rb +28 -0
  50. metadata +124 -0
@@ -0,0 +1,4 @@
1
+ require 'mkmf'
2
+ have_header('stdio.h') or exit
3
+ dir_config('fast_xs')
4
+ create_makefile('fast_xs')
@@ -0,0 +1,210 @@
1
+ #include <ruby.h>
2
+ #include <assert.h>
3
+
4
+ #ifdef HAVE_RUBY_ENCODING_H
5
+ #include <ruby/encoding.h>
6
+ # define ASSOCIATE_INDEX(s,enc) rb_enc_associate_index((s), rb_enc_to_index(enc))
7
+ #else
8
+ # define ASSOCIATE_INDEX(s,enc)
9
+ #endif
10
+
11
+ #ifndef RARRAY_LEN
12
+ #define RARRAY_LEN(arr) RARRAY(arr)->len
13
+ #define RARRAY_PTR(arr) RARRAY(arr)->ptr
14
+ #define RSTRING_LEN(str) RSTRING(str)->len
15
+ #define RSTRING_PTR(str) RSTRING(str)->ptr
16
+ #endif
17
+
18
+ static ID unpack_id;
19
+ static VALUE U_fmt, C_fmt;
20
+
21
+ /* give GCC hints for better branch prediction
22
+ * (we layout branches so that ASCII characters are handled faster) */
23
+ #if defined(__GNUC__) && (__GNUC__ >= 3)
24
+ # define likely(x) __builtin_expect (!!(x), 1)
25
+ # define unlikely(x) __builtin_expect (!!(x), 0)
26
+ #else
27
+ # define unlikely(x) (x)
28
+ # define likely(x) (x)
29
+ #endif
30
+
31
+ /* pass-through certain characters for CP-1252 */
32
+ #define p(x) (x-128)
33
+
34
+ static const int cp_1252[] = {
35
+ 8364, /* 128 => 8364, euro sign */
36
+ p(129), /* 129 => 129, pass-through */
37
+ 8218, /* 130 => 8218, single low-9 quotation mark */
38
+ 402, /* 131 => 402, latin small letter f with hook */
39
+ 8222, /* 132 => 8222, double low-9 quotation mark */
40
+ 8230, /* 133 => 8230, horizontal ellipsis */
41
+ 8224, /* 134 => 8224, dagger */
42
+ 8225, /* 135 => 8225, double dagger */
43
+ 710, /* 136 => 710, modifier letter circumflex accent */
44
+ 8240, /* 137 => 8240, per mille sign */
45
+ 352, /* 138 => 352, latin capital letter s with caron */
46
+ 8249, /* 139 => 8249, single left-pointing angle quotation mark */
47
+ 338, /* 140 => 338, latin capital ligature oe */
48
+ p(141), /* 141 => 141, pass-through */
49
+ 381, /* 142 => 381, latin capital letter z with caron */
50
+ p(143), /* 143 => 143, pass-through */
51
+ p(144), /* 144 => 144, pass-through */
52
+ 8216, /* 145 => 8216, left single quotation mark */
53
+ 8217, /* 146 => 8217, right single quotation mark */
54
+ 8220, /* 147 => 8220, left double quotation mark */
55
+ 8221, /* 148 => 8221, right double quotation mark */
56
+ 8226, /* 149 => 8226, bullet */
57
+ 8211, /* 150 => 8211, en dash */
58
+ 8212, /* 151 => 8212, em dash */
59
+ 732, /* 152 => 732, small tilde */
60
+ 8482, /* 153 => 8482, trade mark sign */
61
+ 353, /* 154 => 353, latin small letter s with caron */
62
+ 8250, /* 155 => 8250, single right-pointing angle quotation mark */
63
+ 339, /* 156 => 339, latin small ligature oe */
64
+ p(157), /* 157 => 157, pass-through */
65
+ 382, /* 158 => 382, latin small letter z with caron */
66
+ 376 /* 159 => 376} latin capital letter y with diaeresis */
67
+ };
68
+
69
+ #define VALID_VALUE(n) \
70
+ (n >= 0x20 && n <= 0xD7FF) || \
71
+ (n >= 0xE000 && n <= 0xFFFD) || \
72
+ (n >= 0x10000 && n <= 0x10FFFF)
73
+
74
+ #define CP_1252_ESCAPE(n) do { \
75
+ if (n >= 128 && n <= 159) \
76
+ n = cp_1252[n - 128]; \
77
+ } while(0)
78
+
79
+ static inline size_t bytes_for(int n)
80
+ {
81
+ if (n < 1000)
82
+ return sizeof("&#999;") - 1;
83
+ if (n < 10000)
84
+ return sizeof("&#9999;") - 1;
85
+ if (n < 100000)
86
+ return sizeof("&#99999;") - 1;
87
+ if (n < 1000000)
88
+ return sizeof("&#999999;") - 1;
89
+ /* if (n < 10000000), we won't have cases above 0x10FFFF */
90
+ return sizeof("&#9999999;") - 1;
91
+ }
92
+
93
+ static size_t escape(char *buf, int n)
94
+ {
95
+
96
+ #define return_const_len(x) do { \
97
+ memcpy(buf, x, sizeof(x) - 1); \
98
+ return (sizeof(x) - 1); \
99
+ } while (0)
100
+
101
+ /* handle ASCII first */
102
+ if (likely(n < 128)) {
103
+ if (likely(n >= 0x20 || n == '\t' || n == '\n' || n == '\r')) {
104
+ if (unlikely(n == '"'))
105
+ return_const_len("&quot;");
106
+ if (unlikely(n == '&'))
107
+ return_const_len("&amp;");
108
+ if (unlikely(n == '<'))
109
+ return_const_len("&lt;");
110
+ if (unlikely(n == '>'))
111
+ return_const_len("&gt;");
112
+ buf[0] = (char)n;
113
+ return 1;
114
+ }
115
+
116
+ buf[0] = '*';
117
+ return 1;
118
+ }
119
+
120
+ #undef return_const_len
121
+
122
+ CP_1252_ESCAPE(n);
123
+
124
+ if (VALID_VALUE(n)) {
125
+ /* return snprintf(buf, sizeof("&#1114111;"), "&#%i;", n); */
126
+ static const char digitmap[] = "0123456789";
127
+ size_t rv = sizeof("&#;") - 1;
128
+ buf += bytes_for(n);
129
+ *--buf = ';';
130
+ do {
131
+ *--buf = digitmap[(int)(n % 10)];
132
+ ++rv;
133
+ } while (n /= 10);
134
+ *--buf = '#';
135
+ *--buf = '&';
136
+ return rv;
137
+ }
138
+ buf[0] = '*';
139
+ return 1;
140
+ }
141
+
142
+ static VALUE unpack_utf8(VALUE self)
143
+ {
144
+ return rb_funcall(self, unpack_id, 1, U_fmt);
145
+ }
146
+
147
+ static VALUE unpack_uchar(VALUE self)
148
+ {
149
+ return rb_funcall(self, unpack_id, 1, C_fmt);
150
+ }
151
+
152
+ /*
153
+ * escapes strings for XML
154
+ * The double-quote (") character is translated to "&quot;"
155
+ */
156
+ static VALUE fast_xs(VALUE self)
157
+ {
158
+ long i;
159
+ VALUE array;
160
+ char *c;
161
+ size_t s_len;
162
+ VALUE *tmp;
163
+ VALUE rv;
164
+
165
+ array = rb_rescue(unpack_utf8, self, unpack_uchar, self);
166
+
167
+ for (tmp = RARRAY_PTR(array), s_len = i = RARRAY_LEN(array);
168
+ --i >= 0;
169
+ tmp++) {
170
+ int n = NUM2INT(*tmp);
171
+ if (likely(n < 128)) {
172
+ if (unlikely(n == '"'))
173
+ s_len += (sizeof("&quot;") - 2);
174
+ if (unlikely(n == '&'))
175
+ s_len += (sizeof("&amp;") - 2);
176
+ if (unlikely(n == '>' || n == '<'))
177
+ s_len += (sizeof("&gt;") - 2);
178
+ continue;
179
+ }
180
+
181
+ CP_1252_ESCAPE(n);
182
+
183
+ if (VALID_VALUE(n))
184
+ s_len += bytes_for(n) - 1;
185
+ }
186
+
187
+ rv = rb_str_new(NULL, s_len);
188
+ ASSOCIATE_INDEX(rv, rb_default_external_encoding());
189
+ c = RSTRING_PTR(rv);
190
+
191
+ for (tmp = RARRAY_PTR(array), i = RARRAY_LEN(array); --i >= 0; tmp++)
192
+ c += escape(c, NUM2INT(*tmp));
193
+
194
+ return rv;
195
+ }
196
+
197
+ void Init_fast_xs(void)
198
+ {
199
+ assert(cp_1252[159 - 128] == 376); /* just in case I skipped a line */
200
+
201
+ unpack_id = rb_intern("unpack");
202
+ U_fmt = rb_str_new("U*", 2);
203
+ ASSOCIATE_INDEX(U_fmt, rb_ascii8bit_encoding());
204
+ C_fmt = rb_str_new("C*", 2);
205
+ ASSOCIATE_INDEX(C_fmt, rb_ascii8bit_encoding());
206
+ rb_global_variable(&U_fmt);
207
+ rb_global_variable(&C_fmt);
208
+
209
+ rb_define_method(rb_cString, "fast_xs", fast_xs, 0);
210
+ }
@@ -0,0 +1,850 @@
1
+
2
+ // line 1 "hpricot_css.java.rl"
3
+ import java.io.IOException;
4
+
5
+ import org.jruby.Ruby;
6
+ import org.jruby.RubyArray;
7
+ import org.jruby.RubyClass;
8
+ import org.jruby.RubyHash;
9
+ import org.jruby.RubyModule;
10
+ import org.jruby.RubyNumeric;
11
+ import org.jruby.RubyObject;
12
+ import org.jruby.RubyObjectAdapter;
13
+ import org.jruby.RubyRegexp;
14
+ import org.jruby.RubyString;
15
+ import org.jruby.anno.JRubyMethod;
16
+ import org.jruby.exceptions.RaiseException;
17
+ import org.jruby.javasupport.JavaEmbedUtils;
18
+ import org.jruby.runtime.Arity;
19
+ import org.jruby.runtime.Block;
20
+ import org.jruby.runtime.ObjectAllocator;
21
+ import org.jruby.runtime.ThreadContext;
22
+ import org.jruby.runtime.builtin.IRubyObject;
23
+ import org.jruby.runtime.callback.Callback;
24
+ import org.jruby.exceptions.RaiseException;
25
+ import org.jruby.runtime.load.BasicLibraryService;
26
+ import org.jruby.util.ByteList;
27
+
28
+ public class HpricotCss {
29
+ public void FILTER(String id) {
30
+ IRubyObject[] args = new IRubyObject[fargs];
31
+ System.arraycopy(fvals, 0, args, 0, fargs);
32
+ mod.callMethod(ctx, id, args);
33
+ tmpt.rb_clear();
34
+ fargs = 1;
35
+ }
36
+
37
+ public void FILTERAUTO() {
38
+ try {
39
+ FILTER(new String(data, ts, te - ts, "ISO-8859-1"));
40
+ } catch(java.io.UnsupportedEncodingException e) {}
41
+ }
42
+
43
+ public void PUSH(int aps, int ape) {
44
+ RubyString str = RubyString.newString(runtime, data, aps, ape-aps);
45
+ fvals[fargs++] = str;
46
+ tmpt.append(str);
47
+ }
48
+
49
+ private IRubyObject self, mod, str, node;
50
+ private int cs, act, eof, p, pe, ts, te, aps, ape, aps2, ape2;
51
+ private byte[] data;
52
+
53
+ private int fargs = 1;
54
+ private IRubyObject[] fvals = new IRubyObject[6];
55
+ private RubyArray focus;
56
+ private RubyArray tmpt;
57
+ private Ruby runtime;
58
+ private ThreadContext ctx;
59
+
60
+ public HpricotCss(IRubyObject self, IRubyObject mod, IRubyObject str, IRubyObject node) {
61
+ this.self = self;
62
+ this.mod = mod;
63
+ this.str = str;
64
+ this.node = node;
65
+ this.runtime = self.getRuntime();
66
+ this.ctx = runtime.getCurrentContext();
67
+ this.focus = RubyArray.newArray(runtime, node);
68
+ this.tmpt = runtime.newArray();
69
+
70
+ fvals[0] = focus;
71
+
72
+ if(!(str instanceof RubyString)) {
73
+ throw runtime.newArgumentError("bad CSS selector, String only please.");
74
+ }
75
+
76
+ ByteList bl = ((RubyString)str).getByteList();
77
+
78
+ data = bl.bytes;
79
+ p = bl.begin;
80
+ pe = p + bl.realSize;
81
+ eof = pe;
82
+ }
83
+
84
+
85
+ // line 86 "HpricotCss.java"
86
+ private static byte[] init__hpricot_css_actions_0()
87
+ {
88
+ return new byte [] {
89
+ 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 6, 1,
90
+ 7, 1, 15, 1, 19, 1, 22, 1, 24, 1, 28, 1,
91
+ 29, 1, 30, 1, 31, 1, 32, 1, 33, 1, 34, 1,
92
+ 35, 2, 0, 3, 2, 1, 14, 2, 1, 16, 2, 1,
93
+ 17, 2, 1, 18, 2, 1, 20, 2, 1, 21, 2, 1,
94
+ 23, 2, 1, 25, 2, 1, 26, 2, 1, 27, 2, 4,
95
+ 5, 2, 7, 8, 2, 7, 9, 2, 7, 10, 2, 7,
96
+ 11, 2, 7, 12, 2, 7, 13, 3, 0, 1, 16, 3,
97
+ 0, 1, 18, 3, 7, 0, 8, 3, 7, 0, 9, 3,
98
+ 7, 0, 10, 3, 7, 0, 13, 3, 7, 1, 13
99
+ };
100
+ }
101
+
102
+ private static final byte _hpricot_css_actions[] = init__hpricot_css_actions_0();
103
+
104
+
105
+ private static short[] init__hpricot_css_key_offsets_0()
106
+ {
107
+ return new short [] {
108
+ 0, 0, 4, 20, 21, 23, 25, 27, 29, 30, 32, 34,
109
+ 36, 38, 54, 55, 57, 59, 61, 63, 85, 89, 92, 95,
110
+ 98, 99, 100, 101, 103, 107, 111, 114, 115, 116, 118, 119,
111
+ 120, 122, 123, 125, 127, 129, 131, 137, 142, 153, 161, 165,
112
+ 169, 173, 176, 180, 184, 201, 221, 222, 228, 229, 235, 237,
113
+ 238, 239, 241, 242, 246, 253, 259, 261, 264, 267, 270, 272,
114
+ 275, 277, 278, 299, 320, 341, 361, 384, 401, 403, 406, 409,
115
+ 412, 415, 417, 419, 449, 453, 456, 472, 477, 495, 511, 527,
116
+ 544, 563, 580, 598, 616, 634, 652, 670, 688, 705, 723, 741,
117
+ 759, 777, 795, 812, 830, 849, 867, 885, 904, 922, 940, 958,
118
+ 975, 976, 977, 994, 1011, 1027, 1044
119
+ };
120
+ }
121
+
122
+ private static final short _hpricot_css_key_offsets[] = init__hpricot_css_key_offsets_0();
123
+
124
+
125
+ private static char[] init__hpricot_css_trans_keys_0()
126
+ {
127
+ return new char [] {
128
+ 32, 44, 9, 13, 45, 92, 95, 196, 48, 57, 65, 90,
129
+ 97, 122, 197, 223, 224, 239, 240, 244, 46, 168, 191, 128,
130
+ 191, 128, 191, 128, 191, 46, 168, 191, 128, 191, 128, 191,
131
+ 128, 191, 45, 92, 95, 196, 48, 57, 65, 90, 97, 122,
132
+ 197, 223, 224, 239, 240, 244, 46, 168, 191, 128, 191, 128,
133
+ 191, 128, 191, 45, 92, 95, 101, 102, 103, 108, 110, 111,
134
+ 196, 48, 57, 65, 90, 97, 122, 197, 223, 224, 239, 240,
135
+ 244, 34, 39, 40, 41, 34, 40, 41, 34, 40, 41, 34,
136
+ 40, 41, 41, 41, 41, 34, 40, 34, 39, 40, 41, 34,
137
+ 39, 40, 41, 39, 40, 41, 41, 41, 39, 40, 41, 41,
138
+ 40, 41, 46, 168, 191, 128, 191, 128, 191, 128, 191, 34,
139
+ 39, 40, 41, 48, 57, 34, 40, 41, 48, 57, 34, 39,
140
+ 40, 41, 43, 45, 101, 110, 111, 48, 57, 34, 40, 41,
141
+ 43, 45, 110, 48, 57, 34, 40, 41, 118, 34, 40, 41,
142
+ 101, 34, 40, 41, 110, 34, 40, 41, 34, 40, 41, 100,
143
+ 34, 40, 41, 100, 45, 92, 95, 110, 196, 48, 57, 65,
144
+ 90, 97, 122, 197, 223, 224, 239, 240, 244, 32, 45, 61,
145
+ 92, 95, 196, 9, 13, 48, 57, 65, 90, 97, 122, 197,
146
+ 223, 224, 239, 240, 244, 61, 32, 34, 39, 93, 9, 13,
147
+ 93, 32, 34, 39, 93, 9, 13, 34, 93, 34, 93, 39,
148
+ 93, 39, 32, 61, 9, 13, 32, 34, 39, 61, 93, 9,
149
+ 13, 32, 34, 39, 93, 9, 13, 46, 61, 61, 168, 191,
150
+ 61, 128, 191, 61, 128, 191, 128, 191, 61, 128, 191, 128,
151
+ 191, 46, 32, 45, 61, 92, 95, 97, 196, 9, 13, 48,
152
+ 57, 65, 90, 98, 122, 197, 223, 224, 239, 240, 244, 32,
153
+ 45, 61, 92, 95, 109, 196, 9, 13, 48, 57, 65, 90,
154
+ 97, 122, 197, 223, 224, 239, 240, 244, 32, 45, 61, 92,
155
+ 95, 101, 196, 9, 13, 48, 57, 65, 90, 97, 122, 197,
156
+ 223, 224, 239, 240, 244, 32, 45, 61, 92, 95, 196, 9,
157
+ 13, 48, 57, 65, 90, 97, 122, 197, 223, 224, 239, 240,
158
+ 244, 32, 34, 39, 45, 61, 92, 93, 95, 196, 9, 13,
159
+ 48, 57, 65, 90, 97, 122, 197, 223, 224, 239, 240, 244,
160
+ 45, 92, 93, 95, 196, 48, 57, 65, 90, 97, 122, 197,
161
+ 223, 224, 239, 240, 244, 46, 93, 93, 168, 191, 93, 128,
162
+ 191, 93, 128, 191, 93, 128, 191, 168, 191, 128, 191, 32,
163
+ 35, 43, 44, 45, 46, 58, 62, 91, 92, 95, 101, 110,
164
+ 111, 126, 196, 9, 13, 48, 57, 65, 90, 97, 122, 197,
165
+ 223, 224, 239, 240, 244, 32, 44, 9, 13, 32, 9, 13,
166
+ 45, 92, 95, 196, 48, 57, 65, 90, 97, 122, 197, 223,
167
+ 224, 239, 240, 244, 43, 45, 110, 48, 57, 43, 45, 92,
168
+ 95, 110, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
169
+ 239, 240, 244, 45, 92, 95, 196, 48, 57, 65, 90, 97,
170
+ 122, 197, 223, 224, 239, 240, 244, 45, 92, 95, 196, 48,
171
+ 57, 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40,
172
+ 45, 92, 95, 196, 48, 57, 65, 90, 97, 122, 197, 223,
173
+ 224, 239, 240, 244, 40, 45, 92, 95, 113, 118, 196, 48,
174
+ 57, 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40,
175
+ 45, 92, 95, 196, 48, 57, 65, 90, 97, 122, 197, 223,
176
+ 224, 239, 240, 244, 40, 45, 92, 95, 101, 196, 48, 57,
177
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45,
178
+ 92, 95, 110, 196, 48, 57, 65, 90, 97, 122, 197, 223,
179
+ 224, 239, 240, 244, 40, 45, 92, 95, 105, 196, 48, 57,
180
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45,
181
+ 92, 95, 114, 196, 48, 57, 65, 90, 97, 122, 197, 223,
182
+ 224, 239, 240, 244, 40, 45, 92, 95, 115, 196, 48, 57,
183
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45,
184
+ 92, 95, 116, 196, 48, 57, 65, 90, 97, 122, 197, 223,
185
+ 224, 239, 240, 244, 40, 45, 92, 95, 196, 48, 57, 65,
186
+ 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92,
187
+ 95, 99, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
188
+ 239, 240, 244, 40, 45, 92, 95, 104, 196, 48, 57, 65,
189
+ 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92,
190
+ 95, 105, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
191
+ 239, 240, 244, 40, 45, 92, 95, 108, 196, 48, 57, 65,
192
+ 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92,
193
+ 95, 100, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
194
+ 239, 240, 244, 40, 45, 92, 95, 196, 48, 57, 65, 90,
195
+ 97, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92, 95,
196
+ 116, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224, 239,
197
+ 240, 244, 40, 45, 92, 95, 97, 116, 196, 48, 57, 65,
198
+ 90, 98, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92,
199
+ 95, 116, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
200
+ 239, 240, 244, 40, 45, 92, 95, 104, 196, 48, 57, 65,
201
+ 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45, 92,
202
+ 95, 100, 110, 196, 48, 57, 65, 90, 97, 122, 197, 223,
203
+ 224, 239, 240, 244, 40, 45, 92, 95, 100, 196, 48, 57,
204
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45,
205
+ 92, 95, 108, 196, 48, 57, 65, 90, 97, 122, 197, 223,
206
+ 224, 239, 240, 244, 40, 45, 92, 95, 121, 196, 48, 57,
207
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 40, 45,
208
+ 92, 95, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
209
+ 239, 240, 244, 34, 39, 45, 92, 95, 118, 196, 48, 57,
210
+ 65, 90, 97, 122, 197, 223, 224, 239, 240, 244, 45, 92,
211
+ 95, 101, 196, 48, 57, 65, 90, 97, 122, 197, 223, 224,
212
+ 239, 240, 244, 45, 92, 95, 196, 48, 57, 65, 90, 97,
213
+ 122, 197, 223, 224, 239, 240, 244, 45, 92, 95, 100, 196,
214
+ 48, 57, 65, 90, 97, 122, 197, 223, 224, 239, 240, 244,
215
+ 45, 92, 95, 196, 48, 57, 65, 90, 97, 122, 197, 223,
216
+ 224, 239, 240, 244, 0
217
+ };
218
+ }
219
+
220
+ private static final char _hpricot_css_trans_keys[] = init__hpricot_css_trans_keys_0();
221
+
222
+
223
+ private static byte[] init__hpricot_css_single_lengths_0()
224
+ {
225
+ return new byte [] {
226
+ 0, 2, 4, 1, 0, 0, 0, 0, 1, 0, 0, 0,
227
+ 0, 4, 1, 0, 0, 0, 0, 10, 4, 3, 3, 1,
228
+ 1, 1, 1, 2, 4, 4, 1, 1, 1, 2, 1, 1,
229
+ 2, 1, 0, 0, 0, 0, 4, 3, 9, 6, 4, 4,
230
+ 4, 3, 4, 4, 5, 6, 1, 4, 1, 4, 2, 1,
231
+ 1, 2, 1, 2, 5, 4, 2, 1, 1, 1, 0, 1,
232
+ 0, 1, 7, 7, 7, 6, 9, 5, 2, 1, 1, 1,
233
+ 1, 0, 0, 16, 2, 1, 4, 3, 6, 4, 4, 5,
234
+ 7, 5, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6,
235
+ 6, 6, 5, 6, 7, 6, 6, 7, 6, 6, 6, 5,
236
+ 1, 1, 5, 5, 4, 5, 4
237
+ };
238
+ }
239
+
240
+ private static final byte _hpricot_css_single_lengths[] = init__hpricot_css_single_lengths_0();
241
+
242
+
243
+ private static byte[] init__hpricot_css_range_lengths_0()
244
+ {
245
+ return new byte [] {
246
+ 0, 1, 6, 0, 1, 1, 1, 1, 0, 1, 1, 1,
247
+ 1, 6, 0, 1, 1, 1, 1, 6, 0, 0, 0, 1,
248
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
249
+ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
250
+ 0, 0, 0, 0, 6, 7, 0, 1, 0, 1, 0, 0,
251
+ 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1,
252
+ 1, 0, 7, 7, 7, 7, 7, 6, 0, 1, 1, 1,
253
+ 1, 1, 1, 7, 1, 1, 6, 1, 6, 6, 6, 6,
254
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
255
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
256
+ 0, 0, 6, 6, 6, 6, 6
257
+ };
258
+ }
259
+
260
+ private static final byte _hpricot_css_range_lengths[] = init__hpricot_css_range_lengths_0();
261
+
262
+
263
+ private static short[] init__hpricot_css_index_offsets_0()
264
+ {
265
+ return new short [] {
266
+ 0, 0, 4, 15, 17, 19, 21, 23, 25, 27, 29, 31,
267
+ 33, 35, 46, 48, 50, 52, 54, 56, 73, 78, 82, 86,
268
+ 89, 91, 93, 95, 98, 103, 108, 111, 113, 115, 118, 120,
269
+ 122, 125, 127, 129, 131, 133, 135, 141, 146, 157, 165, 170,
270
+ 175, 180, 184, 189, 194, 206, 220, 222, 228, 230, 236, 239,
271
+ 241, 243, 246, 248, 252, 259, 265, 268, 271, 274, 277, 279,
272
+ 282, 284, 286, 301, 316, 331, 345, 362, 374, 377, 380, 383,
273
+ 386, 389, 391, 393, 417, 421, 424, 435, 440, 453, 464, 475,
274
+ 487, 501, 513, 526, 539, 552, 565, 578, 591, 603, 616, 629,
275
+ 642, 655, 668, 680, 693, 707, 720, 733, 747, 760, 773, 786,
276
+ 798, 800, 802, 814, 826, 837, 849
277
+ };
278
+ }
279
+
280
+ private static final short _hpricot_css_index_offsets[] = init__hpricot_css_index_offsets_0();
281
+
282
+
283
+ private static byte[] init__hpricot_css_trans_targs_0()
284
+ {
285
+ return new byte [] {
286
+ 1, 89, 1, 87, 90, 3, 90, 4, 90, 90, 90, 5,
287
+ 6, 7, 0, 90, 87, 90, 87, 90, 87, 5, 87, 6,
288
+ 87, 93, 87, 93, 87, 93, 87, 10, 87, 11, 87, 94,
289
+ 14, 94, 15, 94, 94, 94, 16, 17, 18, 0, 94, 87,
290
+ 94, 87, 94, 87, 16, 87, 17, 87, 95, 37, 95, 96,
291
+ 100, 111, 112, 113, 115, 38, 95, 95, 95, 39, 40, 41,
292
+ 0, 22, 28, 34, 87, 21, 87, 87, 87, 21, 24, 25,
293
+ 87, 23, 24, 87, 23, 87, 87, 87, 26, 27, 26, 24,
294
+ 25, 87, 30, 21, 31, 87, 29, 30, 21, 87, 87, 29,
295
+ 24, 87, 30, 87, 32, 33, 32, 24, 31, 87, 87, 35,
296
+ 36, 35, 34, 87, 87, 95, 87, 95, 87, 95, 87, 39,
297
+ 87, 40, 87, 22, 28, 34, 87, 43, 21, 87, 87, 87,
298
+ 43, 21, 22, 28, 34, 87, 45, 45, 46, 45, 50, 45,
299
+ 21, 87, 87, 87, 45, 45, 45, 45, 21, 87, 87, 87,
300
+ 47, 21, 87, 87, 87, 48, 21, 87, 87, 87, 49, 21,
301
+ 87, 87, 87, 21, 87, 87, 87, 51, 21, 87, 87, 87,
302
+ 49, 21, 53, 73, 53, 74, 85, 53, 53, 53, 70, 72,
303
+ 86, 0, 63, 53, 64, 66, 53, 67, 63, 53, 53, 53,
304
+ 68, 69, 71, 54, 55, 0, 57, 58, 61, 0, 57, 56,
305
+ 87, 56, 57, 58, 61, 87, 57, 56, 56, 120, 58, 60,
306
+ 59, 87, 87, 56, 121, 61, 60, 62, 63, 64, 63, 54,
307
+ 57, 58, 61, 65, 0, 57, 56, 57, 58, 61, 87, 57,
308
+ 56, 53, 55, 0, 55, 53, 0, 55, 53, 0, 55, 70,
309
+ 0, 53, 0, 55, 72, 0, 70, 0, 53, 0, 63, 53,
310
+ 64, 66, 53, 75, 67, 63, 53, 53, 53, 68, 69, 71,
311
+ 54, 63, 53, 64, 66, 53, 76, 67, 63, 53, 53, 53,
312
+ 68, 69, 71, 54, 63, 53, 64, 66, 53, 77, 67, 63,
313
+ 53, 53, 53, 68, 69, 71, 54, 63, 53, 78, 66, 53,
314
+ 67, 63, 53, 53, 53, 68, 69, 71, 54, 57, 58, 61,
315
+ 79, 65, 80, 0, 79, 81, 57, 79, 79, 79, 82, 83,
316
+ 84, 56, 79, 80, 87, 79, 81, 79, 79, 79, 82, 83,
317
+ 84, 56, 79, 87, 56, 87, 79, 56, 87, 79, 56, 87,
318
+ 82, 56, 87, 83, 56, 53, 0, 72, 0, 88, 2, 91,
319
+ 89, 92, 13, 19, 87, 52, 8, 93, 122, 92, 125, 87,
320
+ 9, 88, 92, 93, 93, 10, 11, 12, 0, 1, 89, 1,
321
+ 87, 89, 89, 87, 90, 3, 90, 4, 90, 90, 90, 5,
322
+ 6, 7, 87, 91, 91, 91, 91, 87, 91, 92, 8, 93,
323
+ 92, 9, 92, 93, 93, 10, 11, 12, 87, 93, 8, 93,
324
+ 9, 93, 93, 93, 10, 11, 12, 87, 94, 14, 94, 15,
325
+ 94, 94, 94, 16, 17, 18, 87, 20, 95, 37, 95, 38,
326
+ 95, 95, 95, 39, 40, 41, 87, 20, 95, 37, 95, 97,
327
+ 98, 38, 95, 95, 95, 39, 40, 41, 87, 42, 95, 37,
328
+ 95, 38, 95, 95, 95, 39, 40, 41, 87, 20, 95, 37,
329
+ 95, 99, 38, 95, 95, 95, 39, 40, 41, 87, 20, 95,
330
+ 37, 95, 97, 38, 95, 95, 95, 39, 40, 41, 87, 20,
331
+ 95, 37, 95, 101, 38, 95, 95, 95, 39, 40, 41, 87,
332
+ 20, 95, 37, 95, 102, 38, 95, 95, 95, 39, 40, 41,
333
+ 87, 20, 95, 37, 95, 103, 38, 95, 95, 95, 39, 40,
334
+ 41, 87, 20, 95, 37, 95, 104, 38, 95, 95, 95, 39,
335
+ 40, 41, 87, 42, 105, 37, 95, 38, 95, 95, 95, 39,
336
+ 40, 41, 87, 20, 95, 37, 95, 106, 38, 95, 95, 95,
337
+ 39, 40, 41, 87, 20, 95, 37, 95, 107, 38, 95, 95,
338
+ 95, 39, 40, 41, 87, 20, 95, 37, 95, 108, 38, 95,
339
+ 95, 95, 39, 40, 41, 87, 20, 95, 37, 95, 109, 38,
340
+ 95, 95, 95, 39, 40, 41, 87, 20, 95, 37, 95, 110,
341
+ 38, 95, 95, 95, 39, 40, 41, 87, 44, 95, 37, 95,
342
+ 38, 95, 95, 95, 39, 40, 41, 87, 20, 95, 37, 95,
343
+ 97, 38, 95, 95, 95, 39, 40, 41, 87, 20, 95, 37,
344
+ 95, 102, 97, 38, 95, 95, 95, 39, 40, 41, 87, 20,
345
+ 95, 37, 95, 114, 38, 95, 95, 95, 39, 40, 41, 87,
346
+ 20, 95, 37, 95, 104, 38, 95, 95, 95, 39, 40, 41,
347
+ 87, 20, 95, 37, 95, 116, 117, 38, 95, 95, 95, 39,
348
+ 40, 41, 87, 20, 95, 37, 95, 97, 38, 95, 95, 95,
349
+ 39, 40, 41, 87, 20, 95, 37, 95, 118, 38, 95, 95,
350
+ 95, 39, 40, 41, 87, 20, 95, 37, 95, 119, 38, 95,
351
+ 95, 95, 39, 40, 41, 87, 20, 105, 37, 95, 38, 95,
352
+ 95, 95, 39, 40, 41, 87, 60, 59, 60, 62, 93, 8,
353
+ 93, 123, 9, 93, 93, 93, 10, 11, 12, 87, 93, 8,
354
+ 93, 124, 9, 93, 93, 93, 10, 11, 12, 87, 93, 8,
355
+ 93, 9, 93, 93, 93, 10, 11, 12, 87, 93, 8, 93,
356
+ 126, 9, 93, 93, 93, 10, 11, 12, 87, 93, 8, 93,
357
+ 9, 93, 93, 93, 10, 11, 12, 87, 87, 87, 87, 87,
358
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
359
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
360
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
361
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
362
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
363
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
364
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
365
+ 87, 87, 0
366
+ };
367
+ }
368
+
369
+ private static final byte _hpricot_css_trans_targs[] = init__hpricot_css_trans_targs_0();
370
+
371
+
372
+ private static byte[] init__hpricot_css_trans_actions_0()
373
+ {
374
+ return new byte [] {
375
+ 0, 0, 0, 33, 99, 1, 99, 1, 99, 99, 99, 1,
376
+ 1, 1, 0, 73, 35, 73, 35, 73, 35, 0, 35, 0,
377
+ 35, 79, 35, 79, 35, 79, 35, 0, 35, 0, 35, 103,
378
+ 1, 103, 1, 103, 103, 103, 1, 1, 1, 0, 76, 35,
379
+ 76, 35, 76, 35, 0, 35, 0, 35, 111, 1, 111, 111,
380
+ 111, 111, 111, 111, 111, 1, 111, 111, 111, 1, 1, 1,
381
+ 0, 1, 1, 1, 95, 1, 35, 35, 49, 0, 0, 0,
382
+ 35, 0, 0, 35, 0, 49, 35, 35, 0, 0, 0, 0,
383
+ 0, 35, 0, 0, 0, 49, 0, 0, 0, 35, 49, 0,
384
+ 0, 35, 0, 35, 0, 0, 0, 0, 0, 35, 35, 0,
385
+ 0, 0, 0, 49, 35, 88, 35, 88, 35, 88, 35, 0,
386
+ 35, 0, 35, 1, 1, 1, 95, 1, 1, 29, 29, 46,
387
+ 0, 0, 1, 1, 1, 91, 1, 1, 1, 1, 1, 1,
388
+ 1, 27, 27, 43, 0, 0, 0, 0, 0, 27, 27, 49,
389
+ 0, 0, 27, 27, 49, 0, 0, 27, 27, 49, 0, 0,
390
+ 27, 27, 43, 0, 27, 27, 49, 0, 0, 27, 27, 49,
391
+ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392
+ 1, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
393
+ 5, 5, 5, 5, 0, 0, 7, 7, 7, 0, 7, 7,
394
+ 13, 0, 0, 0, 0, 13, 0, 0, 0, 11, 0, 0,
395
+ 0, 13, 25, 0, 11, 0, 0, 0, 0, 0, 0, 0,
396
+ 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 13, 7,
397
+ 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
398
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5,
399
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
400
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
401
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
402
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
403
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7,
404
+ 37, 7, 37, 0, 37, 37, 7, 37, 37, 37, 37, 37,
405
+ 37, 7, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0,
406
+ 0, 0, 0, 13, 0, 13, 0, 0, 13, 0, 0, 13,
407
+ 0, 0, 13, 0, 0, 0, 0, 0, 0, 11, 0, 0,
408
+ 0, 107, 0, 0, 15, 0, 1, 107, 107, 107, 107, 15,
409
+ 1, 11, 107, 107, 107, 1, 1, 1, 0, 0, 0, 0,
410
+ 23, 0, 0, 21, 73, 0, 73, 0, 73, 73, 73, 0,
411
+ 0, 0, 52, 0, 0, 0, 0, 19, 3, 79, 0, 79,
412
+ 79, 0, 79, 79, 79, 0, 0, 0, 58, 79, 0, 79,
413
+ 0, 79, 79, 79, 0, 0, 0, 58, 76, 0, 76, 0,
414
+ 76, 76, 76, 0, 0, 0, 55, 3, 88, 0, 88, 0,
415
+ 88, 88, 88, 0, 0, 0, 67, 3, 88, 0, 88, 85,
416
+ 88, 0, 88, 88, 88, 0, 0, 0, 67, 3, 115, 3,
417
+ 115, 3, 115, 115, 115, 3, 3, 3, 64, 3, 88, 0,
418
+ 88, 88, 0, 88, 88, 88, 0, 0, 0, 67, 3, 88,
419
+ 0, 88, 85, 0, 88, 88, 88, 0, 0, 0, 67, 3,
420
+ 88, 0, 88, 88, 0, 88, 88, 88, 0, 0, 0, 67,
421
+ 3, 88, 0, 88, 88, 0, 88, 88, 88, 0, 0, 0,
422
+ 67, 3, 88, 0, 88, 88, 0, 88, 88, 88, 0, 0,
423
+ 0, 67, 3, 88, 0, 88, 85, 0, 88, 88, 88, 0,
424
+ 0, 0, 67, 3, 115, 3, 115, 3, 115, 115, 115, 3,
425
+ 3, 3, 64, 3, 88, 0, 88, 88, 0, 88, 88, 88,
426
+ 0, 0, 0, 67, 3, 88, 0, 88, 88, 0, 88, 88,
427
+ 88, 0, 0, 0, 67, 3, 88, 0, 88, 88, 0, 88,
428
+ 88, 88, 0, 0, 0, 67, 3, 88, 0, 88, 88, 0,
429
+ 88, 88, 88, 0, 0, 0, 67, 3, 88, 0, 88, 82,
430
+ 0, 88, 88, 88, 0, 0, 0, 67, 3, 115, 3, 115,
431
+ 3, 115, 115, 115, 3, 3, 3, 61, 3, 88, 0, 88,
432
+ 85, 0, 88, 88, 88, 0, 0, 0, 67, 3, 88, 0,
433
+ 88, 88, 85, 0, 88, 88, 88, 0, 0, 0, 67, 3,
434
+ 88, 0, 88, 88, 0, 88, 88, 88, 0, 0, 0, 67,
435
+ 3, 88, 0, 88, 85, 0, 88, 88, 88, 0, 0, 0,
436
+ 67, 3, 88, 0, 88, 88, 88, 0, 88, 88, 88, 0,
437
+ 0, 0, 67, 3, 88, 0, 88, 85, 0, 88, 88, 88,
438
+ 0, 0, 0, 67, 3, 88, 0, 88, 88, 0, 88, 88,
439
+ 88, 0, 0, 0, 67, 3, 88, 0, 88, 88, 0, 88,
440
+ 88, 88, 0, 0, 0, 67, 3, 88, 0, 88, 0, 88,
441
+ 88, 88, 0, 0, 0, 67, 0, 0, 0, 0, 79, 0,
442
+ 79, 79, 0, 79, 79, 79, 0, 0, 0, 58, 79, 0,
443
+ 79, 79, 0, 79, 79, 79, 0, 0, 0, 58, 79, 0,
444
+ 79, 0, 79, 79, 79, 0, 0, 0, 58, 79, 0, 79,
445
+ 79, 0, 79, 79, 79, 0, 0, 0, 58, 79, 0, 79,
446
+ 0, 79, 79, 79, 0, 0, 0, 58, 33, 35, 35, 35,
447
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
448
+ 31, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
449
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 29, 29,
450
+ 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 25, 23,
451
+ 21, 52, 19, 58, 58, 55, 67, 67, 64, 67, 67, 67,
452
+ 67, 67, 67, 64, 67, 67, 67, 67, 67, 61, 67, 67,
453
+ 67, 67, 67, 67, 67, 67, 67, 17, 17, 58, 58, 58,
454
+ 58, 58, 0
455
+ };
456
+ }
457
+
458
+ private static final byte _hpricot_css_trans_actions[] = init__hpricot_css_trans_actions_0();
459
+
460
+
461
+ private static byte[] init__hpricot_css_to_state_actions_0()
462
+ {
463
+ return new byte [] {
464
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
465
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
466
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
467
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
468
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
469
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
470
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
471
+ 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0,
472
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
473
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
474
+ 0, 0, 0, 0, 0, 0, 0
475
+ };
476
+ }
477
+
478
+ private static final byte _hpricot_css_to_state_actions[] = init__hpricot_css_to_state_actions_0();
479
+
480
+
481
+ private static byte[] init__hpricot_css_from_state_actions_0()
482
+ {
483
+ return new byte [] {
484
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
485
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
486
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
487
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
488
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
489
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
490
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
491
+ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
492
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
493
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
494
+ 0, 0, 0, 0, 0, 0, 0
495
+ };
496
+ }
497
+
498
+ private static final byte _hpricot_css_from_state_actions[] = init__hpricot_css_from_state_actions_0();
499
+
500
+
501
+ private static short[] init__hpricot_css_eof_trans_0()
502
+ {
503
+ return new short [] {
504
+ 0, 861, 0, 898, 898, 898, 898, 898, 898, 898, 898, 898,
505
+ 898, 0, 898, 898, 898, 898, 898, 0, 877, 898, 898, 898,
506
+ 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, 898,
507
+ 898, 898, 898, 898, 898, 898, 900, 900, 908, 908, 908, 908,
508
+ 908, 908, 908, 908, 0, 0, 0, 0, 0, 0, 0, 911,
509
+ 911, 0, 911, 0, 0, 0, 0, 0, 0, 0, 0, 0,
510
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
511
+ 0, 0, 0, 0, 912, 913, 914, 915, 950, 950, 918, 943,
512
+ 943, 928, 943, 943, 943, 943, 943, 943, 928, 943, 943, 943,
513
+ 943, 943, 934, 943, 943, 943, 943, 943, 943, 943, 943, 943,
514
+ 945, 945, 950, 950, 950, 950, 950
515
+ };
516
+ }
517
+
518
+ private static final short _hpricot_css_eof_trans[] = init__hpricot_css_eof_trans_0();
519
+
520
+
521
+ static final int hpricot_css_start = 87;
522
+ static final int hpricot_css_error = 0;
523
+
524
+ static final int hpricot_css_en_main = 87;
525
+
526
+
527
+ // line 147 "hpricot_css.java.rl"
528
+
529
+
530
+ public IRubyObject scan() {
531
+
532
+ // line 533 "HpricotCss.java"
533
+ {
534
+ cs = hpricot_css_start;
535
+ ts = -1;
536
+ te = -1;
537
+ act = 0;
538
+ }
539
+
540
+ // line 151 "hpricot_css.java.rl"
541
+
542
+ // line 543 "HpricotCss.java"
543
+ {
544
+ int _klen;
545
+ int _trans = 0;
546
+ int _acts;
547
+ int _nacts;
548
+ int _keys;
549
+ int _goto_targ = 0;
550
+
551
+ _goto: while (true) {
552
+ switch ( _goto_targ ) {
553
+ case 0:
554
+ if ( p == pe ) {
555
+ _goto_targ = 4;
556
+ continue _goto;
557
+ }
558
+ if ( cs == 0 ) {
559
+ _goto_targ = 5;
560
+ continue _goto;
561
+ }
562
+ case 1:
563
+ _acts = _hpricot_css_from_state_actions[cs];
564
+ _nacts = (int) _hpricot_css_actions[_acts++];
565
+ while ( _nacts-- > 0 ) {
566
+ switch ( _hpricot_css_actions[_acts++] ) {
567
+ case 6:
568
+ // line 1 "NONE"
569
+ {ts = p;}
570
+ break;
571
+ // line 572 "HpricotCss.java"
572
+ }
573
+ }
574
+
575
+ _match: do {
576
+ _keys = _hpricot_css_key_offsets[cs];
577
+ _trans = _hpricot_css_index_offsets[cs];
578
+ _klen = _hpricot_css_single_lengths[cs];
579
+ if ( _klen > 0 ) {
580
+ int _lower = _keys;
581
+ int _mid;
582
+ int _upper = _keys + _klen - 1;
583
+ while (true) {
584
+ if ( _upper < _lower )
585
+ break;
586
+
587
+ _mid = _lower + ((_upper-_lower) >> 1);
588
+ if ( data[p] < _hpricot_css_trans_keys[_mid] )
589
+ _upper = _mid - 1;
590
+ else if ( data[p] > _hpricot_css_trans_keys[_mid] )
591
+ _lower = _mid + 1;
592
+ else {
593
+ _trans += (_mid - _keys);
594
+ break _match;
595
+ }
596
+ }
597
+ _keys += _klen;
598
+ _trans += _klen;
599
+ }
600
+
601
+ _klen = _hpricot_css_range_lengths[cs];
602
+ if ( _klen > 0 ) {
603
+ int _lower = _keys;
604
+ int _mid;
605
+ int _upper = _keys + (_klen<<1) - 2;
606
+ while (true) {
607
+ if ( _upper < _lower )
608
+ break;
609
+
610
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
611
+ if ( data[p] < _hpricot_css_trans_keys[_mid] )
612
+ _upper = _mid - 2;
613
+ else if ( data[p] > _hpricot_css_trans_keys[_mid+1] )
614
+ _lower = _mid + 2;
615
+ else {
616
+ _trans += ((_mid - _keys)>>1);
617
+ break _match;
618
+ }
619
+ }
620
+ _trans += _klen;
621
+ }
622
+ } while (false);
623
+
624
+ case 3:
625
+ cs = _hpricot_css_trans_targs[_trans];
626
+
627
+ if ( _hpricot_css_trans_actions[_trans] != 0 ) {
628
+ _acts = _hpricot_css_trans_actions[_trans];
629
+ _nacts = (int) _hpricot_css_actions[_acts++];
630
+ while ( _nacts-- > 0 )
631
+ {
632
+ switch ( _hpricot_css_actions[_acts++] )
633
+ {
634
+ case 0:
635
+ // line 85 "hpricot_css.java.rl"
636
+ {
637
+ aps = p;
638
+ }
639
+ break;
640
+ case 1:
641
+ // line 89 "hpricot_css.java.rl"
642
+ {
643
+ ape = p;
644
+ PUSH(aps, ape);
645
+ }
646
+ break;
647
+ case 2:
648
+ // line 94 "hpricot_css.java.rl"
649
+ {
650
+ ape = p;
651
+ aps2 = p;
652
+ }
653
+ break;
654
+ case 3:
655
+ // line 99 "hpricot_css.java.rl"
656
+ {
657
+ ape2 = p;
658
+ PUSH(aps, ape);
659
+ PUSH(aps2, ape2);
660
+ }
661
+ break;
662
+ case 7:
663
+ // line 1 "NONE"
664
+ {te = p+1;}
665
+ break;
666
+ case 8:
667
+ // line 132 "hpricot_css.java.rl"
668
+ {act = 1;}
669
+ break;
670
+ case 9:
671
+ // line 133 "hpricot_css.java.rl"
672
+ {act = 2;}
673
+ break;
674
+ case 10:
675
+ // line 136 "hpricot_css.java.rl"
676
+ {act = 5;}
677
+ break;
678
+ case 11:
679
+ // line 138 "hpricot_css.java.rl"
680
+ {act = 7;}
681
+ break;
682
+ case 12:
683
+ // line 139 "hpricot_css.java.rl"
684
+ {act = 8;}
685
+ break;
686
+ case 13:
687
+ // line 140 "hpricot_css.java.rl"
688
+ {act = 9;}
689
+ break;
690
+ case 14:
691
+ // line 134 "hpricot_css.java.rl"
692
+ {te = p+1;{ FILTER("NAME"); }}
693
+ break;
694
+ case 15:
695
+ // line 135 "hpricot_css.java.rl"
696
+ {te = p+1;{ FILTER("ATTR"); }}
697
+ break;
698
+ case 16:
699
+ // line 138 "hpricot_css.java.rl"
700
+ {te = p+1;{ FILTER("CHILD"); }}
701
+ break;
702
+ case 17:
703
+ // line 139 "hpricot_css.java.rl"
704
+ {te = p+1;{ FILTER("POS"); }}
705
+ break;
706
+ case 18:
707
+ // line 140 "hpricot_css.java.rl"
708
+ {te = p+1;{ FILTER("PSUEDO"); }}
709
+ break;
710
+ case 19:
711
+ // line 142 "hpricot_css.java.rl"
712
+ {te = p+1;{ FILTERAUTO(); }}
713
+ break;
714
+ case 20:
715
+ // line 132 "hpricot_css.java.rl"
716
+ {te = p;p--;{ FILTER("ID"); }}
717
+ break;
718
+ case 21:
719
+ // line 133 "hpricot_css.java.rl"
720
+ {te = p;p--;{ FILTER("CLASS"); }}
721
+ break;
722
+ case 22:
723
+ // line 135 "hpricot_css.java.rl"
724
+ {te = p;p--;{ FILTER("ATTR"); }}
725
+ break;
726
+ case 23:
727
+ // line 136 "hpricot_css.java.rl"
728
+ {te = p;p--;{ FILTER("TAG"); }}
729
+ break;
730
+ case 24:
731
+ // line 137 "hpricot_css.java.rl"
732
+ {te = p;p--;{ FILTER("MOD"); }}
733
+ break;
734
+ case 25:
735
+ // line 138 "hpricot_css.java.rl"
736
+ {te = p;p--;{ FILTER("CHILD"); }}
737
+ break;
738
+ case 26:
739
+ // line 139 "hpricot_css.java.rl"
740
+ {te = p;p--;{ FILTER("POS"); }}
741
+ break;
742
+ case 27:
743
+ // line 140 "hpricot_css.java.rl"
744
+ {te = p;p--;{ FILTER("PSUEDO"); }}
745
+ break;
746
+ case 28:
747
+ // line 141 "hpricot_css.java.rl"
748
+ {te = p;p--;{ focus = RubyArray.newArray(runtime, node); }}
749
+ break;
750
+ case 29:
751
+ // line 143 "hpricot_css.java.rl"
752
+ {te = p;p--;}
753
+ break;
754
+ case 30:
755
+ // line 135 "hpricot_css.java.rl"
756
+ {{p = ((te))-1;}{ FILTER("ATTR"); }}
757
+ break;
758
+ case 31:
759
+ // line 138 "hpricot_css.java.rl"
760
+ {{p = ((te))-1;}{ FILTER("CHILD"); }}
761
+ break;
762
+ case 32:
763
+ // line 139 "hpricot_css.java.rl"
764
+ {{p = ((te))-1;}{ FILTER("POS"); }}
765
+ break;
766
+ case 33:
767
+ // line 140 "hpricot_css.java.rl"
768
+ {{p = ((te))-1;}{ FILTER("PSUEDO"); }}
769
+ break;
770
+ case 34:
771
+ // line 143 "hpricot_css.java.rl"
772
+ {{p = ((te))-1;}}
773
+ break;
774
+ case 35:
775
+ // line 1 "NONE"
776
+ { switch( act ) {
777
+ case 0:
778
+ {{cs = 0; _goto_targ = 2; if (true) continue _goto;}}
779
+ break;
780
+ case 1:
781
+ {{p = ((te))-1;} FILTER("ID"); }
782
+ break;
783
+ case 2:
784
+ {{p = ((te))-1;} FILTER("CLASS"); }
785
+ break;
786
+ case 5:
787
+ {{p = ((te))-1;} FILTER("TAG"); }
788
+ break;
789
+ case 7:
790
+ {{p = ((te))-1;} FILTER("CHILD"); }
791
+ break;
792
+ case 8:
793
+ {{p = ((te))-1;} FILTER("POS"); }
794
+ break;
795
+ case 9:
796
+ {{p = ((te))-1;} FILTER("PSUEDO"); }
797
+ break;
798
+ }
799
+ }
800
+ break;
801
+ // line 802 "HpricotCss.java"
802
+ }
803
+ }
804
+ }
805
+
806
+ case 2:
807
+ _acts = _hpricot_css_to_state_actions[cs];
808
+ _nacts = (int) _hpricot_css_actions[_acts++];
809
+ while ( _nacts-- > 0 ) {
810
+ switch ( _hpricot_css_actions[_acts++] ) {
811
+ case 4:
812
+ // line 1 "NONE"
813
+ {ts = -1;}
814
+ break;
815
+ case 5:
816
+ // line 1 "NONE"
817
+ {act = 0;}
818
+ break;
819
+ // line 820 "HpricotCss.java"
820
+ }
821
+ }
822
+
823
+ if ( cs == 0 ) {
824
+ _goto_targ = 5;
825
+ continue _goto;
826
+ }
827
+ if ( ++p != pe ) {
828
+ _goto_targ = 1;
829
+ continue _goto;
830
+ }
831
+ case 4:
832
+ if ( p == eof )
833
+ {
834
+ if ( _hpricot_css_eof_trans[cs] > 0 ) {
835
+ _trans = _hpricot_css_eof_trans[cs] - 1;
836
+ _goto_targ = 3;
837
+ continue _goto;
838
+ }
839
+ }
840
+
841
+ case 5:
842
+ }
843
+ break; }
844
+ }
845
+
846
+ // line 152 "hpricot_css.java.rl"
847
+
848
+ return focus;
849
+ }
850
+ }