Sha256: 9a066f9984095b095daae71954f879bfc057f69a74f66dd0b0135bc32e32ea7c
Contents?: true
Size: 647 Bytes
Versions: 3
Compression:
Stored size: 647 Bytes
Contents
require 'treetop' module Xdrgen class Parser delegate :failure_line, to: :@grammar def initialize @grammar = XdrMainGrammarParser.new end def parse(data) @grammar.parse(data).tap do |tree| if(tree.nil?) raise Xdrgen::ParseError, "Couldn't parse, failed at: #{@grammar.failure_line}:#{@grammar.failure_column}\n#{@grammar.failure_reason}" end end end end end grammars = %w( base declaration enum const struct union typedef namespace comments main ) # load the grammar files grammars.each do |g| Treetop.load("#{__dir__}/grammar/#{g}.treetop") end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xdrgen-0.1.1 | lib/xdrgen/parser.rb |
xdrgen-0.1.0 | lib/xdrgen/parser.rb |
xdrgen-0.0.1 | lib/xdrgen/parser.rb |