Sha256: 1760825336e060ad4eed1d29717d1eb5649511a533ab146d3a7cbcc6834ef12e

Contents?: true

Size: 570 Bytes

Versions: 282

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

282 entries across 237 versions & 32 rubygems

Version Path
mail-1.4.2 lib/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb
mail-1.4.1 lib/vendor/treetop-1.4.3/lib/treetop/compiler/node_classes/declaration_sequence.rb