module Protopuffs

  # The Protopuffs::Parser module holds wrapper classes that parse input
  # strings using Treetop. They also set off the building of an abstract
  # syntax tree from Treetop's parse tree.
  module Parser

    class ProtocolBufferDescriptor
      def initialize
        Treetop.load "lib/protopuffs/parser/protocol_buffer"
        @parser = Protopuffs::ProtocolBufferParser.new
      end

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

  end
end
module Protopuffs

  # The Protopuffs::Parser module holds wrapper classes that parse input
  # strings using Treetop. They also set off the building of an abstract
  # syntax tree from Treetop's parse tree.
  module Parser

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

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

  end
end
Fix that loading the message descriptor grammar file only worked from certain working directories
Fix that loading the message descriptor grammar file only worked from certain working directories
