class Treetop::Runtime::SyntaxNode

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.

Public Instance Methods

meta_data(hash = {}) click to toggle source
# File lib/tnql/treetop/extensions.rb, line 7
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