trenni 1.7.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +7 -3
  4. data/Gemfile +4 -0
  5. data/README.md +72 -10
  6. data/Rakefile +85 -0
  7. data/benchmark/call_vs_yield.rb +51 -0
  8. data/benchmark/interpolation_vs_concat.rb +29 -0
  9. data/benchmark/io_vs_string.rb +14 -4
  10. data/entities.json +2233 -0
  11. data/ext/trenni/extconf.rb +13 -0
  12. data/ext/trenni/markup.c +1981 -0
  13. data/ext/trenni/markup.h +6 -0
  14. data/ext/trenni/markup.rl +223 -0
  15. data/ext/trenni/template.c +1113 -0
  16. data/ext/trenni/template.h +6 -0
  17. data/ext/trenni/template.rl +77 -0
  18. data/ext/trenni/trenni.c +64 -0
  19. data/ext/trenni/trenni.h +28 -0
  20. data/lib/trenni.rb +1 -0
  21. data/lib/trenni/buffer.rb +13 -2
  22. data/lib/trenni/builder.rb +54 -47
  23. data/lib/trenni/entities.rb +2154 -0
  24. data/lib/trenni/entities.trenni +34 -0
  25. data/lib/trenni/fallback/markup.rb +1648 -0
  26. data/lib/trenni/fallback/markup.rl +236 -0
  27. data/lib/trenni/fallback/template.rb +843 -0
  28. data/lib/trenni/fallback/template.rl +97 -0
  29. data/lib/trenni/markup.rb +76 -0
  30. data/lib/trenni/native.rb +28 -0
  31. data/lib/trenni/parse_delegate.rb +34 -0
  32. data/lib/trenni/{scanner.rb → parse_error.rb} +9 -54
  33. data/lib/trenni/parsers.rb +12 -0
  34. data/lib/trenni/substitutions.rb +45 -0
  35. data/lib/trenni/template.rb +52 -135
  36. data/lib/trenni/version.rb +1 -1
  37. data/parsers/trenni/entities.rl +11 -0
  38. data/parsers/trenni/markup.rl +43 -0
  39. data/parsers/trenni/template.rl +60 -0
  40. data/spec/trenni/builder_spec.rb +37 -62
  41. data/spec/trenni/corpus/large.rb +4605 -0
  42. data/spec/trenni/corpus/large.xhtml +726 -0
  43. data/spec/trenni/markup_parser_spec.rb +233 -0
  44. data/spec/trenni/markup_spec.rb +48 -0
  45. data/spec/trenni/parsers_performance_spec.rb +44 -0
  46. data/spec/trenni/template_error_spec.rb +36 -0
  47. data/spec/trenni/template_performance_spec.rb +102 -0
  48. data/spec/trenni/template_spec.rb +90 -64
  49. data/spec/trenni/template_spec/basic.trenni +1 -0
  50. data/spec/trenni/template_spec/capture.trenni +2 -2
  51. data/spec/trenni/template_spec/error.trenni +4 -0
  52. data/trenni.gemspec +9 -6
  53. metadata +57 -15
  54. data/lib/trenni/parser.rb +0 -153
  55. data/spec/trenni/parser_spec.rb +0 -144
