Sha256: e8240b9384ab2fab3007d887787526f047eea0877556e71c129ac139b52ee2bc

Contents?: true

Size: 569 Bytes

Versions: 83

Compression:

Stored size: 569 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

83 entries across 83 versions & 13 rubygems

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