trenni 3.7.1 → 3.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/bake/trenni/entities.rb +57 -0
  3. data/bake/trenni/parsers.rb +66 -0
  4. data/ext/Rakefile +1 -0
  5. data/ext/tmp/x86_64-linux/lib/trenni/trenni.so +0 -0
  6. data/ext/tmp/x86_64-linux/trenni/2.4.0/Makefile +263 -0
  7. data/ext/tmp/x86_64-linux/trenni/2.4.0/escape.o +0 -0
  8. data/ext/tmp/x86_64-linux/trenni/2.4.0/markup.o +0 -0
  9. data/ext/tmp/x86_64-linux/trenni/2.4.0/mkmf.log +108 -0
  10. data/ext/tmp/x86_64-linux/trenni/2.4.0/tag.o +0 -0
  11. data/ext/tmp/x86_64-linux/trenni/2.4.0/template.o +0 -0
  12. data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.o +0 -0
  13. data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.so +0 -0
  14. data/ext/tmp/x86_64-linux/trenni/2.7.0/Makefile +266 -0
  15. data/ext/tmp/x86_64-linux/trenni/2.7.0/escape.o +0 -0
  16. data/ext/tmp/x86_64-linux/trenni/2.7.0/markup.o +0 -0
  17. data/ext/tmp/x86_64-linux/trenni/2.7.0/mkmf.log +113 -0
  18. data/ext/tmp/x86_64-linux/trenni/2.7.0/query.o +0 -0
  19. data/ext/tmp/x86_64-linux/trenni/2.7.0/tag.o +0 -0
  20. data/ext/tmp/x86_64-linux/trenni/2.7.0/template.o +0 -0
  21. data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.o +0 -0
  22. data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.so +0 -0
  23. data/ext/tmp/x86_64-linux/trenni/2.7.1/Makefile +266 -0
  24. data/ext/tmp/x86_64-linux/trenni/2.7.1/escape.o +0 -0
  25. data/ext/tmp/x86_64-linux/trenni/2.7.1/markup.o +0 -0
  26. data/ext/tmp/x86_64-linux/trenni/2.7.1/mkmf.log +113 -0
  27. data/ext/tmp/x86_64-linux/trenni/2.7.1/query.o +0 -0
  28. data/ext/tmp/x86_64-linux/trenni/2.7.1/tag.o +0 -0
  29. data/ext/tmp/x86_64-linux/trenni/2.7.1/template.o +0 -0
  30. data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.o +0 -0
  31. data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.so +0 -0
  32. data/ext/trenni/extconf.rb +1 -0
  33. data/ext/trenni/markup.c +85 -85
  34. data/ext/trenni/markup.rl +11 -11
  35. data/ext/trenni/query.c +619 -0
  36. data/ext/trenni/query.h +6 -0
  37. data/ext/trenni/query.rl +82 -0
  38. data/ext/trenni/tag.c +8 -6
  39. data/ext/trenni/template.c +57 -57
  40. data/ext/trenni/template.rl +4 -4
  41. data/ext/trenni/trenni.c +9 -1
  42. data/ext/trenni/trenni.h +8 -3
  43. data/lib/trenni.rb +4 -0
  44. data/lib/trenni/buffer.rb +2 -0
  45. data/lib/trenni/builder.rb +64 -12
  46. data/lib/trenni/entities.rb +2082 -2082
  47. data/lib/trenni/entities.trenni +1 -3
  48. data/lib/trenni/{parse_error.rb → error.rb} +6 -1
  49. data/lib/trenni/fallback/markup.rb +1623 -1575
  50. data/lib/trenni/fallback/markup.rl +3 -2
  51. data/lib/trenni/fallback/markup.rl.dot +278 -0
  52. data/lib/trenni/fallback/markup.rl.pdf +0 -0
  53. data/lib/trenni/fallback/query.rb +565 -0
  54. data/lib/trenni/fallback/query.rl +105 -0
  55. data/lib/trenni/fallback/query.rl.dot +54 -0
  56. data/lib/trenni/fallback/query.rl.pdf +0 -0
  57. data/lib/trenni/fallback/template.rb +756 -747
  58. data/lib/trenni/fallback/template.rl +1 -1
  59. data/lib/trenni/fallback/template.rl.dot +270 -0
  60. data/lib/trenni/fallback/template.rl.pdf +0 -0
  61. data/lib/trenni/markup.rb +2 -0
  62. data/lib/trenni/native.rb +3 -1
  63. data/lib/trenni/parse_delegate.rb +2 -0
  64. data/lib/trenni/parsers.rb +2 -0
  65. data/lib/trenni/query.rb +94 -0
  66. data/lib/trenni/reference.rb +125 -0
  67. data/lib/trenni/strings.rb +17 -4
  68. data/lib/trenni/tag.rb +2 -0
  69. data/lib/trenni/template.rb +25 -22
  70. data/lib/trenni/trenni.so +0 -0
  71. data/lib/trenni/uri.rb +3 -0
  72. data/lib/trenni/version.rb +3 -1
  73. data/parsers/trenni/query.rl +23 -0
  74. data/spec/spec_helper.rb +1 -0
  75. data/spec/trenni/builder_spec.rb +14 -1
  76. data/spec/trenni/corpus/large.rb +2 -0
  77. data/spec/trenni/markup_parser_spec.rb +1 -0
  78. data/spec/trenni/markup_performance_spec.rb +15 -2
  79. data/spec/trenni/markup_spec.rb +1 -0
  80. data/spec/trenni/parsers_performance_spec.rb +32 -0
  81. data/spec/trenni/query_spec.rb +51 -0
  82. data/spec/trenni/reference_spec.rb +87 -0
  83. data/spec/trenni/strings_spec.rb +1 -0
  84. data/spec/trenni/tag_spec.rb +2 -0
  85. data/spec/trenni/template_error_spec.rb +1 -0
  86. data/spec/trenni/template_performance_spec.rb +1 -0
  87. data/spec/trenni/template_spec.rb +1 -0
  88. data/spec/trenni/template_spec/builder.trenni +2 -2
  89. data/spec/trenni/uri_spec.rb +1 -0
  90. metadata +95 -62
  91. data/.gitignore +0 -19
  92. data/.rspec +0 -5
  93. data/.simplecov +0 -9
  94. data/.travis.yml +0 -23
  95. data/Gemfile +0 -20
  96. data/README.md +0 -312
  97. data/Rakefile +0 -19
  98. data/benchmark/call_vs_yield.rb +0 -51
  99. data/benchmark/interpolation_vs_concat.rb +0 -29
  100. data/benchmark/io_vs_string.rb +0 -90
  101. data/entities.json +0 -2233
  102. data/tasks/entities.rake +0 -33
  103. data/tasks/parsers.rake +0 -43
  104. data/trenni.gemspec +0 -33
