Class: MrbParser::LinenoSection

Inherits:
Section
  • Object
show all
Defined in:
lib/mrb_parser/lineno_section.rb

Constant Summary

Constants inherited from Section

Section::BINARY_EOF, Section::DEBUG_IDENTIFIER, Section::IREP_IDENTIFIER, Section::LINENO_IDENTIFIER

Instance Attribute Summary

Attributes inherited from Section

#signature, #size

Instance Method Summary collapse

Methods inherited from Section

#end?, #parse, parse

Constructor Details

#initializeLinenoSection

Returns a new instance of LinenoSection.



3
4
5
# File 'lib/mrb_parser/lineno_section.rb', line 3

def initialize(*)
  super
end

Instance Method Details

#dumpObject



27
28
29
30
31
32
# File 'lib/mrb_parser/lineno_section.rb', line 27

def dump
  printf "*** LINENO SECTION ***\n"
  printf "secID : %s\n", @signature
  printf "size  : %s\n", @size
  printf "*** ***\n"
end

#parse_body(parser, irep_record = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mrb_parser/lineno_section.rb', line 7

def parse_body(parser, irep_record = nil)
  record_size = parser.read_uint32
  @filename = parser.read_n16string
  @niseq = parser.read_uint32
  @lines = []
  @niseq.times do |i|
    line = parser.read_uint16
    @lines << line
  end

  unless irep_record
    irep_record = parser.irep_section.rec
  end
  irep_record.debug_info = self

  irep_record.recs.each do |rec|
    parse_body(parser, rec)
  end
end