Class: MessageParser

Inherits:
Object
  • Object
show all
Defined in:
lib/message_parser.rb

Overview

line 1 “lib/message_parser_machine.rb”

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._message_parser_machine_actionsObject

Returns the value of attribute _message_parser_machine_actions.



11
12
13
# File 'lib/message_parser.rb', line 11

def _message_parser_machine_actions
  @_message_parser_machine_actions
end

._message_parser_machine_eof_transObject

Returns the value of attribute _message_parser_machine_eof_trans.



196
197
198
# File 'lib/message_parser.rb', line 196

def _message_parser_machine_eof_trans
  @_message_parser_machine_eof_trans
end

._message_parser_machine_from_state_actionsObject

Returns the value of attribute _message_parser_machine_from_state_actions.



182
183
184
# File 'lib/message_parser.rb', line 182

def _message_parser_machine_from_state_actions
  @_message_parser_machine_from_state_actions
end

._message_parser_machine_index_offsetsObject

Returns the value of attribute _message_parser_machine_index_offsets.



91
92
93
# File 'lib/message_parser.rb', line 91

def _message_parser_machine_index_offsets
  @_message_parser_machine_index_offsets
end

._message_parser_machine_indiciesObject

Returns the value of attribute _message_parser_machine_indicies.



105
106
107
# File 'lib/message_parser.rb', line 105

def _message_parser_machine_indicies
  @_message_parser_machine_indicies
end

._message_parser_machine_key_offsetsObject

Returns the value of attribute _message_parser_machine_key_offsets.



24
25
26
# File 'lib/message_parser.rb', line 24

def _message_parser_machine_key_offsets
  @_message_parser_machine_key_offsets
end

._message_parser_machine_range_lengthsObject

Returns the value of attribute _message_parser_machine_range_lengths.



77
78
79
# File 'lib/message_parser.rb', line 77

def _message_parser_machine_range_lengths
  @_message_parser_machine_range_lengths
end

._message_parser_machine_single_lengthsObject

Returns the value of attribute _message_parser_machine_single_lengths.



63
64
65
# File 'lib/message_parser.rb', line 63

def _message_parser_machine_single_lengths
  @_message_parser_machine_single_lengths
end

._message_parser_machine_to_state_actionsObject

Returns the value of attribute _message_parser_machine_to_state_actions.



168
169
170
# File 'lib/message_parser.rb', line 168

def _message_parser_machine_to_state_actions
  @_message_parser_machine_to_state_actions
end

._message_parser_machine_trans_actionsObject

Returns the value of attribute _message_parser_machine_trans_actions.



152
153
154
# File 'lib/message_parser.rb', line 152

def _message_parser_machine_trans_actions
  @_message_parser_machine_trans_actions
end

._message_parser_machine_trans_keysObject

Returns the value of attribute _message_parser_machine_trans_keys.



38
39
40
# File 'lib/message_parser.rb', line 38

def _message_parser_machine_trans_keys
  @_message_parser_machine_trans_keys
end

._message_parser_machine_trans_targsObject

Returns the value of attribute _message_parser_machine_trans_targs.



136
137
138
# File 'lib/message_parser.rb', line 136

def _message_parser_machine_trans_targs
  @_message_parser_machine_trans_targs
end

.message_parser_machine_en_mainObject

Returns the value of attribute message_parser_machine_en_main.



223
224
225
# File 'lib/message_parser.rb', line 223

def message_parser_machine_en_main
  @message_parser_machine_en_main
end

.message_parser_machine_errorObject

Returns the value of attribute message_parser_machine_error.



218
219
220
# File 'lib/message_parser.rb', line 218

def message_parser_machine_error
  @message_parser_machine_error
end

.message_parser_machine_first_finalObject

Returns the value of attribute message_parser_machine_first_final.



214
215
216
# File 'lib/message_parser.rb', line 214

def message_parser_machine_first_final
  @message_parser_machine_first_final
end

.message_parser_machine_startObject

Returns the value of attribute message_parser_machine_start.



210
211
212
# File 'lib/message_parser.rb', line 210

def message_parser_machine_start
  @message_parser_machine_start
end

Class Method Details

.parse(msg, listener) ⇒ Object



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/message_parser.rb', line 231

def parse(msg, listener)
  data = msg.unpack("C*")
  eof = data.length

  bugid, action, name = nil

  
# line 239 "lib/message_parser.rb"
begin
	p ||= 0
	pe ||= data.length
	cs = message_parser_machine_start
	ts = nil
	te = nil
	act = 0
end

# line 40 "lib/message_parser_machine.rb"
  
# line 251 "lib/message_parser.rb"
begin
	_klen, _trans, _keys, _acts, _nacts = nil
	_goto_level = 0
	_resume = 10
	_eof_trans = 15
	_again = 20
	_test_eof = 30
	_out = 40
	while true
	_trigger_goto = false
	if _goto_level <= 0
	if p == pe
		_goto_level = _test_eof
		next
	end
	end
	if _goto_level <= _resume
	_acts = _message_parser_machine_from_state_actions[cs]
	_nacts = _message_parser_machine_actions[_acts]
	_acts += 1
	while _nacts > 0
		_nacts -= 1
		_acts += 1
		case _message_parser_machine_actions[_acts - 1]
			when 1 then
