tuple_parser 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tuple_parser/multi_tuple_parser.rb +351 -0
- data/lib/tuple_parser/tuple_parser.rb +325 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8e1f415c2656ee8be87d623a543490b14130057
|
4
|
+
data.tar.gz: 0d791c3c95b6dc35d4f7ff41e51552ef43e691fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8dab52ec9c88413cc35864c4eb3b1549e360db777468503ec68bbd4cff4abb3cd6d8eaf76c27996f5fb3094c5da3fdd50e59fd7e85b295c55b05a5b95fdf57
|
7
|
+
data.tar.gz: 59c761b29cd1d9d6ba9a86bf87dafab540610f533a969621cb6e77c8e904a5fc7209039317ae882c10c5fc4f7fdbf636d75c50c5076c59cb1e63e08511bc3839
|
@@ -0,0 +1,351 @@
|
|
1
|
+
|
2
|
+
# line 1 "lib/tuple_parser/multi_tuple_parser.rl"
|
3
|
+
=begin
|
4
|
+
|
5
|
+
# line 25 "lib/tuple_parser/multi_tuple_parser.rl"
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
class MultiTupleParser
|
10
|
+
def parse(data)
|
11
|
+
data = data.unpack("c*") if data.is_a?(String)
|
12
|
+
eof = data.length
|
13
|
+
tuples = []
|
14
|
+
tuple = []
|
15
|
+
|
16
|
+
st = 0
|
17
|
+
|
18
|
+
|
19
|
+
# line 20 "lib/tuple_parser/multi_tuple_parser.rb"
|
20
|
+
class << self
|
21
|
+
attr_accessor :_multi_tuple_lexer_actions
|
22
|
+
private :_multi_tuple_lexer_actions, :_multi_tuple_lexer_actions=
|
23
|
+
end
|
24
|
+
self._multi_tuple_lexer_actions = [
|
25
|
+
0, 1, 0, 1, 1, 1, 2, 1,
|
26
|
+
3, 1, 4, 1, 5, 1, 7, 2,
|
27
|
+
1, 0, 2, 2, 6
|
28
|
+
]
|
29
|
+
|
30
|
+
class << self
|
31
|
+
attr_accessor :_multi_tuple_lexer_key_offsets
|
32
|
+
private :_multi_tuple_lexer_key_offsets, :_multi_tuple_lexer_key_offsets=
|
33
|
+
end
|
34
|
+
self._multi_tuple_lexer_key_offsets = [
|
35
|
+
0, 0, 4, 8, 9, 10, 15, 19,
|
36
|
+
23, 24, 25, 30, 34
|
37
|
+
]
|
38
|
+
|
39
|
+
class << self
|
40
|
+
attr_accessor :_multi_tuple_lexer_trans_keys
|
41
|
+
private :_multi_tuple_lexer_trans_keys, :_multi_tuple_lexer_trans_keys=
|
42
|
+
end
|
43
|
+
self._multi_tuple_lexer_trans_keys = [
|
44
|
+
32, 40, 9, 13, 32, 39, 9, 13,
|
45
|
+
39, 39, 32, 41, 44, 9, 13, 32,
|
46
|
+
40, 9, 13, 32, 39, 9, 13, 39,
|
47
|
+
39, 32, 41, 44, 9, 13, 32, 40,
|
48
|
+
9, 13, 32, 59, 9, 13, 0
|
49
|
+
]
|
50
|
+
|
51
|
+
class << self
|
52
|
+
attr_accessor :_multi_tuple_lexer_single_lengths
|
53
|
+
private :_multi_tuple_lexer_single_lengths, :_multi_tuple_lexer_single_lengths=
|
54
|
+
end
|
55
|
+
self._multi_tuple_lexer_single_lengths = [
|
56
|
+
0, 2, 2, 1, 1, 3, 2, 2,
|
57
|
+
1, 1, 3, 2, 2
|
58
|
+
]
|
59
|
+
|
60
|
+
class << self
|
61
|
+
attr_accessor :_multi_tuple_lexer_range_lengths
|
62
|
+
private :_multi_tuple_lexer_range_lengths, :_multi_tuple_lexer_range_lengths=
|
63
|
+
end
|
64
|
+
self._multi_tuple_lexer_range_lengths = [
|
65
|
+
0, 1, 1, 0, 0, 1, 1, 1,
|
66
|
+
0, 0, 1, 1, 1
|
67
|
+
]
|
68
|
+
|
69
|
+
class << self
|
70
|
+
attr_accessor :_multi_tuple_lexer_index_offsets
|
71
|
+
private :_multi_tuple_lexer_index_offsets, :_multi_tuple_lexer_index_offsets=
|
72
|
+
end
|
73
|
+
self._multi_tuple_lexer_index_offsets = [
|
74
|
+
0, 0, 4, 8, 10, 12, 17, 21,
|
75
|
+
25, 27, 29, 34, 38
|
76
|
+
]
|
77
|
+
|
78
|
+
class << self
|
79
|
+
attr_accessor :_multi_tuple_lexer_trans_targs
|
80
|
+
private :_multi_tuple_lexer_trans_targs, :_multi_tuple_lexer_trans_targs=
|
81
|
+
end
|
82
|
+
self._multi_tuple_lexer_trans_targs = [
|
83
|
+
1, 2, 1, 0, 2, 3, 2, 0,
|
84
|
+
5, 4, 5, 4, 5, 12, 2, 5,
|
85
|
+
0, 6, 7, 6, 11, 7, 8, 7,
|
86
|
+
11, 10, 9, 10, 9, 10, 12, 7,
|
87
|
+
10, 11, 1, 2, 1, 0, 12, 6,
|
88
|
+
12, 11, 11, 11, 11, 11, 11, 11,
|
89
|
+
0
|
90
|
+
]
|
91
|
+
|
92
|
+
class << self
|
93
|
+
attr_accessor :_multi_tuple_lexer_trans_actions
|
94
|
+
private :_multi_tuple_lexer_trans_actions, :_multi_tuple_lexer_trans_actions=
|
95
|
+
end
|
96
|
+
self._multi_tuple_lexer_trans_actions = [
|
97
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
98
|
+
15, 3, 1, 0, 0, 11, 0, 0,
|
99
|
+
0, 0, 0, 0, 13, 0, 0, 0,
|
100
|
+
13, 15, 3, 1, 0, 0, 11, 0,
|
101
|
+
0, 13, 0, 0, 0, 0, 11, 5,
|
102
|
+
11, 18, 13, 13, 13, 13, 13, 18,
|
103
|
+
0
|
104
|
+
]
|
105
|
+
|
106
|
+
class << self
|
107
|
+
attr_accessor :_multi_tuple_lexer_to_state_actions
|
108
|
+
private :_multi_tuple_lexer_to_state_actions, :_multi_tuple_lexer_to_state_actions=
|
109
|
+
end
|
110
|
+
self._multi_tuple_lexer_to_state_actions = [
|
111
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
112
|
+
0, 0, 0, 7, 0
|
113
|
+
]
|
114
|
+
|
115
|
+
class << self
|
116
|
+
attr_accessor :_multi_tuple_lexer_from_state_actions
|
117
|
+
private :_multi_tuple_lexer_from_state_actions, :_multi_tuple_lexer_from_state_actions=
|
118
|
+
end
|
119
|
+
self._multi_tuple_lexer_from_state_actions = [
|
120
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
121
|
+
0, 0, 0, 9, 0
|
122
|
+
]
|
123
|
+
|
124
|
+
class << self
|
125
|
+
attr_accessor :_multi_tuple_lexer_eof_trans
|
126
|
+
private :_multi_tuple_lexer_eof_trans, :_multi_tuple_lexer_eof_trans=
|
127
|
+
end
|
128
|
+
self._multi_tuple_lexer_eof_trans = [
|
129
|
+
0, 0, 0, 0, 0, 0, 47, 47,
|
130
|
+
47, 47, 47, 0, 48
|
131
|
+
]
|
132
|
+
|
133
|
+
class << self
|
134
|
+
attr_accessor :multi_tuple_lexer_start
|
135
|
+
end
|
136
|
+
self.multi_tuple_lexer_start = 11;
|
137
|
+
class << self
|
138
|
+
attr_accessor :multi_tuple_lexer_first_final
|
139
|
+
end
|
140
|
+
self.multi_tuple_lexer_first_final = 11;
|
141
|
+
class << self
|
142
|
+
attr_accessor :multi_tuple_lexer_error
|
143
|
+
end
|
144
|
+
self.multi_tuple_lexer_error = 0;
|
145
|
+
|
146
|
+
class << self
|
147
|
+
attr_accessor :multi_tuple_lexer_en_main
|
148
|
+
end
|
149
|
+
self.multi_tuple_lexer_en_main = 11;
|
150
|
+
|
151
|
+
|
152
|
+
# line 38 "lib/tuple_parser/multi_tuple_parser.rl"
|
153
|
+
|
154
|
+
# line 155 "lib/tuple_parser/multi_tuple_parser.rb"
|
155
|
+
begin
|
156
|
+
p ||= 0
|
157
|
+
pe ||= data.length
|
158
|
+
cs = multi_tuple_lexer_start
|
159
|
+
ts = nil
|
160
|
+
te = nil
|
161
|
+
act = 0
|
162
|
+
end
|
163
|
+
|
164
|
+
# line 39 "lib/tuple_parser/multi_tuple_parser.rl"
|
165
|
+
|
166
|
+
# line 167 "lib/tuple_parser/multi_tuple_parser.rb"
|
167
|
+
begin
|
168
|
+
_klen, _trans, _keys, _acts, _nacts = nil
|
169
|
+
_goto_level = 0
|
170
|
+
_resume = 10
|
171
|
+
_eof_trans = 15
|
172
|
+
_again = 20
|
173
|
+
_test_eof = 30
|
174
|
+
_out = 40
|
175
|
+
while true
|
176
|
+
_trigger_goto = false
|
177
|
+
if _goto_level <= 0
|
178
|
+
if p == pe
|
179
|
+
_goto_level = _test_eof
|
180
|
+
next
|
181
|
+
end
|
182
|
+
if cs == 0
|
183
|
+
_goto_level = _out
|
184
|
+
next
|
185
|
+
end
|
186
|
+
end
|
187
|
+
if _goto_level <= _resume
|
188
|
+
_acts = _multi_tuple_lexer_from_state_actions[cs]
|
189
|
+
_nacts = _multi_tuple_lexer_actions[_acts]
|
190
|
+
_acts += 1
|
191
|
+
while _nacts > 0
|
192
|
+
_nacts -= 1
|
193
|
+
_acts += 1
|
194
|
+
case _multi_tuple_lexer_actions[_acts - 1]
|
195
|
+
when 4 then
|
196
|
+
# line 1 "NONE"
|
197
|
+
begin
|
198
|
+
ts = p
|
199
|
+
end
|
200
|
+
# line 201 "lib/tuple_parser/multi_tuple_parser.rb"
|
201
|
+
end # from state action switch
|
202
|
+
end
|
203
|
+
if _trigger_goto
|
204
|
+
next
|
205
|
+
end
|
206
|
+
_keys = _multi_tuple_lexer_key_offsets[cs]
|
207
|
+
_trans = _multi_tuple_lexer_index_offsets[cs]
|
208
|
+
_klen = _multi_tuple_lexer_single_lengths[cs]
|
209
|
+
_break_match = false
|
210
|
+
|
211
|
+
begin
|
212
|
+
if _klen > 0
|
213
|
+
_lower = _keys
|
214
|
+
_upper = _keys + _klen - 1
|
215
|
+
|
216
|
+
loop do
|
217
|
+
break if _upper < _lower
|
218
|
+
_mid = _lower + ( (_upper - _lower) >> 1 )
|
219
|
+
|
220
|
+
if data[p].ord < _multi_tuple_lexer_trans_keys[_mid]
|
221
|
+
_upper = _mid - 1
|
222
|
+
elsif data[p].ord > _multi_tuple_lexer_trans_keys[_mid]
|
223
|
+
_lower = _mid + 1
|
224
|
+
else
|
225
|
+
_trans += (_mid - _keys)
|
226
|
+
_break_match = true
|
227
|
+
break
|
228
|
+
end
|
229
|
+
end # loop
|
230
|
+
break if _break_match
|
231
|
+
_keys += _klen
|
232
|
+
_trans += _klen
|
233
|
+
end
|
234
|
+
_klen = _multi_tuple_lexer_range_lengths[cs]
|
235
|
+
if _klen > 0
|
236
|
+
_lower = _keys
|
237
|
+
_upper = _keys + (_klen << 1) - 2
|
238
|
+
loop do
|
239
|
+
break if _upper < _lower
|
240
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
|
241
|
+
if data[p].ord < _multi_tuple_lexer_trans_keys[_mid]
|
242
|
+
_upper = _mid - 2
|
243
|
+
elsif data[p].ord > _multi_tuple_lexer_trans_keys[_mid+1]
|
244
|
+
_lower = _mid + 2
|
245
|
+
else
|
246
|
+
_trans += ((_mid - _keys) >> 1)
|
247
|
+
_break_match = true
|
248
|
+
break
|
249
|
+
end
|
250
|
+
end # loop
|
251
|
+
break if _break_match
|
252
|
+
_trans += _klen
|
253
|
+
end
|
254
|
+
end while false
|
255
|
+
end
|
256
|
+
if _goto_level <= _eof_trans
|
257
|
+
cs = _multi_tuple_lexer_trans_targs[_trans]
|
258
|
+
if _multi_tuple_lexer_trans_actions[_trans] != 0
|
259
|
+
_acts = _multi_tuple_lexer_trans_actions[_trans]
|
260
|
+
_nacts = _multi_tuple_lexer_actions[_acts]
|
261
|
+
_acts += 1
|
262
|
+
while _nacts > 0
|
263
|
+
_nacts -= 1
|
264
|
+
_acts += 1
|
265
|
+
case _multi_tuple_lexer_actions[_acts - 1]
|
266
|
+
when 0 then
|
267
|
+
# line 5 "lib/tuple_parser/multi_tuple_parser.rl"
|
268
|
+
begin
|
269
|
+
tuple << data[st..p-1].pack("c*") end
|
270
|
+
when 1 then
|
271
|
+
# line 6 "lib/tuple_parser/multi_tuple_parser.rl"
|
272
|
+
begin
|
273
|
+
st = p end
|
274
|
+
when 2 then
|
275
|
+
# line 7 "lib/tuple_parser/multi_tuple_parser.rl"
|
276
|
+
begin
|
277
|
+
|
278
|
+
tuples.push(tuple)
|
279
|
+
tuple = []
|
280
|
+
end
|
281
|
+
when 5 then
|
282
|
+
# line 1 "NONE"
|
283
|
+
begin
|
284
|
+
te = p+1
|
285
|
+
end
|
286
|
+
when 6 then
|
287
|
+
# line 23 "lib/tuple_parser/multi_tuple_parser.rl"
|
288
|
+
begin
|
289
|
+
te = p
|
290
|
+
p = p - 1; end
|
291
|
+
when 7 then
|
292
|
+
# line 23 "lib/tuple_parser/multi_tuple_parser.rl"
|
293
|
+
begin
|
294
|
+
begin p = ((te))-1; end
|
295
|
+
end
|
296
|
+
# line 297 "lib/tuple_parser/multi_tuple_parser.rb"
|
297
|
+
end # action switch
|
298
|
+
end
|
299
|
+
end
|
300
|
+
if _trigger_goto
|
301
|
+
next
|
302
|
+
end
|
303
|
+
end
|
304
|
+
if _goto_level <= _again
|
305
|
+
_acts = _multi_tuple_lexer_to_state_actions[cs]
|
306
|
+
_nacts = _multi_tuple_lexer_actions[_acts]
|
307
|
+
_acts += 1
|
308
|
+
while _nacts > 0
|
309
|
+
_nacts -= 1
|
310
|
+
_acts += 1
|
311
|
+
case _multi_tuple_lexer_actions[_acts - 1]
|
312
|
+
when 3 then
|
313
|
+
# line 1 "NONE"
|
314
|
+
begin
|
315
|
+
ts = nil; end
|
316
|
+
# line 317 "lib/tuple_parser/multi_tuple_parser.rb"
|
317
|
+
end # to state action switch
|
318
|
+
end
|
319
|
+
if _trigger_goto
|
320
|
+
next
|
321
|
+
end
|
322
|
+
if cs == 0
|
323
|
+
_goto_level = _out
|
324
|
+
next
|
325
|
+
end
|
326
|
+
p += 1
|
327
|
+
if p != pe
|
328
|
+
_goto_level = _resume
|
329
|
+
next
|
330
|
+
end
|
331
|
+
end
|
332
|
+
if _goto_level <= _test_eof
|
333
|
+
if p == eof
|
334
|
+
if _multi_tuple_lexer_eof_trans[cs] > 0
|
335
|
+
_trans = _multi_tuple_lexer_eof_trans[cs] - 1;
|
336
|
+
_goto_level = _eof_trans
|
337
|
+
next;
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
if _goto_level <= _out
|
342
|
+
break
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
# line 40 "lib/tuple_parser/multi_tuple_parser.rl"
|
348
|
+
|
349
|
+
return tuples
|
350
|
+
end
|
351
|
+
end
|
@@ -0,0 +1,325 @@
|
|
1
|
+
|
2
|
+
# line 1 "lib/tuple_parser/tuple_parser.rl"
|
3
|
+
=begin
|
4
|
+
|
5
|
+
# line 24 "lib/tuple_parser/tuple_parser.rl"
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
class TupleParser
|
10
|
+
def parse(data)
|
11
|
+
data = data.unpack("c*") if(data.is_a?(String))
|
12
|
+
eof = data.length
|
13
|
+
tokens = []
|
14
|
+
|
15
|
+
st = 0
|
16
|
+
|
17
|
+
|
18
|
+
# line 19 "lib/tuple_parser/tuple_parser.rb"
|
19
|
+
class << self
|
20
|
+
attr_accessor :_tuple_lexer_actions
|
21
|
+
private :_tuple_lexer_actions, :_tuple_lexer_actions=
|
22
|
+
end
|
23
|
+
self._tuple_lexer_actions = [
|
24
|
+
0, 1, 0, 1, 1, 1, 2, 1,
|
25
|
+
3, 1, 4, 2, 1, 0
|
26
|
+
]
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_accessor :_tuple_lexer_key_offsets
|
30
|
+
private :_tuple_lexer_key_offsets, :_tuple_lexer_key_offsets=
|
31
|
+
end
|
32
|
+
self._tuple_lexer_key_offsets = [
|
33
|
+
0, 0, 4, 8, 9, 10, 15, 19
|
34
|
+
]
|
35
|
+
|
36
|
+
class << self
|
37
|
+
attr_accessor :_tuple_lexer_trans_keys
|
38
|
+
private :_tuple_lexer_trans_keys, :_tuple_lexer_trans_keys=
|
39
|
+
end
|
40
|
+
self._tuple_lexer_trans_keys = [
|
41
|
+
32, 40, 9, 13, 32, 39, 9, 13,
|
42
|
+
39, 39, 32, 41, 44, 9, 13, 32,
|
43
|
+
40, 9, 13, 32, 9, 13, 0
|
44
|
+
]
|
45
|
+
|
46
|
+
class << self
|
47
|
+
attr_accessor :_tuple_lexer_single_lengths
|
48
|
+
private :_tuple_lexer_single_lengths, :_tuple_lexer_single_lengths=
|
49
|
+
end
|
50
|
+
self._tuple_lexer_single_lengths = [
|
51
|
+
0, 2, 2, 1, 1, 3, 2, 1
|
52
|
+
]
|
53
|
+
|
54
|
+
class << self
|
55
|
+
attr_accessor :_tuple_lexer_range_lengths
|
56
|
+
private :_tuple_lexer_range_lengths, :_tuple_lexer_range_lengths=
|
57
|
+
end
|
58
|
+
self._tuple_lexer_range_lengths = [
|
59
|
+
0, 1, 1, 0, 0, 1, 1, 1
|
60
|
+
]
|
61
|
+
|
62
|
+
class << self
|
63
|
+
attr_accessor :_tuple_lexer_index_offsets
|
64
|
+
private :_tuple_lexer_index_offsets, :_tuple_lexer_index_offsets=
|
65
|
+
end
|
66
|
+
self._tuple_lexer_index_offsets = [
|
67
|
+
0, 0, 4, 8, 10, 12, 17, 21
|
68
|
+
]
|
69
|
+
|
70
|
+
class << self
|
71
|
+
attr_accessor :_tuple_lexer_indicies
|
72
|
+
private :_tuple_lexer_indicies, :_tuple_lexer_indicies=
|
73
|
+
end
|
74
|
+
self._tuple_lexer_indicies = [
|
75
|
+
0, 2, 0, 1, 2, 3, 2, 1,
|
76
|
+
5, 4, 7, 6, 8, 9, 2, 8,
|
77
|
+
1, 0, 2, 0, 1, 9, 9, 10,
|
78
|
+
0
|
79
|
+
]
|
80
|
+
|
81
|
+
class << self
|
82
|
+
attr_accessor :_tuple_lexer_trans_targs
|
83
|
+
private :_tuple_lexer_trans_targs, :_tuple_lexer_trans_targs=
|
84
|
+
end
|
85
|
+
self._tuple_lexer_trans_targs = [
|
86
|
+
1, 0, 2, 3, 4, 5, 4, 5,
|
87
|
+
5, 7, 6
|
88
|
+
]
|
89
|
+
|
90
|
+
class << self
|
91
|
+
attr_accessor :_tuple_lexer_trans_actions
|
92
|
+
private :_tuple_lexer_trans_actions, :_tuple_lexer_trans_actions=
|
93
|
+
end
|
94
|
+
self._tuple_lexer_trans_actions = [
|
95
|
+
0, 0, 0, 0, 3, 11, 0, 1,
|
96
|
+
0, 0, 9
|
97
|
+
]
|
98
|
+
|
99
|
+
class << self
|
100
|
+
attr_accessor :_tuple_lexer_to_state_actions
|
101
|
+
private :_tuple_lexer_to_state_actions, :_tuple_lexer_to_state_actions=
|
102
|
+
end
|
103
|
+
self._tuple_lexer_to_state_actions = [
|
104
|
+
0, 0, 0, 0, 0, 0, 5, 0
|
105
|
+
]
|
106
|
+
|
107
|
+
class << self
|
108
|
+
attr_accessor :_tuple_lexer_from_state_actions
|
109
|
+
private :_tuple_lexer_from_state_actions, :_tuple_lexer_from_state_actions=
|
110
|
+
end
|
111
|
+
self._tuple_lexer_from_state_actions = [
|
112
|
+
0, 0, 0, 0, 0, 0, 7, 0
|
113
|
+
]
|
114
|
+
|
115
|
+
class << self
|
116
|
+
attr_accessor :_tuple_lexer_eof_trans
|
117
|
+
private :_tuple_lexer_eof_trans, :_tuple_lexer_eof_trans=
|
118
|
+
end
|
119
|
+
self._tuple_lexer_eof_trans = [
|
120
|
+
0, 0, 0, 0, 0, 0, 0, 11
|
121
|
+
]
|
122
|
+
|
123
|
+
class << self
|
124
|
+
attr_accessor :tuple_lexer_start
|
125
|
+
end
|
126
|
+
self.tuple_lexer_start = 6;
|
127
|
+
class << self
|
128
|
+
attr_accessor :tuple_lexer_first_final
|
129
|
+
end
|
130
|
+
self.tuple_lexer_first_final = 6;
|
131
|
+
class << self
|
132
|
+
attr_accessor :tuple_lexer_error
|
133
|
+
end
|
134
|
+
self.tuple_lexer_error = 0;
|
135
|
+
|
136
|
+
class << self
|
137
|
+
attr_accessor :tuple_lexer_en_main
|
138
|
+
end
|
139
|
+
self.tuple_lexer_en_main = 6;
|
140
|
+
|
141
|
+
|
142
|
+
# line 36 "lib/tuple_parser/tuple_parser.rl"
|
143
|
+
|
144
|
+
# line 145 "lib/tuple_parser/tuple_parser.rb"
|
145
|
+
begin
|
146
|
+
p ||= 0
|
147
|
+
pe ||= data.length
|
148
|
+
cs = tuple_lexer_start
|
149
|
+
ts = nil
|
150
|
+
te = nil
|
151
|
+
act = 0
|
152
|
+
end
|
153
|
+
|
154
|
+
# line 37 "lib/tuple_parser/tuple_parser.rl"
|
155
|
+
|
156
|
+
# line 157 "lib/tuple_parser/tuple_parser.rb"
|
157
|
+
begin
|
158
|
+
_klen, _trans, _keys, _acts, _nacts = nil
|
159
|
+
_goto_level = 0
|
160
|
+
_resume = 10
|
161
|
+
_eof_trans = 15
|
162
|
+
_again = 20
|
163
|
+
_test_eof = 30
|
164
|
+
_out = 40
|
165
|
+
while true
|
166
|
+
_trigger_goto = false
|
167
|
+
if _goto_level <= 0
|
168
|
+
if p == pe
|
169
|
+
_goto_level = _test_eof
|
170
|
+
next
|
171
|
+
end
|
172
|
+
if cs == 0
|
173
|
+
_goto_level = _out
|
174
|
+
next
|
175
|
+
end
|
176
|
+
end
|
177
|
+
if _goto_level <= _resume
|
178
|
+
_acts = _tuple_lexer_from_state_actions[cs]
|
179
|
+
_nacts = _tuple_lexer_actions[_acts]
|
180
|
+
_acts += 1
|
181
|
+
while _nacts > 0
|
182
|
+
_nacts -= 1
|
183
|
+
_acts += 1
|
184
|
+
case _tuple_lexer_actions[_acts - 1]
|
185
|
+
when 3 then
|
186
|
+
# line 1 "NONE"
|
187
|
+
begin
|
188
|
+
ts = p
|
189
|
+
end
|
190
|
+
# line 191 "lib/tuple_parser/tuple_parser.rb"
|
191
|
+
end # from state action switch
|
192
|
+
end
|
193
|
+
if _trigger_goto
|
194
|
+
next
|
195
|
+
end
|
196
|
+
_keys = _tuple_lexer_key_offsets[cs]
|
197
|
+
_trans = _tuple_lexer_index_offsets[cs]
|
198
|
+
_klen = _tuple_lexer_single_lengths[cs]
|
199
|
+
_break_match = false
|
200
|
+
|
201
|
+
begin
|
202
|
+
if _klen > 0
|
203
|
+
_lower = _keys
|
204
|
+
_upper = _keys + _klen - 1
|
205
|
+
|
206
|
+
loop do
|
207
|
+
break if _upper < _lower
|
208
|
+
_mid = _lower + ( (_upper - _lower) >> 1 )
|
209
|
+
|
210
|
+
if data[p].ord < _tuple_lexer_trans_keys[_mid]
|
211
|
+
_upper = _mid - 1
|
212
|
+
elsif data[p].ord > _tuple_lexer_trans_keys[_mid]
|
213
|
+
_lower = _mid + 1
|
214
|
+
else
|
215
|
+
_trans += (_mid - _keys)
|
216
|
+
_break_match = true
|
217
|
+
break
|
218
|
+
end
|
219
|
+
end # loop
|
220
|
+
break if _break_match
|
221
|
+
_keys += _klen
|
222
|
+
_trans += _klen
|
223
|
+
end
|
224
|
+
_klen = _tuple_lexer_range_lengths[cs]
|
225
|
+
if _klen > 0
|
226
|
+
_lower = _keys
|
227
|
+
_upper = _keys + (_klen << 1) - 2
|
228
|
+
loop do
|
229
|
+
break if _upper < _lower
|
230
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1)
|
231
|
+
if data[p].ord < _tuple_lexer_trans_keys[_mid]
|
232
|
+
_upper = _mid - 2
|
233
|
+
elsif data[p].ord > _tuple_lexer_trans_keys[_mid+1]
|
234
|
+
_lower = _mid + 2
|
235
|
+
else
|
236
|
+
_trans += ((_mid - _keys) >> 1)
|
237
|
+
_break_match = true
|
238
|
+
break
|
239
|
+
end
|
240
|
+
end # loop
|
241
|
+
break if _break_match
|
242
|
+
_trans += _klen
|
243
|
+
end
|
244
|
+
end while false
|
245
|
+
_trans = _tuple_lexer_indicies[_trans]
|
246
|
+
end
|
247
|
+
if _goto_level <= _eof_trans
|
248
|
+
cs = _tuple_lexer_trans_targs[_trans]
|
249
|
+
if _tuple_lexer_trans_actions[_trans] != 0
|
250
|
+
_acts = _tuple_lexer_trans_actions[_trans]
|
251
|
+
_nacts = _tuple_lexer_actions[_acts]
|
252
|
+
_acts += 1
|
253
|
+
while _nacts > 0
|
254
|
+
_nacts -= 1
|
255
|
+
_acts += 1
|
256
|
+
case _tuple_lexer_actions[_acts - 1]
|
257
|
+
when 0 then
|
258
|
+
# line 5 "lib/tuple_parser/tuple_parser.rl"
|
259
|
+
begin
|
260
|
+
tokens << data[st..p-1].pack("c*") end
|
261
|
+
when 1 then
|
262
|
+
# line 6 "lib/tuple_parser/tuple_parser.rl"
|
263
|
+
begin
|
264
|
+
st = p end
|
265
|
+
when 4 then
|
266
|
+
# line 22 "lib/tuple_parser/tuple_parser.rl"
|
267
|
+
begin
|
268
|
+
te = p
|
269
|
+
p = p - 1; end
|
270
|
+
# line 271 "lib/tuple_parser/tuple_parser.rb"
|
271
|
+
end # action switch
|
272
|
+
end
|
273
|
+
end
|
274
|
+
if _trigger_goto
|
275
|
+
next
|
276
|
+
end
|
277
|
+
end
|
278
|
+
if _goto_level <= _again
|
279
|
+
_acts = _tuple_lexer_to_state_actions[cs]
|
280
|
+
_nacts = _tuple_lexer_actions[_acts]
|
281
|
+
_acts += 1
|
282
|
+
while _nacts > 0
|
283
|
+
_nacts -= 1
|
284
|
+
_acts += 1
|
285
|
+
case _tuple_lexer_actions[_acts - 1]
|
286
|
+
when 2 then
|
287
|
+
# line 1 "NONE"
|
288
|
+
begin
|
289
|
+
ts = nil; end
|
290
|
+
# line 291 "lib/tuple_parser/tuple_parser.rb"
|
291
|
+
end # to state action switch
|
292
|
+
end
|
293
|
+
if _trigger_goto
|
294
|
+
next
|
295
|
+
end
|
296
|
+
if cs == 0
|
297
|
+
_goto_level = _out
|
298
|
+
next
|
299
|
+
end
|
300
|
+
p += 1
|
301
|
+
if p != pe
|
302
|
+
_goto_level = _resume
|
303
|
+
next
|
304
|
+
end
|
305
|
+
end
|
306
|
+
if _goto_level <= _test_eof
|
307
|
+
if p == eof
|
308
|
+
if _tuple_lexer_eof_trans[cs] > 0
|
309
|
+
_trans = _tuple_lexer_eof_trans[cs] - 1;
|
310
|
+
_goto_level = _eof_trans
|
311
|
+
next;
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
if _goto_level <= _out
|
316
|
+
break
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
# line 38 "lib/tuple_parser/tuple_parser.rl"
|
322
|
+
|
323
|
+
return tokens
|
324
|
+
end
|
325
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuple_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armin Primadi
|
@@ -18,6 +18,8 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- lib/tuple_parser.rb
|
21
|
+
- lib/tuple_parser/multi_tuple_parser.rb
|
22
|
+
- lib/tuple_parser/tuple_parser.rb
|
21
23
|
homepage: https://github.com/aprimadi/tuple-parser
|
22
24
|
licenses:
|
23
25
|
- MIT
|