class Tumblargh::Node::Block

Public Instance Methods

name() click to toggle source
# File lib/tumblargh/node/block.rb, line 5
def name
  # First node is BlockStart
  elements.first.name
end
options() click to toggle source
# File lib/tumblargh/node/block.rb, line 10
def options
  elements.first.options
end
to_tree() click to toggle source
# File lib/tumblargh/node/block.rb, line 14
def to_tree
  ary = [type, name, options]

  # Second node is a Treetop SyntaxNode which holds
  # the rest of the block contents. Extra parse node
  # due to grouping in the block grammar
  elements[1].elements.each do |e|
    if e.respond_to?(:to_tree)
      ary << e.to_tree
    else
      raise ParserError, "Unknown node type '#{e.class.name}' in Block '#{name}'"
    end
  end

  ary
end