Sha256: 0de7e37ab863041e63e92e8eb3983342e9c0a786b1f9dac5f28a408099eec388
Contents?: true
Size: 456 Bytes
Versions: 11
Compression:
Stored size: 456 Bytes
Contents
module GrammarHelper def grammar_for(grammar_file = "simple") source_path = Pathname.new("../../fixtures").expand_path(__FILE__) Ace::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) recognizer = Generation::Recognizer.new(grammar).call grammar end alias_method :simple_grammar, :grammar_for end
Version data entries
11 entries across 11 versions & 1 rubygems