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

Version Path
antelope-0.2.0 spec/support/grammar_helper.rb
antelope-0.1.11 spec/support/grammar_helper.rb
antelope-0.1.10 spec/support/grammar_helper.rb
antelope-0.1.9 spec/support/grammar_helper.rb
antelope-0.1.8 spec/support/grammar_helper.rb
antelope-0.1.7 spec/support/grammar_helper.rb
antelope-0.1.6 spec/support/grammar_helper.rb
antelope-0.1.5 spec/support/grammar_helper.rb
antelope-0.1.4 spec/support/grammar_helper.rb
antelope-0.1.3 spec/support/grammar_helper.rb
antelope-0.1.2 spec/support/grammar_helper.rb