Class: MrbParser::DebugInfoFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDebugInfoFile

Returns a new instance of DebugInfoFile.



11
12
# File 'lib/mrb_parser/debug_info_file.rb', line 11

def initialize
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



4
5
6
# File 'lib/mrb_parser/debug_info_file.rb', line 4

def filename
  @filename
end

#line_aryObject

Returns the value of attribute line_ary.



9
10
11
# File 'lib/mrb_parser/debug_info_file.rb', line 9

def line_ary
  @line_ary
end

#line_entry_countObject

Returns the value of attribute line_entry_count.



5
6
7
# File 'lib/mrb_parser/debug_info_file.rb', line 5

def line_entry_count
  @line_entry_count
end

#line_flat_mapObject

Returns the value of attribute line_flat_map.



8
9
10
# File 'lib/mrb_parser/debug_info_file.rb', line 8

def line_flat_map
  @line_flat_map
end

#line_typeObject

Returns the value of attribute line_type.



6
7
8
# File 'lib/mrb_parser/debug_info_file.rb', line 6

def line_type
  @line_type
end

#start_posObject

Returns the value of attribute start_pos.



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

def start_pos
  @start_pos
end

Instance Method Details

#dump(n = 2) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mrb_parser/debug_info_file.rb', line 19

def dump(n = 2)
  printf_indent n, "*** DEBUG INFO FILE ***\n"
  printf_indent n, "start: %d\n", @start_pos
  printf_indent n, "fname: %s\n", @filename
  printf_indent n, "line type: %d (%s)\n", @line_type,
                                           MrbParser::DebugInfo::LINE_TYPE[@line_type]
  printf_indent n, "lines: %d\n", @line_entry_count
  case @line_type
  when MrbParser::DebugInfo::MRB_DEBUG_LINE_ARY
    @line_ary.each do |line|
      printf_indent n, "  line: %d\n", line
    end
  when MrbParser::DebugInfo::MRB_DEBUG_LINE_FLAT_MAP
    @line_flat_map.each do |map|
      printf_indent n, "  line: %d, start_pos: %d\n", map[:line], map[:start_pos]
    end
  end

  printf_indent n, "*** ***\n"
end

#printf_indent(n, *args) ⇒ Object



14
15
16
17
# File 'lib/mrb_parser/debug_info_file.rb', line 14

def printf_indent(n, *args)
  print " "*n
  printf *args
end