Sha256: 1760825336e060ad4eed1d29717d1eb5649511a533ab146d3a7cbcc6834ef12e

Contents?: true

Size: 570 Bytes

Versions: 283

Compression:

Stored size: 570 Bytes

Contents

module Treetop
  module Compiler
    class DeclarationSequence < Runtime::SyntaxNode

      def compile(builder)
        unless rules.empty?
          builder.method_declaration("root") do
            builder << "@root ||= :#{rules.first.name}"
          end
          builder.newline
        end
        
        declarations.each do |declaration|
          declaration.compile(builder)
          builder.newline
        end
      end
      
      def rules
        declarations.select { |declaration| declaration.instance_of?(ParsingRule) }
      end
    end
  end
end

Version data entries

283 entries across 238 versions & 32 rubygems

Version Path
treetop-1.4.10 lib/treetop/compiler/node_classes/declaration_sequence.rb
treetop-1.4.9 lib/treetop/compiler/node_classes/declaration_sequence.rb
treetop-1.4.8 lib/treetop/compiler/node_classes/declaration_sequence.rb
treetop-1.4.7 lib/treetop/compiler/node_classes/declaration_sequence.rb
treetop-1.4.5 lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.5.2 lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.5.1 lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.5 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.3 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.2 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.1 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.1.0 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.0.5 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-2.0.3 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.6.0 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.5.4 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.5.3 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.5.2 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.5.1 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.5.0 lib/mail/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb