Sha256: 76773639811077f5246f51494ca3f22a6f0cab5edb75b0f434a50d1c35dd703e

Contents?: true

Size: 437 Bytes

Versions: 2

Compression:

Stored size: 437 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.4.1 spec/support/grammar_helper.rb
antelope-0.4.0 spec/support/grammar_helper.rb