Sha256: 6bac1c8a5cb2ff89d6f681164c16252a9223e52d32f774c09ff970d2e0b0d494

Contents?: true

Size: 737 Bytes

Versions: 8

Compression:

Stored size: 737 Bytes

Contents

module Treetop
  module Runtime
    class SyntaxNode

      def convert(dependencies)
        if nonterminal?
          value = ""
          elements.each { |element| value << element.convert(dependencies) }
          _add_dependency(dependencies, extract(value))
          rewrite(value)
        else
          _add_dependency(dependencies, extract(text_value))
          rewrite(text_value)
        end
      end

      def rewrite(value)
        value
      end

      def extract(value)
      end

    private

      def _add_dependency(dependencies, value)
        return if value.nil?
        dependencies << value
        dependencies.flatten!
        dependencies.compact!
        dependencies.uniq!
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
soroban-0.5.4 lib/soroban/parser/rewrite.rb
soroban-0.4.0 lib/soroban/parser/rewrite.rb
soroban-0.3.1 lib/soroban/parser/rewrite.rb
soroban-0.3.0 lib/soroban/parser/rewrite.rb
soroban-0.2.0 lib/soroban/parser/rewrite.rb
soroban-0.1.1 lib/soroban/parser/rewrite.rb
soroban-0.1.0 lib/soroban/parser/rewrite.rb
Soroban-0.1.0 lib/soroban/parser/rewrite.rb