Sha256: b0b1552da79170757a1c33f3dfa792f227518cf71fc12dddc078de3bbbc9203c
Contents?: true
Size: 451 Bytes
Versions: 2
Compression:
Stored size: 451 Bytes
Contents
module GrammarHelper def grammar_for(grammar_file = "simple") source_path = Pathname.new("../../fixtures").expand_path(__FILE__) Grammar.from_file(source_path.children.select(&:file?) .find { |x| x.to_s =~ /#{Regexp.escape(grammar_file)}\..*\z/ }.to_s) end def with_recognizer(grammar = simple_grammar) Generation::Recognizer.new(grammar).call grammar end alias_method :simple_grammar, :grammar_for end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
antelope-0.3.2 | spec/support/grammar_helper.rb |
antelope-0.3.0 | spec/support/grammar_helper.rb |