Class: Protopuffs::Parser::ProtocolBufferDescriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/protopuffs/parser/parser.rb

Instance Method Summary collapse

Constructor Details

#initializeProtocolBufferDescriptor

Returns a new instance of ProtocolBufferDescriptor.



9
10
11
12
# File 'lib/protopuffs/parser/parser.rb', line 9

def initialize
  Treetop.load File.join(File.dirname(__FILE__), "protocol_buffer")
  @parser = Protopuffs::ProtocolBufferParser.new
end

Instance Method Details

#parse(input) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/protopuffs/parser/parser.rb', line 14

def parse(input)
  parse_tree = @parser.parse(input)
  parse_tree.build
  parse_tree
rescue
  raise ParseError
end