@@ -199,14 +199,14 @@
199
199
  action cdata_error {
200
200
  raise ParseError.new("could not parse cdata", buffer, p)
201
201
  }
202
-
202
+
203
203
  # This magic ensures that we process bytes.
204
204
  getkey bytes[p];
205
205
 
206
206
  include markup "trenni/markup.rl";
207
207
  }%%
208
208
 
209
- require_relative '../parse_error'
209
+ require_relative '../error'
210
210
 
211
211
  module Trenni
212
212
  module Fallback
@@ -214,6 +214,7 @@ module Trenni
214
214
 
215
215
  def self.parse_markup(buffer, delegate, entities)
216
216
  data = buffer.read
217
+ encoding = buffer.encoding
217
218
  bytes = data.bytes
218
219
 
219
220
  p = 0
@@ -0,0 +1,278 @@
1
+ digraph markup {
2
+ rankdir=LR;
3
+ node [ shape = point ];
4
+ ENTRY;
5
+ en_42;
6
+ en_48;
7
+ eof_1;
8
+ eof_2;
9
+ eof_3;
10
+ eof_4;
11
+ eof_5;
12
+ eof_6;
13
+ eof_7;
14
+ eof_8;
15
+ eof_9;
16
+ eof_10;
17
+ eof_11;
18
+ eof_12;
19
+ eof_13;
20
+ eof_14;
21
+ eof_17;
22
+ eof_18;
23
+ eof_19;
24
+ eof_26;
25
+ eof_33;
26
+ eof_34;
27
+ eof_35;
28
+ eof_36;
29
+ eof_37;
30
+ eof_38;
31
+ eof_39;
32
+ eof_40;
33
+ eof_41;
34
+ eof_42;
35
+ eof_43;
36
+ eof_44;
37
+ eof_45;
38
+ eof_46;
39
+ eof_47;
40
+ eof_49;
41
+ eof_50;
42
+ eof_51;
43
+ eof_52;
44
+ eof_53;
45
+ eof_54;
46
+ eof_55;
47
+ eof_56;
48
+ node [ shape = circle, height = 0.2 ];
49
+ err_1 [ label=""];
50
+ err_2 [ label=""];
51
+ err_3 [ label=""];
52
+ err_4 [ label=""];
53
+ err_5 [ label=""];
54
+ err_6 [ label=""];
55
+ err_7 [ label=""];
56
+ err_8 [ label=""];
57
+ err_9 [ label=""];
58
+ err_10 [ label=""];
59
+ err_11 [ label=""];
60
+ err_12 [ label=""];
61
+ err_13 [ label=""];
62
+ err_14 [ label=""];
63
+ err_36 [ label=""];
64
+ err_37 [ label=""];
65
+ err_38 [ label=""];
66
+ err_39 [ label=""];
67
+ err_42 [ label=""];
68
+ err_43 [ label=""];
69
+ err_44 [ label=""];
70
+ err_45 [ label=""];
71
+ err_46 [ label=""];
72
+ err_47 [ label=""];
73
+ node [ fixedsize = true, height = 0.65, shape = doublecircle ];
74
+ 48;
75
+ 49;
76
+ 50;
77
+ 51;
78
+ 52;
79
+ 53;
80
+ 54;
81
+ 55;
82
+ 56;
83
+ 57;
84
+ node [ shape = circle ];
85
+ 1 -> err_1 [ label = "0..SP, '\"'..',', ';'..'>', '@', '['..'^', '`', '{'..127 / tag_error" ];
86
+ 1 -> 15 [ label = "'!'" ];
87
+ 1 -> 36 [ label = "'/'" ];
88
+ 1 -> 38 [ label = "'?'" ];
89
+ 1 -> 2 [ label = "DEF / identifier_begin" ];
90
+ 2 -> err_2 [ label = "0..'\\b', 14..31, '!'..',', ';'..'=', '?'..'@', '['..'^', '`', '{'..127 / tag_error" ];
91
+ 2 -> 3 [ label = "'\\t'..'\\r', SP / identifier_end, tag_name" ];
92
+ 2 -> 5 [ label = "'/' / identifier_end, tag_name, tag_self_closing" ];
93
+ 2 -> 51 [ label = "'>' / identifier_end, tag_name" ];
94
+ 2 -> 2 [ label = "DEF" ];
95
+ 3 -> err_3 [ label = "0..'\\b', 14..31, '!'..',', ';'..'=', '?'..'@', '['..'^', '`', '{'..127 / tag_error" ];
96
+ 3 -> 3 [ label = "'\\t'..'\\r', SP" ];
97
+ 3 -> 5 [ label = "'/' / tag_self_closing" ];
98
+ 3 -> 51 [ label = "'>'" ];
99
+ 3 -> 4 [ label = "DEF / attribute_begin, identifier_begin" ];
100
+ 4 -> err_4 [ label = "0..'\\b', 14..31, '!'..',', ';'..'<', '?'..'@', '['..'^', '`', '{'..127 / tag_error" ];
101
+ 4 -> 3 [ label = "'\\t'..'\\r', SP / identifier_end, attribute" ];
102
+ 4 -> 5 [ label = "'/' / identifier_end, attribute, tag_self_closing" ];
103
+ 4 -> 6 [ label = "'=' / identifier_end" ];
104
+ 4 -> 51 [ label = "'>' / identifier_end, attribute" ];
105
+ 4 -> 4 [ label = "DEF" ];
106
+ 5 -> 51 [ label = "'>'" ];
107
+ 5 -> err_5 [ label = "DEF / tag_error" ];
108
+ 6 -> 7 [ label = "'\"'" ];
109
+ 6 -> 12 [ label = "'''" ];
110
+ 6 -> err_6 [ label = "DEF / tag_error" ];
111
+ 7 -> 11 [ label = "'\"'" ];
112
+ 7 -> 10 [ label = "'&' / pcdata_begin, 10:16" ];
113
+ 7 -> err_7 [ label = "'<' / tag_error" ];
114
+ 7 -> 8 [ label = "DEF / pcdata_begin, characters_begin" ];
115
+ 8 -> 9 [ label = "'\"' / characters_end, pcdata_end" ];
116
+ 8 -> 10 [ label = "'&' / characters_end, 10:16" ];
117
+ 8 -> err_8 [ label = "'<' / tag_error" ];
118
+ 8 -> 8 [ label = "DEF" ];
119
+ 9 -> 3 [ label = "'\\t'..'\\r', SP / attribute_value, attribute" ];
120
+ 9 -> 5 [ label = "'/' / attribute_value, attribute, tag_self_closing" ];
121
+ 9 -> 51 [ label = "'>' / attribute_value, attribute" ];
122
+ 9 -> err_9 [ label = "DEF / tag_error" ];
123
+ 10 -> 9 [ label = "'\"' / pcdata_end" ];
124
+ 10 -> 10 [ label = "'&' / 10:16" ];
125
+ 10 -> err_10 [ label = "'<' / tag_error" ];
126
+ 10 -> 8 [ label = "DEF / characters_begin" ];
127
+ 11 -> 3 [ label = "'\\t'..'\\r', SP / attribute_empty, attribute" ];
128
+ 11 -> 5 [ label = "'/' / attribute_empty, attribute, tag_self_closing" ];
129
+ 11 -> 51 [ label = "'>' / attribute_empty, attribute" ];
130
+ 11 -> err_11 [ label = "DEF / tag_error" ];
131
+ 12 -> 14 [ label = "'&' / pcdata_begin, 10:16" ];
132
+ 12 -> 11 [ label = "'''" ];
133
+ 12 -> err_12 [ label = "'<' / tag_error" ];
134
+ 12 -> 13 [ label = "DEF / pcdata_begin, characters_begin" ];
135
+ 13 -> 14 [ label = "'&' / characters_end, 10:16" ];
136
+ 13 -> 9 [ label = "''' / characters_end, pcdata_end" ];
137
+ 13 -> err_13 [ label = "'<' / tag_error" ];
138
+ 13 -> 13 [ label = "DEF" ];
139
+ 14 -> 14 [ label = "'&' / 10:16" ];
140
+ 14 -> 9 [ label = "''' / pcdata_end" ];
141
+ 14 -> err_14 [ label = "'<' / tag_error" ];
142
+ 14 -> 13 [ label = "DEF / characters_begin" ];
143
+ 15 -> 16 [ label = "'-'" ];
144
+ 15 -> 20 [ label = "'D'" ];
145
+ 15 -> 27 [ label = "'['" ];
146
+ 16 -> 17 [ label = "'-'" ];
147
+ 17 -> 18 [ label = "'-'" ];
148
+ 17 -> 17 [ label = "DEF" ];
149
+ 18 -> 19 [ label = "'-'" ];
150
+ 18 -> 17 [ label = "DEF" ];
151
+ 19 -> 19 [ label = "'-'" ];
152
+ 19 -> 52 [ label = "'>'" ];
153
+ 19 -> 17 [ label = "DEF" ];
154
+ 20 -> 21 [ label = "'O'" ];
155
+ 21 -> 22 [ label = "'C'" ];
156
+ 22 -> 23 [ label = "'T'" ];
157
+ 23 -> 24 [ label = "'Y'" ];
158
+ 24 -> 25 [ label = "'P'" ];
159
+ 25 -> 26 [ label = "'E'" ];
160
+ 26 -> 53 [ label = "'>'" ];
161
+ 26 -> 26 [ label = "DEF" ];
162
+ 27 -> 28 [ label = "'C'" ];
163
+ 28 -> 29 [ label = "'D'" ];
164
+ 29 -> 30 [ label = "'A'" ];
165
+ 30 -> 31 [ label = "'T'" ];
166
+ 31 -> 32 [ label = "'A'" ];
167
+ 32 -> 33 [ label = "'['" ];
168
+ 33 -> 34 [ label = "']'" ];
169
+ 33 -> 33 [ label = "DEF" ];
170
+ 34 -> 35 [ label = "']'" ];
171
+ 34 -> 33 [ label = "DEF" ];
172
+ 35 -> 54 [ label = "'>'" ];
173
+ 35 -> 35 [ label = "']'" ];
174
+ 35 -> 33 [ label = "DEF" ];
175
+ 36 -> err_36 [ label = "0..',', '/', ';'..'@', '['..'^', '`', '{'..127 / tag_error" ];
176
+ 36 -> 37 [ label = "DEF / identifier_begin" ];
177
+ 37 -> err_37 [ label = "0..',', '/', ';'..'=', '?'..'@', '['..'^', '`', '{'..127 / tag_error" ];
178
+ 37 -> 55 [ label = "'>' / identifier_end" ];
179
+ 37 -> 37 [ label = "DEF" ];
180
+ 38 -> err_38 [ label = "0..',', '/', ';'..'@', '['..'^', '`', '{'..127 / instruction_error" ];
181
+ 38 -> 39 [ label = "DEF / identifier_begin" ];
182
+ 39 -> err_39 [ label = "0..'\\b', 14..31, '!'..',', '/', ';'..'@', '['..'^', '`', '{'..127 / instruction_error" ];
183
+ 39 -> 40 [ label = "'\\t'..'\\r', SP / identifier_end, instruction_text_begin" ];
184
+ 39 -> 39 [ label = "DEF" ];
185
+ 40 -> 41 [ label = "'?' / instruction_text_end" ];
186
+ 40 -> 40 [ label = "DEF" ];
187
+ 41 -> 56 [ label = "'>'" ];
188
+ 41 -> 41 [ label = "'?' / instruction_text_end" ];
189
+ 41 -> 40 [ label = "DEF" ];
190
+ 42 -> 43 [ label = "'#'" ];
191
+ 42 -> 47 [ label = "'0'..'9', 'A'..'Z', 'a'..'z' / entity_begin" ];
192
+ 42 -> err_42 [ label = "DEF / entity_error" ];
193
+ 43 -> 44 [ label = "'0'..'9' / entity_begin" ];
194
+ 43 -> 45 [ label = "'x'" ];
195
+ 43 -> err_43 [ label = "DEF / entity_error" ];
196
+ 44 -> 44 [ label = "'0'..'9'" ];
197
+ 44 -> 57 [ label = "';' / entity_number, 8:5" ];
198
+ 44 -> err_44 [ label = "DEF / entity_error" ];
199
+ 45 -> 46 [ label = "'0'..'9', 'A'..'F', 'a'..'f' / entity_begin" ];
200
+ 45 -> err_45 [ label = "DEF / entity_error" ];
201
+ 46 -> 46 [ label = "'0'..'9', 'A'..'F', 'a'..'f'" ];
202
+ 46 -> 57 [ label = "';' / entity_hex, 8:5" ];
203
+ 46 -> err_46 [ label = "DEF / entity_error" ];
204
+ 47 -> 47 [ label = "'0'..'9', 'A'..'Z', 'a'..'z'" ];
205
+ 47 -> 57 [ label = "';' / entity_name, 8:5" ];
206
+ 47 -> err_47 [ label = "DEF / entity_error" ];
207
+ 48 -> 50 [ label = "'&' / text_begin, pcdata_begin, 10:16" ];
208
+ 48 -> 1 [ label = "'<' / tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
209
+ 48 -> 49 [ label = "DEF / text_begin, pcdata_begin, characters_begin" ];
210
+ 49 -> 50 [ label = "'&' / characters_end, 10:16" ];
211
+ 49 -> 1 [ label = "'<' / characters_end, pcdata_end, text_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
212
+ 49 -> 49 [ label = "DEF" ];
213
+ 50 -> 50 [ label = "'&' / 10:16" ];
214
+ 50 -> 1 [ label = "'<' / pcdata_end, text_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
215
+ 50 -> 49 [ label = "DEF / characters_begin" ];
216
+ 51 -> 50 [ label = "'&' / tag_opening_end, text_begin, pcdata_begin, 10:16" ];
217
+ 51 -> 1 [ label = "'<' / tag_opening_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
218
+ 51 -> 49 [ label = "DEF / tag_opening_end, text_begin, pcdata_begin, characters_begin" ];
219
+ 52 -> 50 [ label = "'&' / comment_end, text_begin, pcdata_begin, 10:16" ];
220
+ 52 -> 1 [ label = "'<' / comment_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
221
+ 52 -> 49 [ label = "DEF / comment_end, text_begin, pcdata_begin, characters_begin" ];
222
+ 53 -> 50 [ label = "'&' / doctype_end, text_begin, pcdata_begin, 10:16" ];
223
+ 53 -> 1 [ label = "'<' / doctype_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
224
+ 53 -> 49 [ label = "DEF / doctype_end, text_begin, pcdata_begin, characters_begin" ];
225
+ 54 -> 50 [ label = "'&' / cdata_end, text_begin, pcdata_begin, 10:16" ];
226
+ 54 -> 1 [ label = "'<' / cdata_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
227
+ 54 -> 49 [ label = "DEF / cdata_end, text_begin, pcdata_begin, characters_begin" ];
228
+ 55 -> 50 [ label = "'&' / tag_closing_end, text_begin, pcdata_begin, 10:16" ];
229
+ 55 -> 1 [ label = "'<' / tag_closing_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
230
+ 55 -> 49 [ label = "DEF / tag_closing_end, text_begin, pcdata_begin, characters_begin" ];
231
+ 56 -> 50 [ label = "'&' / instruction_end, text_begin, pcdata_begin, 10:16" ];
232
+ 56 -> 1 [ label = "'<' / instruction_end, tag_opening_begin, tag_closing_begin, instruction_begin, comment_begin, doctype_begin, cdata_begin" ];
233
+ 56 -> 49 [ label = "DEF / instruction_end, text_begin, pcdata_begin, characters_begin" ];
234
+ ENTRY -> 48 [ label = "IN" ];
235
+ en_42 -> 42 [ label = "parse_entity" ];
236
+ en_48 -> 48 [ label = "main" ];
237
+ 1 -> eof_1 [ label = "EOF / tag_error" ];
238
+ 2 -> eof_2 [ label = "EOF / tag_error" ];
239
+ 3 -> eof_3 [ label = "EOF / tag_error" ];
240
+ 4 -> eof_4 [ label = "EOF / tag_error" ];
241
+ 5 -> eof_5 [ label = "EOF / tag_error" ];
242
+ 6 -> eof_6 [ label = "EOF / tag_error" ];
243
+ 7 -> eof_7 [ label = "EOF / tag_error" ];
244
+ 8 -> eof_8 [ label = "EOF / tag_error" ];
245
+ 9 -> eof_9 [ label = "EOF / tag_error" ];
246
+ 10 -> eof_10 [ label = "EOF / tag_error" ];
247
+ 11 -> eof_11 [ label = "EOF / tag_error" ];
248
+ 12 -> eof_12 [ label = "EOF / tag_error" ];
249
+ 13 -> eof_13 [ label = "EOF / tag_error" ];
250
+ 14 -> eof_14 [ label = "EOF / tag_error" ];
251
+ 17 -> eof_17 [ label = "EOF / comment_error" ];
252
+ 18 -> eof_18 [ label = "EOF / comment_error" ];
253
+ 19 -> eof_19 [ label = "EOF / comment_error" ];
254
+ 26 -> eof_26 [ label = "EOF / doctype_error" ];
255
+ 33 -> eof_33 [ label = "EOF / cdata_error" ];
256
+ 34 -> eof_34 [ label = "EOF / cdata_error" ];
257
+ 35 -> eof_35 [ label = "EOF / cdata_error" ];
258
+ 36 -> eof_36 [ label = "EOF / tag_error" ];
259
+ 37 -> eof_37 [ label = "EOF / tag_error" ];
260
+ 38 -> eof_38 [ label = "EOF / instruction_error" ];
261
+ 39 -> eof_39 [ label = "EOF / instruction_error" ];
262
+ 40 -> eof_40 [ label = "EOF / instruction_error" ];
263
+ 41 -> eof_41 [ label = "EOF / instruction_error" ];
264
+ 42 -> eof_42 [ label = "EOF / entity_error" ];
265
+ 43 -> eof_43 [ label = "EOF / entity_error" ];
266
+ 44 -> eof_44 [ label = "EOF / entity_error" ];
267
+ 45 -> eof_45 [ label = "EOF / entity_error" ];
268
+ 46 -> eof_46 [ label = "EOF / entity_error" ];
269
+ 47 -> eof_47 [ label = "EOF / entity_error" ];
270
+ 49 -> eof_49 [ label = "EOF / characters_end, pcdata_end, text_end" ];
271
+ 50 -> eof_50 [ label = "EOF / pcdata_end, text_end" ];
272
+ 51 -> eof_51 [ label = "EOF / tag_opening_end" ];
273
+ 52 -> eof_52 [ label = "EOF / comment_end" ];
274
+ 53 -> eof_53 [ label = "EOF / doctype_end" ];
275
+ 54 -> eof_54 [ label = "EOF / cdata_end" ];
276
+ 55 -> eof_55 [ label = "EOF / tag_closing_end" ];
277
+ 56 -> eof_56 [ label = "EOF / instruction_end" ];
278
+ }
@@ -0,0 +1,565 @@
1
+
2
+ # line 1 "query.rl"
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+
24
+ # line 74 "query.rl"
25
+
26
+
27
+ require_relative '../error'
28
+
29
+ module Trenni
30
+ module Fallback
31
+
32
+ # line 33 "query.rb"
33
+ class << self
34
+ attr_accessor :_query_trans_keys
35
+ private :_query_trans_keys, :_query_trans_keys=
36
+ end
37
+ self._query_trans_keys = [
38
+ 0, 0, 48, 102, 48, 102,
39
+ 37, 93, 37, 93, 48,
40
+ 102, 48, 102, 37, 93,
41
+ 37, 93, 48, 102, 48, 102,
42
+ 37, 93, 37, 93, 37,
43
+ 93, 37, 93, 37, 93,
44
+ 38, 91, 38, 61, 0
45
+ ]
46
+
47
+ class << self
48
+ attr_accessor :_query_key_spans
49
+ private :_query_key_spans, :_query_key_spans=
50
+ end
51
+ self._query_key_spans = [
52
+ 0, 55, 55, 57, 57, 55, 55, 57,
53
+ 57, 55, 55, 57, 57, 57, 57, 57,
54
+ 54, 24
55
+ ]
56
+
57
+ class << self
58
+ attr_accessor :_query_index_offsets
59
+ private :_query_index_offsets, :_query_index_offsets=
60
+ end
61
+ self._query_index_offsets = [
62
+ 0, 0, 56, 112, 170, 228, 284, 340,
63
+ 398, 456, 512, 568, 626, 684, 742, 800,
64
+ 858, 913
65
+ ]
66
+
67
+ class << self
68
+ attr_accessor :_query_indicies
69
+ private :_query_indicies, :_query_indicies=
70
+ end
71
+ self._query_indicies = [
72
+ 0, 0, 0, 0, 0, 0, 0, 0,
73
+ 0, 0, 1, 1, 1, 1, 1, 1,
74
+ 1, 0, 0, 0, 0, 0, 0, 1,
75
+ 1, 1, 1, 1, 1, 1, 1, 1,
76
+ 1, 1, 1, 1, 1, 1, 1, 1,
77
+ 1, 1, 1, 1, 1, 1, 1, 1,
78
+ 1, 0, 0, 0, 0, 0, 0, 1,
79
+ 2, 2, 2, 2, 2, 2, 2, 2,
80
+ 2, 2, 1, 1, 1, 1, 1, 1,
81
+ 1, 2, 2, 2, 2, 2, 2, 1,
82
+ 1, 1, 1, 1, 1, 1, 1, 1,
83
+ 1, 1, 1, 1, 1, 1, 1, 1,
84
+ 1, 1, 1, 1, 1, 1, 1, 1,
85
+ 1, 2, 2, 2, 2, 2, 2, 1,
86
+ 4, 1, 3, 3, 3, 3, 5, 3,
87
+ 3, 3, 3, 6, 6, 6, 6, 6,
88
+ 6, 6, 6, 6, 6, 3, 3, 3,
89
+ 1, 3, 3, 3, 3, 3, 3, 3,
90
+ 3, 3, 3, 3, 3, 3, 3, 3,
91
+ 3, 3, 3, 3, 3, 3, 3, 3,
92
+ 3, 3, 3, 3, 3, 3, 1, 3,
93
+ 1, 3, 7, 1, 2, 2, 2, 2,
94
+ 8, 2, 2, 2, 2, 9, 9, 9,
95
+ 9, 9, 9, 9, 9, 9, 9, 2,
96
+ 2, 2, 1, 2, 2, 2, 2, 2,
97
+ 2, 2, 2, 2, 2, 2, 2, 2,
98
+ 2, 2, 2, 2, 2, 2, 2, 2,
99
+ 2, 2, 2, 2, 2, 2, 2, 2,
100
+ 1, 2, 1, 2, 10, 10, 10, 10,
101
+ 10, 10, 10, 10, 10, 10, 1, 1,
102
+ 1, 1, 1, 1, 1, 10, 10, 10,
103
+ 10, 10, 10, 1, 1, 1, 1, 1,
104
+ 1, 1, 1, 1, 1, 1, 1, 1,
105
+ 1, 1, 1, 1, 1, 1, 1, 1,
106
+ 1, 1, 1, 1, 1, 10, 10, 10,
107
+ 10, 10, 10, 1, 11, 11, 11, 11,
108
+ 11, 11, 11, 11, 11, 11, 1, 1,
109
+ 1, 1, 1, 1, 1, 11, 11, 11,
110
+ 11, 11, 11, 1, 1, 1, 1, 1,
111
+ 1, 1, 1, 1, 1, 1, 1, 1,
112
+ 1, 1, 1, 1, 1, 1, 1, 1,
113
+ 1, 1, 1, 1, 1, 11, 11, 11,
114
+ 11, 11, 11, 1, 13, 1, 12, 12,
115
+ 12, 12, 14, 12, 12, 12, 12, 15,
116
+ 15, 15, 15, 15, 15, 15, 15, 15,
117
+ 15, 12, 12, 12, 1, 12, 12, 12,
118
+ 12, 12, 12, 12, 12, 12, 12, 12,
119
+ 12, 12, 12, 12, 12, 12, 12, 12,
120
+ 12, 12, 12, 12, 12, 12, 12, 12,
121
+ 12, 12, 1, 12, 16, 12, 18, 1,
122
+ 17, 17, 17, 17, 19, 17, 17, 17,
123
+ 17, 17, 17, 17, 17, 17, 17, 17,
124
+ 17, 17, 17, 17, 17, 17, 1, 17,
125
+ 17, 17, 17, 17, 17, 17, 17, 17,
126
+ 17, 17, 17, 17, 17, 17, 17, 17,
127
+ 17, 17, 17, 17, 17, 17, 17, 17,
128
+ 17, 17, 17, 17, 1, 17, 20, 17,
129
+ 21, 21, 21, 21, 21, 21, 21, 21,
130
+ 21, 21, 1, 1, 1, 1, 1, 1,
131
+ 1, 21, 21, 21, 21, 21, 21, 1,
132
+ 1, 1, 1, 1, 1, 1, 1, 1,
133
+ 1, 1, 1, 1, 1, 1, 1, 1,
134
+ 1, 1, 1, 1, 1, 1, 1, 1,
135
+ 1, 21, 21, 21, 21, 21, 21, 1,
136
+ 17, 17, 17, 17, 17, 17, 17, 17,
137
+ 17, 17, 1, 1, 1, 1, 1, 1,
138
+ 1, 17, 17, 17, 17, 17, 17, 1,
139
+ 1, 1, 1, 1, 1, 1, 1, 1,
140
+ 1, 1, 1, 1, 1, 1, 1, 1,
141
+ 1, 1, 1, 1, 1, 1, 1, 1,
142
+ 1, 17, 17, 17, 17, 17, 17, 1,
143
+ 18, 1, 17, 17, 17, 17, 19, 17,
144
+ 17, 17, 17, 22, 22, 22, 22, 22,
145
+ 22, 22, 22, 22, 22, 17, 17, 17,
146
+ 1, 17, 17, 17, 17, 17, 17, 17,
147
+ 17, 17, 17, 17, 17, 17, 17, 17,
148
+ 17, 17, 17, 17, 17, 17, 17, 17,
149
+ 17, 17, 17, 17, 17, 17, 1, 17,
150
+ 23, 17, 4, 1, 3, 3, 3, 3,
151
+ 5, 3, 3, 3, 3, 6, 6, 6,
152
+ 6, 6, 6, 6, 6, 6, 6, 3,
153
+ 3, 3, 1, 3, 3, 3, 3, 3,
154
+ 3, 3, 3, 3, 3, 3, 3, 3,
155
+ 3, 3, 3, 3, 3, 3, 3, 3,
156
+ 3, 3, 3, 3, 3, 3, 3, 3,
157
+ 1, 3, 1, 3, 7, 24, 2, 2,
158
+ 2, 2, 8, 2, 2, 2, 2, 2,
159
+ 2, 2, 2, 2, 2, 2, 2, 2,
160
+ 2, 2, 2, 2, 25, 2, 2, 2,
161
+ 2, 2, 2, 2, 2, 2, 2, 2,
162
+ 2, 2, 2, 2, 2, 2, 2, 2,
163
+ 2, 2, 2, 2, 2, 2, 2, 2,
164
+ 2, 2, 26, 2, 1, 2, 28, 29,
165
+ 27, 27, 27, 27, 30, 27, 27, 27,
166
+ 27, 27, 27, 27, 27, 27, 27, 27,
167
+ 27, 27, 27, 27, 27, 27, 1, 27,
168
+ 27, 27, 27, 27, 27, 27, 27, 27,
169
+ 27, 27, 27, 27, 27, 27, 27, 27,
170
+ 27, 27, 27, 27, 27, 27, 27, 27,
171
+ 27, 27, 27, 27, 1, 27, 1, 27,
172
+ 31, 32, 11, 11, 11, 11, 33, 11,
173
+ 11, 11, 11, 11, 11, 11, 11, 11,
174
+ 11, 11, 11, 11, 11, 11, 11, 11,
175
+ 1, 11, 11, 11, 11, 11, 11, 11,
176
+ 11, 11, 11, 11, 11, 11, 11, 11,
177
+ 11, 11, 11, 11, 11, 11, 11, 11,
178
+ 11, 11, 11, 11, 11, 11, 1, 11,
179
+ 1, 11, 34, 1, 1, 1, 1, 1,
180
+ 1, 1, 1, 1, 1, 1, 1, 1,
181
+ 1, 1, 1, 1, 1, 1, 1, 1,
182
+ 1, 35, 1, 1, 1, 1, 1, 1,
183
+ 1, 1, 1, 1, 1, 1, 1, 1,
184
+ 1, 1, 1, 1, 1, 1, 1, 1,
185
+ 1, 1, 1, 1, 1, 1, 1, 36,
186
+ 1, 37, 1, 1, 1, 1, 1, 1,
187
+ 1, 1, 1, 1, 1, 1, 1, 1,
188
+ 1, 1, 1, 1, 1, 1, 1, 1,
189
+ 38, 1, 0
190
+ ]
191
+
192
+ class << self
193
+ attr_accessor :_query_trans_targs
194
+ private :_query_trans_targs, :_query_trans_targs=
195
+ end
196
+ self._query_trans_targs = [
197
+ 2, 0, 13, 13, 1, 13, 4, 1,
198
+ 13, 4, 6, 15, 8, 9, 8, 11,
199
+ 17, 8, 9, 8, 16, 10, 11, 16,
200
+ 3, 14, 7, 15, 5, 3, 15, 5,
201
+ 3, 15, 3, 14, 7, 3, 14
202
+ ]
203
+
204
+ class << self
205
+ attr_accessor :_query_trans_actions
206
+ private :_query_trans_actions, :_query_trans_actions=
207
+ end
208
+ self._query_trans_actions = [
209
+ 0, 0, 0, 1, 2, 2, 3, 4,
210
+ 4, 0, 0, 0, 1, 2, 2, 5,
211
+ 0, 0, 4, 4, 6, 0, 0, 7,
212
+ 8, 6, 6, 10, 11, 9, 11, 4,
213
+ 12, 4, 13, 0, 0, 14, 15
214
+ ]
215
+
216
+ class << self
217
+ attr_accessor :_query_eof_actions
218
+ private :_query_eof_actions, :_query_eof_actions=
219
+ end
220
+ self._query_eof_actions = [
221
+ 0, 0, 0, 0, 0, 0, 0, 0,
222
+ 0, 0, 0, 0, 0, 8, 9, 12,
223
+ 13, 14
224
+ ]
225
+
226
+ class << self
227
+ attr_accessor :query_start
228
+ end
229
+ self.query_start = 12;
230
+ class << self
231
+ attr_accessor :query_first_final
232
+ end
233
+ self.query_first_final = 12;
234
+ class << self
235
+ attr_accessor :query_error
236
+ end
237
+ self.query_error = 0;
238
+
239
+ class << self
240
+ attr_accessor :query_en_main
241
+ end
242
+ self.query_en_main = 12;
243
+
244
+
245
+ # line 81 "query.rl"
246
+
247
+ def self.parse_query(buffer, delegate)
248
+ data = buffer.read
249
+ bytes = data.bytes
250
+
251
+ p = 0
252
+ pe = eof = data.bytesize
253
+ stack = []
254
+
255
+ string_begin = string_end = nil
256
+ integer_begin = integer_end = nil
257
+ value_begin = value_end = nil
258
+ encoded = false
259
+
260
+
261
+ # line 262 "query.rb"
262
+ begin
263
+ p ||= 0
264
+ pe ||= data.length
265
+ cs = query_start
266
+ end
267
+
268
+ # line 96 "query.rl"
269
+
270
+ # line 271 "query.rb"
271
+ begin
272
+ testEof = false
273
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
274
+ _goto_level = 0
275
+ _resume = 10
276
+ _eof_trans = 15
277
+ _again = 20
278
+ _test_eof = 30
279
+ _out = 40
280
+ while true
281
+ if _goto_level <= 0
282
+ if p == pe
283
+ _goto_level = _test_eof
284
+ next
285
+ end
286
+ if cs == 0
287
+ _goto_level = _out
288
+ next
289
+ end
290
+ end
291
+ if _goto_level <= _resume
292
+ _keys = cs << 1
293
+ _inds = _query_index_offsets[cs]
294
+ _slen = _query_key_spans[cs]
295
+ _wide = ( bytes[p])
296
+ _trans = if ( _slen > 0 &&
297
+ _query_trans_keys[_keys] <= _wide &&
298
+ _wide <= _query_trans_keys[_keys + 1]
299
+ ) then
300
+ _query_indicies[ _inds + _wide - _query_trans_keys[_keys] ]
301
+ else
302
+ _query_indicies[ _inds + _slen ]
303
+ end
304
+ cs = _query_trans_targs[_trans]
305
+ if _query_trans_actions[_trans] != 0
306
+ case _query_trans_actions[_trans]
307
+ when 1 then
308
+ # line 24 "query.rl"
309
+ begin
310
+
311
+ string_begin = p
312
+ end
313
+ when 6 then
314
+ # line 28 "query.rl"
315
+ begin
316
+
317
+ string_end = p
318
+
319
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
320
+
321
+ encoded = false
322
+ end
323
+ when 7 then
324
+ # line 40 "query.rl"
325
+ begin
326
+
327
+ integer_end = p
328
+
329
+ delegate.integer(data.byteslice(integer_begin...integer_end))
330
+ end
331
+ when 15 then
332
+ # line 46 "query.rl"
333
+ begin
334
+
335
+ delegate.append
336
+ end
337
+ when 10 then
338
+ # line 50 "query.rl"
339
+ begin
340
+
341
+ value_begin = p
342
+ end
343
+ when 13 then
344
+ # line 62 "query.rl"
345
+ begin
346
+
347
+ delegate.pair
348
+ end
349
+ when 4 then
350
+ # line 66 "query.rl"
351
+ begin
352
+
353
+ encoded = 1;
354
+ end
355
+ when 3 then
356
+ # line 24 "query.rl"
357
+ begin
358
+
359
+ string_begin = p
360
+ end
361
+ # line 36 "query.rl"
362
+ begin
363
+
364
+ integer_begin = p
365
+ end
366
+ when 2 then
367
+ # line 24 "query.rl"
368
+ begin
369
+
370
+ string_begin = p
371
+ end
372
+ # line 66 "query.rl"
373
+ begin
374
+
375
+ encoded = 1;
376
+ end
377
+ when 8 then
378
+ # line 28 "query.rl"
379
+ begin
380
+
381
+ string_end = p
382
+
383
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
384
+
385
+ encoded = false
386
+ end
387
+ # line 62 "query.rl"
388
+ begin
389
+
390
+ delegate.pair
391
+ end
392
+ when 5 then
393
+ # line 36 "query.rl"
394
+ begin
395
+
396
+ integer_begin = p
397
+ end
398
+ # line 24 "query.rl"
399
+ begin
400
+
401
+ string_begin = p
402
+ end
403
+ when 14 then
404
+ # line 46 "query.rl"
405
+ begin
406
+
407
+ delegate.append
408
+ end
409
+ # line 62 "query.rl"
410
+ begin
411
+
412
+ delegate.pair
413
+ end
414
+ when 11 then
415
+ # line 50 "query.rl"
416
+ begin
417
+
418
+ value_begin = p
419
+ end
420
+ # line 66 "query.rl"
421
+ begin
422
+
423
+ encoded = 1;
424
+ end
425
+ when 12 then
426
+ # line 54 "query.rl"
427
+ begin
428
+
429
+ value_end = p
430
+
431
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
432
+
433
+ encoded = false
434
+ end
435
+ # line 62 "query.rl"
436
+ begin
437
+
438
+ delegate.pair
439
+ end
440
+ when 9 then
441
+ # line 50 "query.rl"
442
+ begin
443
+
444
+ value_begin = p
445
+ end
446
+ # line 54 "query.rl"
447
+ begin
448
+
449
+ value_end = p
450
+
451
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
452
+
453
+ encoded = false
454
+ end
455
+ # line 62 "query.rl"
456
+ begin
457
+
458
+ delegate.pair
459
+ end
460
+ # line 461 "query.rb"
461
+ end
462
+ end
463
+ end
464
+ if _goto_level <= _again
465
+ if cs == 0
466
+ _goto_level = _out
467
+ next
468
+ end
469
+ p += 1
470
+ if p != pe
471
+ _goto_level = _resume
472
+ next
473
+ end
474
+ end
475
+ if _goto_level <= _test_eof
476
+ if p == eof
477
+ case _query_eof_actions[cs]
478
+ when 13 then
479
+ # line 62 "query.rl"
480
+ begin
481
+
482
+ delegate.pair
483
+ end
484
+ when 8 then
485
+ # line 28 "query.rl"
486
+ begin
487
+
488
+ string_end = p
489
+
490
+ delegate.string(data.byteslice(string_begin...string_end), encoded)
491
+
492
+ encoded = false
493
+ end
494
+ # line 62 "query.rl"
495
+ begin
496
+
497
+ delegate.pair
498
+ end
499
+ when 14 then
500
+ # line 46 "query.rl"
501
+ begin
502
+
503
+ delegate.append
504
+ end
505
+ # line 62 "query.rl"
506
+ begin
507
+
508
+ delegate.pair
509
+ end
510
+ when 12 then
511
+ # line 54 "query.rl"
512
+ begin
513
+
514
+ value_end = p
515
+
516
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
517
+
518
+ encoded = false
519
+ end
520
+ # line 62 "query.rl"
521
+ begin
522
+
523
+ delegate.pair
524
+ end
525
+ when 9 then
526
+ # line 50 "query.rl"
527
+ begin
528
+
529
+ value_begin = p
530
+ end
531
+ # line 54 "query.rl"
532
+ begin
533
+
534
+ value_end = p
535
+
536
+ delegate.assign(data.byteslice(value_begin...value_end), encoded)
537
+
538
+ encoded = false
539
+ end
540
+ # line 62 "query.rl"
541
+ begin
542
+
543
+ delegate.pair
544
+ end
545
+ # line 546 "query.rb"
546
+ end
547
+ end
548
+
549
+ end
550
+ if _goto_level <= _out
551
+ break
552
+ end
553
+ end
554
+ end
555
+
556
+ # line 97 "query.rl"
557
+
558
+ if p != eof
559
+ raise ParseError.new("could not consume all input", buffer, p)
560
+ end
561
+
562
+ return nil
563
+ end
564
+ end
565
+ end