Sha256: 8c05cff6472c076d57a2036f70abbeed041ba889e67691c3f859c7e936583594

Contents?: true

Size: 1.06 KB

Versions: 70

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")

module GrammarCompositionSpec
  describe "several composed grammars" do
    before do
      dir = File.dirname(__FILE__)
      Treetop.load File.join(dir, 'a')
      Treetop.load File.join(dir, 'b')
      Treetop.load File.join(dir, 'c')
      # Check that polyglot finds d.treetop and loads it:
      $: << dir
      require 'd'
  
      @c = ::Test::CParser.new
      @d = ::Test::DParser.new
    end

    specify "rules in C have access to rules defined in A and B" do
      @c.parse('abc').should_not be_nil
    end

    specify "rules in C can override rules in A and B with super semantics" do
      @d.parse('superkeywordworks').should_not be_nil
    end
  end
  
  describe "composed grammar chaining with require" do
    before do
      # Load f with polyglot without using the load path:
      require File.dirname(__FILE__) + '/f'
  
      @f = ::Test::FParser.new
    end
    
    specify "rules in F have access to rule defined in E" do
      @f.parse('abcef').should_not be_nil
    end
    
  end
end

Version data entries

70 entries across 70 versions & 4 rubygems

Version Path
cloudhead-less-1.0.1 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.10 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.13 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.16 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.2 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.3 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.4 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.5 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.6 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.8 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.0.9 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.0 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.1 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.10 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.11 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.12 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.13 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.2 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.3 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
cloudhead-less-1.1.4 lib/vendor/treetop/spec/composition/grammar_composition_spec.rb