Class: Baykit::BayServer::Bcf::BcfParser

Inherits:
Object
  • Object
show all
Defined in:
lib/baykit/bayserver/bcf/bcf_parser.rb

Defined Under Namespace

Classes: LineInfo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBcfParser

Returns a new instance of BcfParser.



29
30
31
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 29

def initialize
  @indent_map = []
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name.



10
11
12
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 10

def file_name
  @file_name
end

#indent_mapObject (readonly)

Returns the value of attribute indent_map.



14
15
16
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 14

def indent_map
  @indent_map
end

#inputObject (readonly)

Returns the value of attribute input.



12
13
14
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 12

def input
  @input
end

#line_noObject (readonly)

Returns the value of attribute line_no.



11
12
13
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 11

def line_no
  @line_no
end

#prev_line_infoObject (readonly)

Returns the value of attribute prev_line_info.



13
14
15
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 13

def prev_line_info
  @prev_line_info
end

Instance Method Details

#parse(file) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/baykit/bayserver/bcf/bcf_parser.rb', line 33

def parse(file)
  doc = BcfDocument.new

  @file_name = file
  @line_no = 0
  @input = File.open(file)
  parse_same_level(doc.content_list, 0)
  @input.close
  return doc
end