Class: Tengai::BodyDataSheetParser

Inherits:
Object
  • Object
show all
Defined in:
ext/horizons/body_data_sheet_parser.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._body_data_sheet_parser_actionsObject

Returns the value of attribute _body_data_sheet_parser_actions.



166
167
168
# File 'ext/horizons/body_data_sheet_parser.rb', line 166

def _body_data_sheet_parser_actions
  @_body_data_sheet_parser_actions
end

._body_data_sheet_parser_index_offsetsObject

Returns the value of attribute _body_data_sheet_parser_index_offsets.



255
256
257
# File 'ext/horizons/body_data_sheet_parser.rb', line 255

def _body_data_sheet_parser_index_offsets
  @_body_data_sheet_parser_index_offsets
end

._body_data_sheet_parser_indiciesObject

Returns the value of attribute _body_data_sheet_parser_indicies.



268
269
270
# File 'ext/horizons/body_data_sheet_parser.rb', line 268

def _body_data_sheet_parser_indicies
  @_body_data_sheet_parser_indicies
end

._body_data_sheet_parser_key_offsetsObject

Returns the value of attribute _body_data_sheet_parser_key_offsets.



175
176
177
# File 'ext/horizons/body_data_sheet_parser.rb', line 175

def _body_data_sheet_parser_key_offsets
  @_body_data_sheet_parser_key_offsets
end

._body_data_sheet_parser_range_lengthsObject

Returns the value of attribute _body_data_sheet_parser_range_lengths.



242
243
244
# File 'ext/horizons/body_data_sheet_parser.rb', line 242

def _body_data_sheet_parser_range_lengths
  @_body_data_sheet_parser_range_lengths
end

._body_data_sheet_parser_single_lengthsObject

Returns the value of attribute _body_data_sheet_parser_single_lengths.



229
230
231
# File 'ext/horizons/body_data_sheet_parser.rb', line 229

def _body_data_sheet_parser_single_lengths
  @_body_data_sheet_parser_single_lengths
end

._body_data_sheet_parser_trans_actionsObject

Returns the value of attribute _body_data_sheet_parser_trans_actions.



317
318
319
# File 'ext/horizons/body_data_sheet_parser.rb', line 317

def _body_data_sheet_parser_trans_actions
  @_body_data_sheet_parser_trans_actions
end

._body_data_sheet_parser_trans_keysObject

Returns the value of attribute _body_data_sheet_parser_trans_keys.



188
189
190
# File 'ext/horizons/body_data_sheet_parser.rb', line 188

def _body_data_sheet_parser_trans_keys
  @_body_data_sheet_parser_trans_keys
end

._body_data_sheet_parser_trans_targsObject

Returns the value of attribute _body_data_sheet_parser_trans_targs.



304
305
306
# File 'ext/horizons/body_data_sheet_parser.rb', line 304

def _body_data_sheet_parser_trans_targs
  @_body_data_sheet_parser_trans_targs
end

.body_data_sheet_parser_en_mainObject

Returns the value of attribute body_data_sheet_parser_en_main.



343
344
345
# File 'ext/horizons/body_data_sheet_parser.rb', line 343

def body_data_sheet_parser_en_main
  @body_data_sheet_parser_en_main
end

.body_data_sheet_parser_errorObject

Returns the value of attribute body_data_sheet_parser_error.



338
339
340
# File 'ext/horizons/body_data_sheet_parser.rb', line 338

def body_data_sheet_parser_error
  @body_data_sheet_parser_error
end

.body_data_sheet_parser_first_finalObject

Returns the value of attribute body_data_sheet_parser_first_final.



334
335
336
# File 'ext/horizons/body_data_sheet_parser.rb', line 334

def body_data_sheet_parser_first_final
  @body_data_sheet_parser_first_final
end

.body_data_sheet_parser_startObject

Returns the value of attribute body_data_sheet_parser_start.



330
331
332
# File 'ext/horizons/body_data_sheet_parser.rb', line 330

def body_data_sheet_parser_start
  @body_data_sheet_parser_start
end

Class Method Details

.parse(data) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'ext/horizons/body_data_sheet_parser.rb', line 12

def self.parse(data)
  data = data.unpack('c*') if data.is_a? String
  eof = data.length

  
# line 18 "ext/horizons/body_data_sheet_parser.rb"
begin
	p ||= 0
	pe ||= data.length
	cs = body_data_sheet_parser_start
end

# line 43 "ext/horizons/body_data_sheet_parser.rl"
  
# line 27 "ext/horizons/body_data_sheet_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
	if cs == 0
		_goto_level = _out
		next
	end
	end
	if _goto_level <= _resume
	_keys = _body_data_sheet_parser_key_offsets[cs]
	_trans = _body_data_sheet_parser_index_offsets[cs]
	_klen = _body_data_sheet_parser_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].ord < _body_data_sheet_parser_trans_keys[_mid]
        _upper = _mid - 1
     elsif data[p].ord > _body_data_sheet_parser_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 = _body_data_sheet_parser_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].ord < _body_data_sheet_parser_trans_keys[_mid]
       _upper = _mid - 2
     elsif data[p].ord > _body_data_sheet_parser_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 = _body_data_sheet_parser_indicies[_trans]
	cs = _body_data_sheet_parser_trans_targs[_trans]
	if _body_data_sheet_parser_trans_actions[_trans] != 0
		_acts = _body_data_sheet_parser_trans_actions[_trans]
		_nacts = _body_data_sheet_parser_actions[_acts]
		_acts += 1
		while _nacts > 0
			_nacts -= 1
			_acts += 1
			case _body_data_sheet_parser_actions[_acts - 1]
when 0 then
# line 5 "ext/horizons/body_data_sheet_parser.rl"
		begin
 mark = p 		end
when 1 then
# line 7 "ext/horizons/body_data_sheet_parser.rl"
		begin

_revised_on = data[mark..p].pack('c*')
end
when 2 then
# line 11 "ext/horizons/body_data_sheet_parser.rl"
		begin

_name = data[mark..p - 1].pack('c*')
end
when 3 then
# line 15 "ext/horizons/body_data_sheet_parser.rl"
		begin

_id = data[mark..p].pack('c*')
end
# line 130 "ext/horizons/body_data_sheet_parser.rb"
			end # action switch
		end
	end
	if _trigger_goto
		next
	end
	end
	if _goto_level <= _again
	if cs == 0
		_goto_level = _out
		next
	end
	p += 1
	if p != pe
		_goto_level = _resume
		next
	end
	end
	if _goto_level <= _test_eof
	end
	if _goto_level <= _out
		break
	end
	end
	end

# line 44 "ext/horizons/body_data_sheet_parser.rl"

  { revised_on:  Date.parse(_revised_on),
    name:        _name,
    id:          _id.to_i }
end