# line 1 "NONE"
		begin
ts = p
		end
# line 281 "lib/message_parser.rb"
		end # from state action switch
	end
	if _trigger_goto
		next
	end
	_keys = _message_parser_machine_key_offsets[cs]
	_trans = _message_parser_machine_index_offsets[cs]
	_klen = _message_parser_machine_single_lengths[cs]
	_break_match = false
	
	begin
	  if _klen > 0
  _lower = _keys
  _upper = _keys + _klen - 1

  loop do
     break if _upper < _lower
     _mid = _lower + ( (_upper - _lower) >> 1 )

     if data[p] < _message_parser_machine_trans_keys[_mid]
        _upper = _mid - 1
     elsif data[p] > _message_parser_machine_trans_keys[_mid]
        _lower = _mid + 1
     else
        _trans += (_mid - _keys)
        _break_match = true
        break
     end
  end # loop
  break if _break_match
  _keys += _klen
  _trans += _klen
	  end
	  _klen = _message_parser_machine_range_lengths[cs]
	  if _klen > 0
  _lower = _keys
  _upper = _keys + (_klen << 1) - 2
  loop do
     break if _upper < _lower
     _mid = _lower + (((_upper-_lower) >> 1) & ~1)
     if data[p] < _message_parser_machine_trans_keys[_mid]
       _upper = _mid - 2
     elsif data[p] > _message_parser_machine_trans_keys[_mid+1]
       _lower = _mid + 2
     else
       _trans += ((_mid - _keys) >> 1)
       _break_match = true
       break
     end
  end # loop
  break if _break_match
  _trans += _klen
	  end
	end while false
	_trans = _message_parser_machine_indicies[_trans]
	end
	if _goto_level <= _eof_trans
	cs = _message_parser_machine_trans_targs[_trans]
	if _message_parser_machine_trans_actions[_trans] != 0
		_acts = _message_parser_machine_trans_actions[_trans]
		_nacts = _message_parser_machine_actions[_acts]
		_acts += 1
		while _nacts > 0
			_nacts -= 1
			_acts += 1
			case _message_parser_machine_actions[_acts - 1]
when 2 then
# line 1 "NONE"
		begin
te = p+1
		end
when 3 then
# line 18 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.close  end
		end
when 4 then
# line 19 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.complete  end
		end
when 5 then
# line 20 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.reference  end
		end
when 6 then
# line 21 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.fix  end
		end
when 7 then
# line 22 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.reopen  end
		end
when 8 then
# line 23 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.implement  end
		end
when 9 then
# line 24 "lib/message_parser_machine.rb"
		begin
te = p+1
 begin  listener.resolve  end
		end
when 10 then
# line 26 "lib/message_parser_machine.rb"
		begin
te = p+1
		end
when 11 then
# line 18 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.close  end
		end
when 12 then
# line 19 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.complete  end
		end
when 13 then
# line 20 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.reference  end
		end
when 14 then
# line 21 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.fix  end
		end
when 15 then
# line 22 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.reopen  end
		end
when 16 then
# line 23 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.implement  end
		end
when 17 then
# line 24 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.resolve  end
		end
when 18 then
# line 25 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1; begin  listener.case(data[ts+1...te].pack("C*"))  end
		end
when 19 then
# line 26 "lib/message_parser_machine.rb"
		begin
te = p
p = p - 1;		end
when 20 then
# line 21 "lib/message_parser_machine.rb"
		begin
 begin p = ((te))-1; end
 begin  listener.fix  end
		end
when 21 then
# line 26 "lib/message_parser_machine.rb"
		begin
 begin p = ((te))-1; end
		end
# line 464 "lib/message_parser.rb"
			end # action switch
		end
	end
	if _trigger_goto
		next
	end
	end
	if _goto_level <= _again
	_acts = _message_parser_machine_to_state_actions[cs]
	_nacts = _message_parser_machine_actions[_acts]
	_acts += 1
	while _nacts > 0
		_nacts -= 1
		_acts += 1
		case _message_parser_machine_actions[_acts - 1]
when 0 then
# line 1 "NONE"
		begin
ts = nil;		end
# line 484 "lib/message_parser.rb"
		end # to state action switch
	end
	if _trigger_goto
		next
	end
	p += 1
	if p != pe
		_goto_level = _resume
		next
	end
	end
	if _goto_level <= _test_eof
	if p == eof
	if _message_parser_machine_eof_trans[cs] > 0
		_trans = _message_parser_machine_eof_trans[cs] - 1;
		_goto_level = _eof_trans
		next;
	end
end
	end
	if _goto_level <= _out
		break
	end
	end
	end

# line 41 "lib/message_parser_machine.rb"
end