Module: WOoo::Electronics::IntelHex
- Includes:
- Treetop::Runtime
- Included in:
- IntelHexParser
- Defined in:
- lib/wo_oo/electronics/intel_hex_grammar.rb
Defined Under Namespace
Modules: Address0, ByteCount0, Checksum0, Data0, DataLine0, DataLine1, File0, File1, RecordType0
Instance Method Summary collapse
- #_nt_address ⇒ Object
- #_nt_byte_count ⇒ Object
- #_nt_checksum ⇒ Object
- #_nt_data ⇒ Object
- #_nt_data_line ⇒ Object
- #_nt_eof_line ⇒ Object
- #_nt_file ⇒ Object
- #_nt_hex_value ⇒ Object
- #_nt_record_type ⇒ Object
- #root ⇒ Object
Instance Method Details
#_nt_address ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 240 def _nt_address start_index = index if node_cache[:address].has_key?(index) cached = node_cache[:address][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_hex_value s0 << r1 if r1 r2 = _nt_hex_value s0 << r2 if r2 r3 = _nt_hex_value s0 << r3 if r3 r4 = _nt_hex_value s0 << r4 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Address0) else @index = i0 r0 = nil end node_cache[:address][start_index] = r0 r0 end |
#_nt_byte_count ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 191 def _nt_byte_count start_index = index if node_cache[:byte_count].has_key?(index) cached = node_cache[:byte_count][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_hex_value s0 << r1 if r1 r2 = _nt_hex_value s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(ByteCount0) else @index = i0 r0 = nil end node_cache[:byte_count][start_index] = r0 r0 end |
#_nt_checksum ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 384 def _nt_checksum start_index = index if node_cache[:checksum].has_key?(index) cached = node_cache[:checksum][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_hex_value s0 << r1 if r1 r2 = _nt_hex_value s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Checksum0) else @index = i0 r0 = nil end node_cache[:checksum][start_index] = r0 r0 end |
#_nt_data ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 327 def _nt_data start_index = index if node_cache[:data].has_key?(index) cached = node_cache[:data][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do i1, s1 = index, [] r2 = _nt_hex_value s1 << r2 if r2 i3 = index r4 = _nt_checksum if r4 @index = i3 r3 = instantiate_node(SyntaxNode,input, index...index) else r3 = nil end s1 << r3 end if s1.last r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(Data0) else @index = i1 r1 = nil end if r1 s0 << r1 else break end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:data][start_index] = r0 r0 end |
#_nt_data_line ⇒ Object
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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 106 def _nt_data_line start_index = index if node_cache[:data_line].has_key?(index) cached = node_cache[:data_line][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] i1 = index r2 = _nt_eof_line if r2 r1 = nil else @index = i1 r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 if has_terminal?(":", false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(":") r3 = nil end s0 << r3 if r3 r4 = _nt_byte_count s0 << r4 if r4 r5 = _nt_address s0 << r5 if r5 r6 = _nt_record_type s0 << r6 if r6 r7 = _nt_data s0 << r7 if r7 r8 = _nt_checksum s0 << r8 if r8 if has_terminal?("\n", false, index) r9 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("\n") r9 = nil end s0 << r9 end end end end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(DataLine0) r0.extend(DataLine1) else @index = i0 r0 = nil end node_cache[:data_line][start_index] = r0 r0 end |
#_nt_eof_line ⇒ Object
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 455 def _nt_eof_line start_index = index if node_cache[:eof_line].has_key?(index) cached = node_cache[:eof_line][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?(":00000001FF", false, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 11)) @index += 11 else terminal_parse_failure(":00000001FF") r0 = nil end node_cache[:eof_line][start_index] = r0 r0 end |
#_nt_file ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 35 def _nt_file start_index = index if node_cache[:file].has_key?(index) cached = node_cache[:file][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] s1, i1 = [], index loop do r2 = _nt_data_line if r2 s1 << r2 else break end end r1 = instantiate_node(SyntaxNode,input, i1...index, s1) s0 << r1 if r1 r3 = _nt_eof_line s0 << r3 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(File0) r0.extend(File1) else @index = i0 r0 = nil end node_cache[:file][start_index] = r0 r0 end |
#_nt_hex_value ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 415 def _nt_hex_value start_index = index if node_cache[:hex_value].has_key?(index) cached = node_cache[:hex_value][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('\G[0-9]', true, index) r1 = true @index += 1 else r1 = nil end if r1 r0 = r1 else if has_terminal?('\G[A-F]', true, index) r2 = true @index += 1 else r2 = nil end if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:hex_value][start_index] = r0 r0 end |
#_nt_record_type ⇒ Object
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 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 289 def _nt_record_type start_index = index if node_cache[:record_type].has_key?(index) cached = node_cache[:record_type][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_hex_value s0 << r1 if r1 r2 = _nt_hex_value s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(RecordType0) else @index = i0 r0 = nil end node_cache[:record_type][start_index] = r0 r0 end |
#root ⇒ Object
11 12 13 |
# File 'lib/wo_oo/electronics/intel_hex_grammar.rb', line 11 def root @root ||= :file end |