@@ -0,0 +1,34 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'substitutions'
22
+
23
+ module Trenni
24
+ # We only support a small subset of markup entities.
25
+ module Entities
26
+ HTML_NAMED_ENTITIES = {
27
+ <?r self.each do |string, metadata| ?>
28
+ #{string.gsub(/^&|;$/, '').inspect} => #{metadata['characters'].dump}, # #{metadata['characters'].inspect}
29
+ <?r end ?>
30
+ }
31
+
32
+ HTML = UnicodeEntities.new(HTML_NAMED_ENTITIES)
33
+ end
34
+ end
@@ -0,0 +1,1648 @@
1
+
2
+ # line 1 "markup.rl"
3
+ # Copyright, 2016, 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 199 "markup.rl"
25
+
26
+
27
+ require_relative '../parse_error'
28
+
29
+ module Trenni
30
+ module Fallback
31
+
32
+ # line 33 "markup.rb"
33
+ class << self
34
+ attr_accessor :_markup_trans_keys
35
+ private :_markup_trans_keys, :_markup_trans_keys=
36
+ end
37
+ self._markup_trans_keys = [
38
+ 0, 0, 0, 127, 0, 127,
39
+ 0, 127, 0, 127, 62,
40
+ 62, 34, 39, 34, 60,
41
+ 34, 60, 9, 62, 34, 60,
42
+ 9, 62, 38, 60, 38,
43
+ 60, 38, 60, 45, 91,
44
+ 45, 45, 45, 45, 45, 45,
45
+ 45, 62, 79, 79, 67,
46
+ 67, 84, 84, 89, 89,
47
+ 80, 80, 69, 69, 62, 62,
48
+ 67, 67, 68, 68, 65,
49
+ 65, 84, 84, 65, 65,
50
+ 91, 91, 93, 93, 93, 93,
51
+ 62, 93, 0, 127, 0,
52
+ 127, 0, 127, 0, 127,
53
+ 63, 63, 62, 63, 35, 122,
54
+ 48, 120, 48, 59, 48,
55
+ 102, 48, 102, 48, 122,
56
+ 38, 60, 38, 60, 38, 60,
57
+ 38, 60, 38, 60, 38,
58
+ 60, 38, 60, 38, 60,
59
+ 38, 60, 0, 0, 0
60
+ ]
61
+
62
+ class << self
63
+ attr_accessor :_markup_key_spans
64
+ private :_markup_key_spans, :_markup_key_spans=
65
+ end
66
+ self._markup_key_spans = [
67
+ 0, 128, 128, 128, 128, 1, 6, 27,
68
+ 27, 54, 27, 54, 23, 23, 23, 47,
69
+ 1, 1, 1, 18, 1, 1, 1, 1,
70
+ 1, 1, 1, 1, 1, 1, 1, 1,
71
+ 1, 1, 1, 32, 128, 128, 128, 128,
72
+ 1, 2, 88, 73, 12, 55, 55, 75,
73
+ 23, 23, 23, 23, 23, 23, 23, 23,
74
+ 23, 0
75
+ ]
76
+
77
+ class << self
78
+ attr_accessor :_markup_index_offsets
79
+ private :_markup_index_offsets, :_markup_index_offsets=
80
+ end
81
+ self._markup_index_offsets = [
82
+ 0, 0, 129, 258, 387, 516, 518, 525,
83
+ 553, 581, 636, 664, 719, 743, 767, 791,
84
+ 839, 841, 843, 845, 864, 866, 868, 870,
85
+ 872, 874, 876, 878, 880, 882, 884, 886,
86
+ 888, 890, 892, 894, 927, 1056, 1185, 1314,
87
+ 1443, 1445, 1448, 1537, 1611, 1624, 1680, 1736,
88
+ 1812, 1836, 1860, 1884, 1908, 1932, 1956, 1980,
89
+ 2004, 2028
90
+ ]
91
+
92
+ class << self
93
+ attr_accessor :_markup_indicies
94
+ private :_markup_indicies, :_markup_indicies=
95
+ end
96
+ self._markup_indicies = [
97
+ 1, 1, 1, 1, 1, 1, 1, 1,
98
+ 1, 1, 1, 1, 1, 1, 1, 1,
99
+ 1, 1, 1, 1, 1, 1, 1, 1,
100
+ 1, 1, 1, 1, 1, 1, 1, 1,
101
+ 1, 2, 1, 1, 1, 1, 1, 1,
102
+ 1, 1, 1, 1, 1, 0, 0, 3,
103
+ 0, 0, 0, 0, 0, 0, 0, 0,
104
+ 0, 0, 0, 1, 1, 1, 1, 4,
105
+ 1, 0, 0, 0, 0, 0, 0, 0,
106
+ 0, 0, 0, 0, 0, 0, 0, 0,
107
+ 0, 0, 0, 0, 0, 0, 0, 0,
108
+ 0, 0, 0, 1, 1, 1, 1, 0,
109
+ 1, 0, 0, 0, 0, 0, 0, 0,
110
+ 0, 0, 0, 0, 0, 0, 0, 0,
111
+ 0, 0, 0, 0, 0, 0, 0, 0,
112
+ 0, 0, 0, 1, 1, 1, 1, 1,
113
+ 0, 1, 1, 1, 1, 1, 1, 1,
114
+ 1, 1, 6, 6, 6, 6, 6, 1,
115
+ 1, 1, 1, 1, 1, 1, 1, 1,
116
+ 1, 1, 1, 1, 1, 1, 1, 1,
117
+ 1, 6, 1, 1, 1, 1, 1, 1,
118
+ 1, 1, 1, 1, 1, 1, 5, 5,
119
+ 7, 5, 5, 5, 5, 5, 5, 5,
120
+ 5, 5, 5, 5, 1, 1, 1, 8,
121
+ 1, 1, 5, 5, 5, 5, 5, 5,
122
+ 5, 5, 5, 5, 5, 5, 5, 5,
123
+ 5, 5, 5, 5, 5, 5, 5, 5,
124
+ 5, 5, 5, 5, 1, 1, 1, 1,
125
+ 5, 1, 5, 5, 5, 5, 5, 5,
126
+ 5, 5, 5, 5, 5, 5, 5, 5,
127
+ 5, 5, 5, 5, 5, 5, 5, 5,
128
+ 5, 5, 5, 5, 1, 1, 1, 1,
129
+ 1, 5, 1, 1, 1, 1, 1, 1,
130
+ 1, 1, 1, 10, 10, 10, 10, 10,
131
+ 1, 1, 1, 1, 1, 1, 1, 1,
132
+ 1, 1, 1, 1, 1, 1, 1, 1,
133
+ 1, 1, 10, 1, 1, 1, 1, 1,
134
+ 1, 1, 1, 1, 1, 1, 1, 9,
135
+ 9, 11, 9, 9, 9, 9, 9, 9,
136
+ 9, 9, 9, 9, 9, 1, 1, 1,
137
+ 12, 1, 1, 9, 9, 9, 9, 9,
138
+ 9, 9, 9, 9, 9, 9, 9, 9,
139
+ 9, 9, 9, 9, 9, 9, 9, 9,
140
+ 9, 9, 9, 9, 9, 1, 1, 1,
141
+ 1, 9, 1, 9, 9, 9, 9, 9,
142
+ 9, 9, 9, 9, 9, 9, 9, 9,
143
+ 9, 9, 9, 9, 9, 9, 9, 9,
144
+ 9, 9, 9, 9, 9, 1, 1, 1,
145
+ 1, 1, 9, 1, 1, 1, 1, 1,
146
+ 1, 1, 1, 1, 14, 14, 14, 14,
147
+ 14, 1, 1, 1, 1, 1, 1, 1,
148
+ 1, 1, 1, 1, 1, 1, 1, 1,
149
+ 1, 1, 1, 14, 1, 1, 1, 1,
150
+ 1, 1, 1, 1, 1, 1, 1, 1,
151
+ 13, 13, 15, 13, 13, 13, 13, 13,
152
+ 13, 13, 13, 13, 13, 13, 1, 1,
153
+ 16, 17, 1, 1, 13, 13, 13, 13,
154
+ 13, 13, 13, 13, 13, 13, 13, 13,
155
+ 13, 13, 13, 13, 13, 13, 13, 13,
156
+ 13, 13, 13, 13, 13, 13, 1, 1,
157
+ 1, 1, 13, 1, 13, 13, 13, 13,
158
+ 13, 13, 13, 13, 13, 13, 13, 13,
159
+ 13, 13, 13, 13, 13, 13, 13, 13,
160
+ 13, 13, 13, 13, 13, 13, 1, 1,
161
+ 1, 1, 1, 13, 12, 1, 18, 1,
162
+ 1, 1, 1, 19, 1, 21, 20, 20,
163
+ 20, 22, 20, 20, 20, 20, 20, 20,
164
+ 20, 20, 20, 20, 20, 20, 20, 20,
165
+ 20, 20, 20, 20, 20, 20, 20, 1,
166
+ 20, 24, 23, 23, 23, 25, 23, 23,
167
+ 23, 23, 23, 23, 23, 23, 23, 23,
168
+ 23, 23, 23, 23, 23, 23, 23, 23,
169
+ 23, 23, 23, 1, 23, 26, 26, 26,
170
+ 26, 26, 1, 1, 1, 1, 1, 1,
171
+ 1, 1, 1, 1, 1, 1, 1, 1,
172
+ 1, 1, 1, 1, 26, 1, 1, 1,
173
+ 1, 1, 1, 1, 1, 1, 1, 1,
174
+ 1, 1, 1, 27, 1, 1, 1, 1,
175
+ 1, 1, 1, 1, 1, 1, 1, 1,
176
+ 1, 1, 28, 1, 30, 29, 29, 29,
177
+ 31, 29, 29, 29, 29, 29, 29, 29,
178
+ 29, 29, 29, 29, 29, 29, 29, 29,
179
+ 29, 29, 29, 29, 29, 29, 1, 29,
180
+ 32, 32, 32, 32, 32, 1, 1, 1,
181
+ 1, 1, 1, 1, 1, 1, 1, 1,
182
+ 1, 1, 1, 1, 1, 1, 1, 32,
183
+ 1, 1, 1, 1, 1, 1, 1, 1,
184
+ 1, 1, 1, 1, 1, 1, 33, 1,
185
+ 1, 1, 1, 1, 1, 1, 1, 1,
186
+ 1, 1, 1, 1, 1, 34, 1, 36,
187
+ 21, 35, 35, 35, 35, 35, 35, 35,
188
+ 35, 35, 35, 35, 35, 35, 35, 35,
189
+ 35, 35, 35, 35, 35, 1, 35, 38,
190
+ 24, 37, 37, 37, 37, 37, 37, 37,
191
+ 37, 37, 37, 37, 37, 37, 37, 37,
192
+ 37, 37, 37, 37, 37, 1, 37, 40,
193
+ 30, 39, 39, 39, 39, 39, 39, 39,
194
+ 39, 39, 39, 39, 39, 39, 39, 39,
195
+ 39, 39, 39, 39, 39, 1, 39, 41,
196
+ 42, 42, 42, 42, 42, 42, 42, 42,
197
+ 42, 42, 42, 42, 42, 42, 42, 42,
198
+ 42, 42, 42, 42, 42, 42, 43, 42,
199
+ 42, 42, 42, 42, 42, 42, 42, 42,
200
+ 42, 42, 42, 42, 42, 42, 42, 42,
201
+ 42, 42, 42, 42, 42, 44, 42, 45,
202
+ 42, 46, 45, 47, 45, 47, 45, 45,
203
+ 45, 45, 45, 45, 45, 45, 45, 45,
204
+ 45, 45, 45, 45, 45, 45, 48, 45,
205
+ 49, 42, 50, 42, 51, 42, 52, 42,
206
+ 53, 42, 54, 42, 55, 54, 56, 42,
207
+ 57, 42, 58, 42, 59, 42, 60, 42,
208
+ 61, 42, 62, 61, 63, 61, 64, 61,
209
+ 61, 61, 61, 61, 61, 61, 61, 61,
210
+ 61, 61, 61, 61, 61, 61, 61, 61,
211
+ 61, 61, 61, 61, 61, 61, 61, 61,
212
+ 61, 61, 61, 61, 61, 63, 61, 1,
213
+ 1, 1, 1, 1, 1, 1, 1, 1,
214
+ 1, 1, 1, 1, 1, 1, 1, 1,
215
+ 1, 1, 1, 1, 1, 1, 1, 1,
216
+ 1, 1, 1, 1, 1, 1, 1, 1,
217
+ 1, 1, 1, 1, 1, 1, 1, 1,
218
+ 1, 1, 1, 1, 65, 65, 1, 65,
219
+ 65, 65, 65, 65, 65, 65, 65, 65,
220
+ 65, 65, 1, 1, 1, 1, 1, 1,
221
+ 65, 65, 65, 65, 65, 65, 65, 65,
222
+ 65, 65, 65, 65, 65, 65, 65, 65,
223
+ 65, 65, 65, 65, 65, 65, 65, 65,
224
+ 65, 65, 1, 1, 1, 1, 65, 1,
225
+ 65, 65, 65, 65, 65, 65, 65, 65,
226
+ 65, 65, 65, 65, 65, 65, 65, 65,
227
+ 65, 65, 65, 65, 65, 65, 65, 65,
228
+ 65, 65, 1, 1, 1, 1, 1, 65,
229
+ 1, 1, 1, 1, 1, 1, 1, 1,
230
+ 1, 1, 1, 1, 1, 1, 1, 1,
231
+ 1, 1, 1, 1, 1, 1, 1, 1,
232
+ 1, 1, 1, 1, 1, 1, 1, 1,
233
+ 1, 1, 1, 1, 1, 1, 1, 1,
234
+ 1, 1, 1, 1, 1, 66, 66, 1,
235
+ 66, 66, 66, 66, 66, 66, 66, 66,
236
+ 66, 66, 66, 1, 1, 1, 67, 1,
237
+ 1, 66, 66, 66, 66, 66, 66, 66,
238
+ 66, 66, 66, 66, 66, 66, 66, 66,
239
+ 66, 66, 66, 66, 66, 66, 66, 66,
240
+ 66, 66, 66, 1, 1, 1, 1, 66,
241
+ 1, 66, 66, 66, 66, 66, 66, 66,
242
+ 66, 66, 66, 66, 66, 66, 66, 66,
243
+ 66, 66, 66, 66, 66, 66, 66, 66,
244
+ 66, 66, 66, 1, 1, 1, 1, 1,
245
+ 66, 69, 69, 69, 69, 69, 69, 69,
246
+ 69, 69, 69, 69, 69, 69, 69, 69,
247
+ 69, 69, 69, 69, 69, 69, 69, 69,
248
+ 69, 69, 69, 69, 69, 69, 69, 69,
249
+ 69, 69, 69, 69, 69, 69, 69, 69,
250
+ 69, 69, 69, 69, 69, 69, 68, 68,
251
+ 69, 68, 68, 68, 68, 68, 68, 68,
252
+ 68, 68, 68, 68, 69, 69, 69, 69,
253
+ 69, 69, 68, 68, 68, 68, 68, 68,
254
+ 68, 68, 68, 68, 68, 68, 68, 68,
255
+ 68, 68, 68, 68, 68, 68, 68, 68,
256
+ 68, 68, 68, 68, 69, 69, 69, 69,
257
+ 68, 69, 68, 68, 68, 68, 68, 68,
258
+ 68, 68, 68, 68, 68, 68, 68, 68,
259
+ 68, 68, 68, 68, 68, 68, 68, 68,
260
+ 68, 68, 68, 68, 69, 69, 69, 69,
261
+ 69, 68, 69, 69, 69, 69, 69, 69,
262
+ 69, 69, 69, 71, 71, 71, 71, 71,
263
+ 69, 69, 69, 69, 69, 69, 69, 69,
264
+ 69, 69, 69, 69, 69, 69, 69, 69,
265
+ 69, 69, 71, 69, 69, 69, 69, 69,
266
+ 69, 69, 69, 69, 69, 69, 69, 70,
267
+ 70, 69, 70, 70, 70, 70, 70, 70,
268
+ 70, 70, 70, 70, 70, 69, 69, 69,
269
+ 69, 69, 69, 70, 70, 70, 70, 70,
270
+ 70, 70, 70, 70, 70, 70, 70, 70,
271
+ 70, 70, 70, 70, 70, 70, 70, 70,
272
+ 70, 70, 70, 70, 70, 69, 69, 69,
273
+ 69, 70, 69, 70, 70, 70, 70, 70,
274
+ 70, 70, 70, 70, 70, 70, 70, 70,
275
+ 70, 70, 70, 70, 70, 70, 70, 70,
276
+ 70, 70, 70, 70, 70, 69, 69, 69,
277
+ 69, 69, 70, 73, 72, 74, 73, 72,
278
+ 76, 75, 75, 75, 75, 75, 75, 75,
279
+ 75, 75, 75, 75, 75, 77, 77, 77,
280
+ 77, 77, 77, 77, 77, 77, 77, 75,
281
+ 75, 75, 75, 75, 75, 75, 77, 77,
282
+ 77, 77, 77, 77, 77, 77, 77, 77,
283
+ 77, 77, 77, 77, 77, 77, 77, 77,
284
+ 77, 77, 77, 77, 77, 77, 77, 77,
285
+ 75, 75, 75, 75, 75, 75, 77, 77,
286
+ 77, 77, 77, 77, 77, 77, 77, 77,
287
+ 77, 77, 77, 77, 77, 77, 77, 77,
288
+ 77, 77, 77, 77, 77, 77, 77, 77,
289
+ 75, 78, 78, 78, 78, 78, 78, 78,
290
+ 78, 78, 78, 75, 75, 75, 75, 75,
291
+ 75, 75, 75, 75, 75, 75, 75, 75,
292
+ 75, 75, 75, 75, 75, 75, 75, 75,
293
+ 75, 75, 75, 75, 75, 75, 75, 75,
294
+ 75, 75, 75, 75, 75, 75, 75, 75,
295
+ 75, 75, 75, 75, 75, 75, 75, 75,
296
+ 75, 75, 75, 75, 75, 75, 75, 75,
297
+ 75, 75, 75, 75, 75, 75, 75, 75,
298
+ 75, 79, 75, 80, 80, 80, 80, 80,
299
+ 80, 80, 80, 80, 80, 75, 81, 75,
300
+ 82, 82, 82, 82, 82, 82, 82, 82,
301
+ 82, 82, 75, 75, 75, 75, 75, 75,
302
+ 75, 82, 82, 82, 82, 82, 82, 75,
303
+ 75, 75, 75, 75, 75, 75, 75, 75,
304
+ 75, 75, 75, 75, 75, 75, 75, 75,
305
+ 75, 75, 75, 75, 75, 75, 75, 75,
306
+ 75, 82, 82, 82, 82, 82, 82, 75,
307
+ 83, 83, 83, 83, 83, 83, 83, 83,
308
+ 83, 83, 75, 84, 75, 75, 75, 75,
309
+ 75, 83, 83, 83, 83, 83, 83, 75,
310
+ 75, 75, 75, 75, 75, 75, 75, 75,
311
+ 75, 75, 75, 75, 75, 75, 75, 75,
312
+ 75, 75, 75, 75, 75, 75, 75, 75,
313
+ 75, 83, 83, 83, 83, 83, 83, 75,
314
+ 85, 85, 85, 85, 85, 85, 85, 85,
315
+ 85, 85, 75, 86, 75, 75, 75, 75,
316
+ 75, 85, 85, 85, 85, 85, 85, 85,
317
+ 85, 85, 85, 85, 85, 85, 85, 85,
318
+ 85, 85, 85, 85, 85, 85, 85, 85,
319
+ 85, 85, 85, 75, 75, 75, 75, 75,
320
+ 75, 85, 85, 85, 85, 85, 85, 85,
321
+ 85, 85, 85, 85, 85, 85, 85, 85,
322
+ 85, 85, 85, 85, 85, 85, 85, 85,
323
+ 85, 85, 85, 75, 88, 87, 87, 87,
324
+ 87, 87, 87, 87, 87, 87, 87, 87,
325
+ 87, 87, 87, 87, 87, 87, 87, 87,
326
+ 87, 87, 89, 87, 91, 90, 90, 90,
327
+ 90, 90, 90, 90, 90, 90, 90, 90,
328
+ 90, 90, 90, 90, 90, 90, 90, 90,
329
+ 90, 90, 92, 90, 94, 93, 93, 93,
330
+ 93, 93, 93, 93, 93, 93, 93, 93,
331
+ 93, 93, 93, 93, 93, 93, 93, 93,
332
+ 93, 93, 95, 93, 97, 96, 96, 96,
333
+ 96, 96, 96, 96, 96, 96, 96, 96,
334
+ 96, 96, 96, 96, 96, 96, 96, 96,
335
+ 96, 96, 98, 96, 100, 99, 99, 99,
336
+ 99, 99, 99, 99, 99, 99, 99, 99,
337
+ 99, 99, 99, 99, 99, 99, 99, 99,
338
+ 99, 99, 101, 99, 103, 102, 102, 102,
339
+ 102, 102, 102, 102, 102, 102, 102, 102,
340
+ 102, 102, 102, 102, 102, 102, 102, 102,
341
+ 102, 102, 104, 102, 106, 105, 105, 105,
342
+ 105, 105, 105, 105, 105, 105, 105, 105,
343
+ 105, 105, 105, 105, 105, 105, 105, 105,
344
+ 105, 105, 107, 105, 109, 108, 108, 108,
345
+ 108, 108, 108, 108, 108, 108, 108, 108,
346
+ 108, 108, 108, 108, 108, 108, 108, 108,
347
+ 108, 108, 110, 108, 112, 111, 111, 111,
348
+ 111, 111, 111, 111, 111, 111, 111, 111,
349
+ 111, 111, 111, 111, 111, 111, 111, 111,
350
+ 111, 111, 113, 111, 42, 0
351
+ ]
352
+
353
+ class << self
354
+ attr_accessor :_markup_trans_targs
355
+ private :_markup_trans_targs, :_markup_trans_targs=
356
+ end
357
+ self._markup_trans_targs = [
358
+ 2, 0, 15, 36, 38, 2, 3, 5,
359
+ 51, 4, 3, 5, 51, 4, 3, 5,
360
+ 6, 51, 7, 12, 8, 11, 10, 8,
361
+ 9, 10, 3, 5, 51, 8, 9, 10,
362
+ 3, 5, 51, 13, 14, 13, 14, 13,
363
+ 14, 16, 0, 20, 27, 17, 18, 19,
364
+ 52, 21, 22, 23, 24, 25, 26, 53,
365
+ 28, 29, 30, 31, 32, 33, 34, 35,
366
+ 54, 37, 37, 55, 39, 0, 39, 40,
367
+ 40, 41, 56, 0, 43, 47, 44, 45,
368
+ 44, 57, 46, 46, 57, 47, 57, 49,
369
+ 50, 1, 49, 50, 1, 49, 50, 1,
370
+ 49, 50, 1, 49, 50, 1, 49, 50,
371
+ 1, 49, 50, 1, 49, 50, 1, 49,
372
+ 50, 1
373
+ ]
374
+
375
+ class << self
376
+ attr_accessor :_markup_trans_actions
377
+ private :_markup_trans_actions, :_markup_trans_actions=
378
+ end
379
+ self._markup_trans_actions = [
380
+ 2, 1, 0, 0, 0, 0, 3, 4,
381
+ 3, 5, 0, 6, 0, 0, 7, 8,
382
+ 9, 7, 0, 0, 10, 0, 11, 12,
383
+ 13, 14, 15, 16, 15, 17, 18, 19,
384
+ 20, 21, 20, 10, 11, 12, 14, 17,
385
+ 19, 0, 0, 0, 0, 0, 0, 0,
386
+ 0, 0, 0, 0, 0, 0, 0, 0,
387
+ 0, 0, 0, 0, 0, 0, 0, 0,
388
+ 0, 2, 0, 9, 2, 25, 0, 26,
389
+ 0, 27, 0, 28, 0, 29, 29, 0,
390
+ 0, 30, 29, 0, 31, 0, 32, 33,
391
+ 34, 35, 12, 14, 37, 17, 19, 39,
392
+ 41, 42, 43, 45, 46, 47, 49, 50,
393
+ 51, 53, 54, 55, 57, 58, 59, 61,
394
+ 62, 63
395
+ ]
396
+
397
+ class << self
398
+ attr_accessor :_markup_eof_actions
399
+ private :_markup_eof_actions, :_markup_eof_actions=
400
+ end
401
+ self._markup_eof_actions = [
402
+ 0, 1, 1, 1, 1, 1, 1, 1,
403
+ 1, 1, 1, 1, 1, 1, 1, 0,
404
+ 0, 22, 22, 22, 0, 0, 0, 0,
405
+ 0, 0, 23, 0, 0, 0, 0, 0,
406
+ 0, 24, 24, 24, 1, 1, 25, 25,
407
+ 25, 25, 28, 28, 28, 28, 28, 28,
408
+ 0, 36, 38, 40, 44, 48, 52, 56,
409
+ 60, 0
410
+ ]
411
+
412
+ class << self
413
+ attr_accessor :markup_start
414
+ end
415
+ self.markup_start = 48;
416
+ class << self
417
+ attr_accessor :markup_first_final
418
+ end
419
+ self.markup_first_final = 48;
420
+ class << self
421
+ attr_accessor :markup_error
422
+ end
423
+ self.markup_error = 0;
424
+
425
+ class << self
426
+ attr_accessor :markup_en_parse_entity
427
+ end
428
+ self.markup_en_parse_entity = 42;
429
+ class << self
430
+ attr_accessor :markup_en_main
431
+ end
432
+ self.markup_en_main = 48;
433
+
434
+
435
+ # line 206 "markup.rl"
436
+
437
+ def self.parse_markup(buffer, delegate, entities)
438
+ data = buffer.read
439
+ bytes = data.bytes
440
+
441
+ p = 0
442
+ # Must set pe here or it gets incorrectly set to data.length
443
+ pe = eof = data.bytesize
444
+ stack = []
445
+
446
+ pcdata = nil
447
+ characters_begin = characters_end = nil
448
+ entity_begin = entity_end = nil
449
+ identifier_begin = identifier_end = nil
450
+ doctype_begin = doctype_end = nil
451
+ comment_begin = comment_end = nil
452
+ instruction_begin = instruction_end = nil
453
+ cdata_begin = cdata_end = nil
454
+ has_value = false
455
+
456
+
457
+ # line 458 "markup.rb"
458
+ begin
459
+ p ||= 0
460
+ pe ||= data.length
461
+ cs = markup_start
462
+ top = 0
463
+ end
464
+
465
+ # line 227 "markup.rl"
466
+
467
+ # line 468 "markup.rb"
468
+ begin
469
+ testEof = false
470
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
471
+ _goto_level = 0
472
+ _resume = 10
473
+ _eof_trans = 15
474
+ _again = 20
475
+ _test_eof = 30
476
+ _out = 40
477
+ while true
478
+ if _goto_level <= 0
479
+ if p == pe
480
+ _goto_level = _test_eof
481
+ next
482
+ end
483
+ if cs == 0
484
+ _goto_level = _out
485
+ next
486
+ end
487
+ end
488
+ if _goto_level <= _resume
489
+ _keys = cs << 1
490
+ _inds = _markup_index_offsets[cs]
491
+ _slen = _markup_key_spans[cs]
492
+ _wide = ( bytes[p])
493
+ _trans = if ( _slen > 0 &&
494
+ _markup_trans_keys[_keys] <= _wide &&
495
+ _wide <= _markup_trans_keys[_keys + 1]
496
+ ) then
497
+ _markup_indicies[ _inds + _wide - _markup_trans_keys[_keys] ]
498
+ else
499
+ _markup_indicies[ _inds + _slen ]
500
+ end
501
+ cs = _markup_trans_targs[_trans]
502
+ if _markup_trans_actions[_trans] != 0
503
+ case _markup_trans_actions[_trans]
504
+ when 2 then
505
+ # line 24 "markup.rl"
506
+ begin
507
+
508
+ identifier_begin = p
509
+ end
510
+ when 9 then
511
+ # line 28 "markup.rl"
512
+ begin
513
+
514
+ identifier_end = p
515
+ end
516
+ when 18 then
517
+ # line 36 "markup.rl"
518
+ begin
519
+
520
+ end
521
+ when 17 then
522
+ # line 39 "markup.rl"
523
+ begin
524
+
525
+ characters_begin = p
526
+ end
527
+ when 28 then
528
+ # line 49 "markup.rl"
529
+ begin
530
+
531
+ raise ParseError.new("could not parse entity", buffer, p)
532
+ end
533
+ when 29 then
534
+ # line 53 "markup.rl"
535
+ begin
536
+
537
+ entity_begin = p
538
+ end
539
+ when 27 then
540
+ # line 112 "markup.rl"
541
+ begin
542
+
543
+ end
544
+ when 25 then
545
+ # line 119 "markup.rl"
546
+ begin
547
+
548
+ raise ParseError.new("could not parse instruction", buffer, p)
549
+ end
550
+ when 6 then
551
+ # line 132 "markup.rl"
552
+ begin
553
+
554
+ self_closing = true
555
+ end
556
+ when 1 then
557
+ # line 170 "markup.rl"
558
+ begin
559
+
560
+ raise ParseError.new("could not parse tag", buffer, p)
561
+ end
562
+ when 19 then
563
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
564
+ begin
565
+ begin
566
+ stack[top] = cs
567
+ top+= 1
568
+ cs = 42
569
+ _goto_level = _again
570
+ next
571
+ end
572
+ end
573
+ when 26 then
574
+ # line 28 "markup.rl"
575
+ begin
576
+
577
+ identifier_end = p
578
+ end
579
+ # line 109 "markup.rl"
580
+ begin
581
+
582
+ end
583
+ when 3 then
584
+ # line 28 "markup.rl"
585
+ begin
586
+
587
+ identifier_end = p
588
+ end
589
+ # line 123 "markup.rl"
590
+ begin
591
+
592
+ self_closing = false
593
+
594
+ delegate.open_tag_begin(data.byteslice(identifier_begin...identifier_end), identifier_begin)
595
+ end
596
+ when 7 then
597
+ # line 28 "markup.rl"
598
+ begin
599
+
600
+ identifier_end = p
601
+ end
602
+ # line 149 "markup.rl"
603
+ begin
604
+
605
+ if has_value
606
+ value = pcdata
607
+ else
608
+ value = true
609
+ end
610
+
611
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
612
+ end
613
+ when 10 then
614
+ # line 32 "markup.rl"
615
+ begin
616
+
617
+ pcdata = ""
618
+ end
619
+ # line 39 "markup.rl"
620
+ begin
621
+
622
+ characters_begin = p
623
+ end
624
+ when 11 then
625
+ # line 32 "markup.rl"
626
+ begin
627
+
628
+ pcdata = ""
629
+ end
630
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
631
+ begin
632
+ begin
633
+ stack[top] = cs
634
+ top+= 1
635
+ cs = 42
636
+ _goto_level = _again
637
+ next
638
+ end
639
+ end
640
+ when 13 then
641
+ # line 43 "markup.rl"
642
+ begin
643
+
644
+ characters_end = p
645
+
646
+ pcdata << data.byteslice(characters_begin...characters_end)
647
+ end
648
+ # line 36 "markup.rl"
649
+ begin
650
+
651
+ end
652
+ when 12 then
653
+ # line 43 "markup.rl"
654
+ begin
655
+
656
+ characters_end = p
657
+
658
+ pcdata << data.byteslice(characters_begin...characters_end)
659
+ end
660
+ # line 39 "markup.rl"
661
+ begin
662
+
663
+ characters_begin = p
664
+ end
665
+ when 14 then
666
+ # line 43 "markup.rl"
667
+ begin
668
+
669
+ characters_end = p
670
+
671
+ pcdata << data.byteslice(characters_begin...characters_end)
672
+ end
673
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
674
+ begin
675
+ begin
676
+ stack[top] = cs
677
+ top+= 1
678
+ cs = 42
679
+ _goto_level = _again
680
+ next
681
+ end
682
+ end
683
+ when 32 then
684
+ # line 57 "markup.rl"
685
+ begin
686
+
687
+ entity_end = p
688
+
689
+ name = data.byteslice(entity_begin...entity_end)
690
+
691
+ pcdata << entities[name]
692
+ end
693
+ # line 8 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
694
+ begin
695
+ begin
696
+ top -= 1
697
+ cs = stack[top]
698
+ _goto_level = _again
699
+ next
700
+ end
701
+ end
702
+ when 31 then
703
+ # line 65 "markup.rl"
704
+ begin
705
+
706
+ entity_end = p
707
+
708
+ pcdata << data.byteslice(entity_begin...entity_end).to_i(16)
709
+ end
710
+ # line 8 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
711
+ begin
712
+ begin
713
+ top -= 1
714
+ cs = stack[top]
715
+ _goto_level = _again
716
+ next
717
+ end
718
+ end
719
+ when 30 then
720
+ # line 71 "markup.rl"
721
+ begin
722
+
723
+ entity_end = p
724
+
725
+ pcdata << data.byteslice(entity_begin...entity_end).to_i(10)
726
+ end
727
+ # line 8 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
728
+ begin
729
+ begin
730
+ top -= 1
731
+ cs = stack[top]
732
+ _goto_level = _again
733
+ next
734
+ end
735
+ end
736
+ when 5 then
737
+ # line 136 "markup.rl"
738
+ begin
739
+
740
+ has_value = false
741
+ pcdata = ""
742
+ end
743
+ # line 24 "markup.rl"
744
+ begin
745
+
746
+ identifier_begin = p
747
+ end
748
+ when 15 then
749
+ # line 141 "markup.rl"
750
+ begin
751
+
752
+ has_value = true
753
+ end
754
+ # line 149 "markup.rl"
755
+ begin
756
+
757
+ if has_value
758
+ value = pcdata
759
+ else
760
+ value = true
761
+ end
762
+
763
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
764
+ end
765
+ when 20 then
766
+ # line 145 "markup.rl"
767
+ begin
768
+
769
+ has_value = true
770
+ end
771
+ # line 149 "markup.rl"
772
+ begin
773
+
774
+ if has_value
775
+ value = pcdata
776
+ else
777
+ value = true
778
+ end
779
+
780
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
781
+ end
782
+ when 4 then
783
+ # line 28 "markup.rl"
784
+ begin
785
+
786
+ identifier_end = p
787
+ end
788
+ # line 123 "markup.rl"
789
+ begin
790
+
791
+ self_closing = false
792
+
793
+ delegate.open_tag_begin(data.byteslice(identifier_begin...identifier_end), identifier_begin)
794
+ end
795
+ # line 132 "markup.rl"
796
+ begin
797
+
798
+ self_closing = true
799
+ end
800
+ when 8 then
801
+ # line 28 "markup.rl"
802
+ begin
803
+
804
+ identifier_end = p
805
+ end
806
+ # line 149 "markup.rl"
807
+ begin
808
+
809
+ if has_value
810
+ value = pcdata
811
+ else
812
+ value = true
813
+ end
814
+
815
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
816
+ end
817
+ # line 132 "markup.rl"
818
+ begin
819
+
820
+ self_closing = true
821
+ end
822
+ when 16 then
823
+ # line 141 "markup.rl"
824
+ begin
825
+
826
+ has_value = true
827
+ end
828
+ # line 149 "markup.rl"
829
+ begin
830
+
831
+ if has_value
832
+ value = pcdata
833
+ else
834
+ value = true
835
+ end
836
+
837
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
838
+ end
839
+ # line 132 "markup.rl"
840
+ begin
841
+
842
+ self_closing = true
843
+ end
844
+ when 21 then
845
+ # line 145 "markup.rl"
846
+ begin
847
+
848
+ has_value = true
849
+ end
850
+ # line 149 "markup.rl"
851
+ begin
852
+
853
+ if has_value
854
+ value = pcdata
855
+ else
856
+ value = true
857
+ end
858
+
859
+ delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
860
+ end
861
+ # line 132 "markup.rl"
862
+ begin
863
+
864
+ self_closing = true
865
+ end
866
+ when 33 then
867
+ # line 188 "markup.rl"
868
+ begin
869
+
870
+ end
871
+ # line 32 "markup.rl"
872
+ begin
873
+
874
+ pcdata = ""
875
+ end
876
+ # line 39 "markup.rl"
877
+ begin
878
+
879
+ characters_begin = p
880
+ end
881
+ when 34 then
882
+ # line 188 "markup.rl"
883
+ begin
884
+
885
+ end
886
+ # line 32 "markup.rl"
887
+ begin
888
+
889
+ pcdata = ""
890
+ end
891
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
892
+ begin
893
+ begin
894
+ stack[top] = cs
895
+ top+= 1
896
+ cs = 42
897
+ _goto_level = _again
898
+ next
899
+ end
900
+ end
901
+ when 49 then
902
+ # line 81 "markup.rl"
903
+ begin
904
+
905
+ doctype_end = p
906
+
907
+ delegate.doctype(data.byteslice(doctype_begin...doctype_end))
908
+ end
909
+ # line 188 "markup.rl"
910
+ begin
911
+
912
+ end
913
+ # line 32 "markup.rl"
914
+ begin
915
+
916
+ pcdata = ""
917
+ end
918
+ # line 39 "markup.rl"
919
+ begin
920
+
921
+ characters_begin = p
922
+ end
923
+ when 50 then
924
+ # line 81 "markup.rl"
925
+ begin
926
+
927
+ doctype_end = p
928
+
929
+ delegate.doctype(data.byteslice(doctype_begin...doctype_end))
930
+ end
931
+ # line 188 "markup.rl"
932
+ begin
933
+
934
+ end
935
+ # line 32 "markup.rl"
936
+ begin
937
+
938
+ pcdata = ""
939
+ end
940
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
941
+ begin
942
+ begin
943
+ stack[top] = cs
944
+ top+= 1
945
+ cs = 42
946
+ _goto_level = _again
947
+ next
948
+ end
949
+ end
950
+ when 45 then
951
+ # line 95 "markup.rl"
952
+ begin
953
+
954
+ comment_end = p
955
+
956
+ delegate.comment(data.byteslice(comment_begin...comment_end))
957
+ end
958
+ # line 188 "markup.rl"
959
+ begin
960
+
961
+ end
962
+ # line 32 "markup.rl"
963
+ begin
964
+
965
+ pcdata = ""
966
+ end
967
+ # line 39 "markup.rl"
968
+ begin
969
+
970
+ characters_begin = p
971
+ end
972
+ when 46 then
973
+ # line 95 "markup.rl"
974
+ begin
975
+
976
+ comment_end = p
977
+
978
+ delegate.comment(data.byteslice(comment_begin...comment_end))
979
+ end
980
+ # line 188 "markup.rl"
981
+ begin
982
+
983
+ end
984
+ # line 32 "markup.rl"
985
+ begin
986
+
987
+ pcdata = ""
988
+ end
989
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
990
+ begin
991
+ begin
992
+ stack[top] = cs
993
+ top+= 1
994
+ cs = 42
995
+ _goto_level = _again
996
+ next
997
+ end
998
+ end
999
+ when 61 then
1000
+ # line 115 "markup.rl"
1001
+ begin
1002
+
1003
+ delegate.instruction(data.byteslice(instruction_begin, p-instruction_begin))
1004
+ end
1005
+ # line 188 "markup.rl"
1006
+ begin
1007
+
1008
+ end
1009
+ # line 32 "markup.rl"
1010
+ begin
1011
+
1012
+ pcdata = ""
1013
+ end
1014
+ # line 39 "markup.rl"
1015
+ begin
1016
+
1017
+ characters_begin = p
1018
+ end
1019
+ when 62 then
1020
+ # line 115 "markup.rl"
1021
+ begin
1022
+
1023
+ delegate.instruction(data.byteslice(instruction_begin, p-instruction_begin))
1024
+ end
1025
+ # line 188 "markup.rl"
1026
+ begin
1027
+
1028
+ end
1029
+ # line 32 "markup.rl"
1030
+ begin
1031
+
1032
+ pcdata = ""
1033
+ end
1034
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
1035
+ begin
1036
+ begin
1037
+ stack[top] = cs
1038
+ top+= 1
1039
+ cs = 42
1040
+ _goto_level = _again
1041
+ next
1042
+ end
1043
+ end
1044
+ when 41 then
1045
+ # line 159 "markup.rl"
1046
+ begin
1047
+
1048
+ delegate.open_tag_end(self_closing)
1049
+ end
1050
+ # line 188 "markup.rl"
1051
+ begin
1052
+
1053
+ end
1054
+ # line 32 "markup.rl"
1055
+ begin
1056
+
1057
+ pcdata = ""
1058
+ end
1059
+ # line 39 "markup.rl"
1060
+ begin
1061
+
1062
+ characters_begin = p
1063
+ end
1064
+ when 42 then
1065
+ # line 159 "markup.rl"
1066
+ begin
1067
+
1068
+ delegate.open_tag_end(self_closing)
1069
+ end
1070
+ # line 188 "markup.rl"
1071
+ begin
1072
+
1073
+ end
1074
+ # line 32 "markup.rl"
1075
+ begin
1076
+
1077
+ pcdata = ""
1078
+ end
1079
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
1080
+ begin
1081
+ begin
1082
+ stack[top] = cs
1083
+ top+= 1
1084
+ cs = 42
1085
+ _goto_level = _again
1086
+ next
1087
+ end
1088
+ end
1089
+ when 57 then
1090
+ # line 166 "markup.rl"
1091
+ begin
1092
+
1093
+ delegate.close_tag(data.byteslice(identifier_begin...identifier_end), identifier_begin)
1094
+ end
1095
+ # line 188 "markup.rl"
1096
+ begin
1097
+
1098
+ end
1099
+ # line 32 "markup.rl"
1100
+ begin
1101
+
1102
+ pcdata = ""
1103
+ end
1104
+ # line 39 "markup.rl"
1105
+ begin
1106
+
1107
+ characters_begin = p
1108
+ end
1109
+ when 58 then
1110
+ # line 166 "markup.rl"
1111
+ begin
1112
+
1113
+ delegate.close_tag(data.byteslice(identifier_begin...identifier_end), identifier_begin)
1114
+ end
1115
+ # line 188 "markup.rl"
1116
+ begin
1117
+
1118
+ end
1119
+ # line 32 "markup.rl"
1120
+ begin
1121
+
1122
+ pcdata = ""
1123
+ end
1124
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
1125
+ begin
1126
+ begin
1127
+ stack[top] = cs
1128
+ top+= 1
1129
+ cs = 42
1130
+ _goto_level = _again
1131
+ next
1132
+ end
1133
+ end
1134
+ when 53 then
1135
+ # line 178 "markup.rl"
1136
+ begin
1137
+
1138
+ cdata_end = p
1139
+
1140
+ delegate.cdata(data.byteslice(cdata_begin...cdata_end))
1141
+ end
1142
+ # line 188 "markup.rl"
1143
+ begin
1144
+
1145
+ end
1146
+ # line 32 "markup.rl"
1147
+ begin
1148
+
1149
+ pcdata = ""
1150
+ end
1151
+ # line 39 "markup.rl"
1152
+ begin
1153
+
1154
+ characters_begin = p
1155
+ end
1156
+ when 54 then
1157
+ # line 178 "markup.rl"
1158
+ begin
1159
+
1160
+ cdata_end = p
1161
+
1162
+ delegate.cdata(data.byteslice(cdata_begin...cdata_end))
1163
+ end
1164
+ # line 188 "markup.rl"
1165
+ begin
1166
+
1167
+ end
1168
+ # line 32 "markup.rl"
1169
+ begin
1170
+
1171
+ pcdata = ""
1172
+ end
1173
+ # line 10 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/entities.rl"
1174
+ begin
1175
+ begin
1176
+ stack[top] = cs
1177
+ top+= 1
1178
+ cs = 42
1179
+ _goto_level = _again
1180
+ next
1181
+ end
1182
+ end
1183
+ when 35 then
1184
+ # line 129 "markup.rl"
1185
+ begin
1186
+
1187
+ end
1188
+ # line 163 "markup.rl"
1189
+ begin
1190
+
1191
+ end
1192
+ # line 105 "markup.rl"
1193
+ begin
1194
+
1195
+ instruction_begin = p
1196
+ end
1197
+ # line 91 "markup.rl"
1198
+ begin
1199
+
1200
+ comment_begin = p
1201
+ end
1202
+ # line 77 "markup.rl"
1203
+ begin
1204
+
1205
+ doctype_begin = p
1206
+ end
1207
+ # line 174 "markup.rl"
1208
+ begin
1209
+
1210
+ cdata_begin = p
1211
+ end
1212
+ when 51 then
1213
+ # line 81 "markup.rl"
1214
+ begin
1215
+
1216
+ doctype_end = p
1217
+
1218
+ delegate.doctype(data.byteslice(doctype_begin...doctype_end))
1219
+ end
1220
+ # line 129 "markup.rl"
1221
+ begin
1222
+
1223
+ end
1224
+ # line 163 "markup.rl"
1225
+ begin
1226
+
1227
+ end
1228
+ # line 105 "markup.rl"
1229
+ begin
1230
+
1231
+ instruction_begin = p
1232
+ end
1233
+ # line 91 "markup.rl"
1234
+ begin
1235
+
1236
+ comment_begin = p
1237
+ end
1238
+ # line 77 "markup.rl"
1239
+ begin
1240
+
1241
+ doctype_begin = p
1242
+ end
1243
+ # line 174 "markup.rl"
1244
+ begin
1245
+
1246
+ cdata_begin = p
1247
+ end
1248
+ when 47 then
1249
+ # line 95 "markup.rl"
1250
+ begin
1251
+
1252
+ comment_end = p
1253
+
1254
+ delegate.comment(data.byteslice(comment_begin...comment_end))
1255
+ end
1256
+ # line 129 "markup.rl"
1257
+ begin
1258
+
1259
+ end
1260
+ # line 163 "markup.rl"
1261
+ begin
1262
+
1263
+ end
1264
+ # line 105 "markup.rl"
1265
+ begin
1266
+
1267
+ instruction_begin = p
1268
+ end
1269
+ # line 91 "markup.rl"
1270
+ begin
1271
+
1272
+ comment_begin = p
1273
+ end
1274
+ # line 77 "markup.rl"
1275
+ begin
1276
+
1277
+ doctype_begin = p
1278
+ end
1279
+ # line 174 "markup.rl"
1280
+ begin
1281
+
1282
+ cdata_begin = p
1283
+ end
1284
+ when 63 then
1285
+ # line 115 "markup.rl"
1286
+ begin
1287
+
1288
+ delegate.instruction(data.byteslice(instruction_begin, p-instruction_begin))
1289
+ end
1290
+ # line 129 "markup.rl"
1291
+ begin
1292
+
1293
+ end
1294
+ # line 163 "markup.rl"
1295
+ begin
1296
+
1297
+ end
1298
+ # line 105 "markup.rl"
1299
+ begin
1300
+
1301
+ instruction_begin = p
1302
+ end
1303
+ # line 91 "markup.rl"
1304
+ begin
1305
+
1306
+ comment_begin = p
1307
+ end
1308
+ # line 77 "markup.rl"
1309
+ begin
1310
+
1311
+ doctype_begin = p
1312
+ end
1313
+ # line 174 "markup.rl"
1314
+ begin
1315
+
1316
+ cdata_begin = p
1317
+ end
1318
+ when 43 then
1319
+ # line 159 "markup.rl"
1320
+ begin
1321
+
1322
+ delegate.open_tag_end(self_closing)
1323
+ end
1324
+ # line 129 "markup.rl"
1325
+ begin
1326
+
1327
+ end
1328
+ # line 163 "markup.rl"
1329
+ begin
1330
+
1331
+ end
1332
+ # line 105 "markup.rl"
1333
+ begin
1334
+
1335
+ instruction_begin = p
1336
+ end
1337
+ # line 91 "markup.rl"
1338
+ begin
1339
+
1340
+ comment_begin = p
1341
+ end
1342
+ # line 77 "markup.rl"
1343
+ begin
1344
+
1345
+ doctype_begin = p
1346
+ end
1347
+ # line 174 "markup.rl"
1348
+ begin
1349
+
1350
+ cdata_begin = p
1351
+ end
1352
+ when 59 then
1353
+ # line 166 "markup.rl"
1354
+ begin
1355
+
1356
+ delegate.close_tag(data.byteslice(identifier_begin...identifier_end), identifier_begin)
1357
+ end
1358
+ # line 129 "markup.rl"
1359
+ begin
1360
+
1361
+ end
1362
+ # line 163 "markup.rl"
1363
+ begin
1364
+
1365
+ end
1366
+ # line 105 "markup.rl"
1367
+ begin
1368
+
1369
+ instruction_begin = p
1370
+ end
1371
+ # line 91 "markup.rl"
1372
+ begin
1373
+
1374
+ comment_begin = p
1375
+ end
1376
+ # line 77 "markup.rl"
1377
+ begin
1378
+
1379
+ doctype_begin = p
1380
+ end
1381
+ # line 174 "markup.rl"
1382
+ begin
1383
+
1384
+ cdata_begin = p
1385
+ end
1386
+ when 55 then
1387
+ # line 178 "markup.rl"
1388
+ begin
1389
+
1390
+ cdata_end = p
1391
+
1392
+ delegate.cdata(data.byteslice(cdata_begin...cdata_end))
1393
+ end
1394
+ # line 129 "markup.rl"
1395
+ begin
1396
+
1397
+ end
1398
+ # line 163 "markup.rl"
1399
+ begin
1400
+
1401
+ end
1402
+ # line 105 "markup.rl"
1403
+ begin
1404
+
1405
+ instruction_begin = p
1406
+ end
1407
+ # line 91 "markup.rl"
1408
+ begin
1409
+
1410
+ comment_begin = p
1411
+ end
1412
+ # line 77 "markup.rl"
1413
+ begin
1414
+
1415
+ doctype_begin = p
1416
+ end
1417
+ # line 174 "markup.rl"
1418
+ begin
1419
+
1420
+ cdata_begin = p
1421
+ end
1422
+ when 39 then
1423
+ # line 36 "markup.rl"
1424
+ begin
1425
+
1426
+ end
1427
+ # line 191 "markup.rl"
1428
+ begin
1429
+
1430
+ delegate.text(pcdata)
1431
+ end
1432
+ # line 129 "markup.rl"
1433
+ begin
1434
+
1435
+ end
1436
+ # line 163 "markup.rl"
1437
+ begin
1438
+
1439
+ end
1440
+ # line 105 "markup.rl"
1441
+ begin
1442
+
1443
+ instruction_begin = p
1444
+ end
1445
+ # line 91 "markup.rl"
1446
+ begin
1447
+
1448
+ comment_begin = p
1449
+ end
1450
+ # line 77 "markup.rl"
1451
+ begin
1452
+
1453
+ doctype_begin = p
1454
+ end
1455
+ # line 174 "markup.rl"
1456
+ begin
1457
+
1458
+ cdata_begin = p
1459
+ end
1460
+ when 37 then
1461
+ # line 43 "markup.rl"
1462
+ begin
1463
+
1464
+ characters_end = p
1465
+
1466
+ pcdata << data.byteslice(characters_begin...characters_end)
1467
+ end
1468
+ # line 36 "markup.rl"
1469
+ begin
1470
+
1471
+ end
1472
+ # line 191 "markup.rl"
1473
+ begin
1474
+
1475
+ delegate.text(pcdata)
1476
+ end
1477
+ # line 129 "markup.rl"
1478
+ begin
1479
+
1480
+ end
1481
+ # line 163 "markup.rl"
1482
+ begin
1483
+
1484
+ end
1485
+ # line 105 "markup.rl"
1486
+ begin
1487
+
1488
+ instruction_begin = p
1489
+ end
1490
+ # line 91 "markup.rl"
1491
+ begin
1492
+
1493
+ comment_begin = p
1494
+ end
1495
+ # line 77 "markup.rl"
1496
+ begin
1497
+
1498
+ doctype_begin = p
1499
+ end
1500
+ # line 174 "markup.rl"
1501
+ begin
1502
+
1503
+ cdata_begin = p
1504
+ end
1505
+ # line 1506 "markup.rb"
1506
+ end
1507
+ end
1508
+ end
1509
+ if _goto_level <= _again
1510
+ if cs == 0
1511
+ _goto_level = _out
1512
+ next
1513
+ end
1514
+ p += 1
1515
+ if p != pe
1516
+ _goto_level = _resume
1517
+ next
1518
+ end
1519
+ end
1520
+ if _goto_level <= _test_eof
1521
+ if p == eof
1522
+ case _markup_eof_actions[cs]
1523
+ when 28 then
1524
+ # line 49 "markup.rl"
1525
+ begin
1526
+
1527
+ raise ParseError.new("could not parse entity", buffer, p)
1528
+ end
1529
+ when 48 then
1530
+ # line 81 "markup.rl"
1531
+ begin
1532
+
1533
+ doctype_end = p
1534
+
1535
+ delegate.doctype(data.byteslice(doctype_begin...doctype_end))
1536
+ end
1537
+ when 23 then
1538
+ # line 87 "markup.rl"
1539
+ begin
1540
+
1541
+ raise ParseError.new("could not parse doctype", buffer, p)
1542
+ end
1543
+ when 44 then
1544
+ # line 95 "markup.rl"
1545
+ begin
1546
+
1547
+ comment_end = p
1548
+
1549
+ delegate.comment(data.byteslice(comment_begin...comment_end))
1550
+ end
1551
+ when 22 then
1552
+ # line 101 "markup.rl"
1553
+ begin
1554
+
1555
+ raise ParseError.new("could not parse comment", buffer, p)
1556
+ end
1557
+ when 60 then
1558
+ # line 115 "markup.rl"
1559
+ begin
1560
+
1561
+ delegate.instruction(data.byteslice(instruction_begin, p-instruction_begin))
1562
+ end
1563
+ when 25 then
1564
+ # line 119 "markup.rl"
1565
+ begin
1566
+
1567
+ raise ParseError.new("could not parse instruction", buffer, p)
1568
+ end
1569
+ when 40 then
1570
+ # line 159 "markup.rl"
1571
+ begin
1572
+
1573
+ delegate.open_tag_end(self_closing)
1574
+ end
1575
+ when 56 then
1576
+ # line 166 "markup.rl"
1577
+ begin
1578
+
1579
+ delegate.close_tag(data.byteslice(identifier_begin...identifier_end), identifier_begin)
1580
+ end
1581
+ when 1 then
1582
+ # line 170 "markup.rl"
1583
+ begin
1584
+
1585
+ raise ParseError.new("could not parse tag", buffer, p)
1586
+ end
1587
+ when 52 then
1588
+ # line 178 "markup.rl"
1589
+ begin
1590
+
1591
+ cdata_end = p
1592
+
1593
+ delegate.cdata(data.byteslice(cdata_begin...cdata_end))
1594
+ end
1595
+ when 24 then
1596
+ # line 184 "markup.rl"
1597
+ begin
1598
+
1599
+ raise ParseError.new("could not parse cdata", buffer, p)
1600
+ end
1601
+ when 38 then
1602
+ # line 36 "markup.rl"
1603
+ begin
1604
+
1605
+ end
1606
+ # line 191 "markup.rl"
1607
+ begin
1608
+
1609
+ delegate.text(pcdata)
1610
+ end
1611
+ when 36 then
1612
+ # line 43 "markup.rl"
1613
+ begin
1614
+
1615
+ characters_end = p
1616
+
1617
+ pcdata << data.byteslice(characters_begin...characters_end)
1618
+ end
1619
+ # line 36 "markup.rl"
1620
+ begin
1621
+
1622
+ end
1623
+ # line 191 "markup.rl"
1624
+ begin
1625
+
1626
+ delegate.text(pcdata)
1627
+ end
1628
+ # line 1629 "markup.rb"
1629
+ end
1630
+ end
1631
+
1632
+ end
1633
+ if _goto_level <= _out
1634
+ break
1635
+ end
1636
+ end
1637
+ end
1638
+
1639
+ # line 228 "markup.rl"
1640
+
1641
+ if p != eof
1642
+ raise ParseError.new("could not consume all input", buffer, p)
1643
+ end
1644
+
1645
+ return nil
1646
+ end
1647
+ end
1648
+ end