Sha256: f2a260adc4b99b35d0ab7df6cbac39d0261febf30ccbdcc6b6fda8faacab0e32

Contents?: true

Size: 529 Bytes

Versions: 8

Compression:

Stored size: 529 Bytes

Contents

module Treetop
  module Runtime
    # We extend the SyntaxNode class to include a hash of meta data.
    # Individual rules can define meta_data_item method that must return
    # a hash that is merged with the hash data for the entire query.
    class SyntaxNode
      def meta_data(hash = {})
        hash.merge!(meta_data_item) if respond_to?(:meta_data_item)

        if nonterminal?
          elements.each do |element|
            element.meta_data(hash)
          end
        end

        hash
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tnql-1.1.2 lib/tnql/treetop/extensions.rb
tnql-1.1.1 lib/tnql/treetop/extensions.rb
tnql-1.1.0 lib/tnql/treetop/extensions.rb
tnql-1.0.4 lib/tnql/treetop/extensions.rb
tnql-1.0.3 lib/tnql/treetop/extensions.rb
tnql-1.0.2 lib/tnql/treetop/extensions.rb
tnql-1.0.1 lib/tnql/treetop/extensions.rb
tnql-1.0.0 lib/tnql/treetop/extensions.rb