Class: Tumblargh::Node::Block
- Defined in:
- lib/tumblargh/node/block.rb
Instance Method Summary collapse
Methods inherited from Root
Methods inherited from Base
Instance Method Details
#name ⇒ Object
5 6 7 8 |
# File 'lib/tumblargh/node/block.rb', line 5 def name # First node is BlockStart elements.first.name end |
#options ⇒ Object
10 11 12 |
# File 'lib/tumblargh/node/block.rb', line 10 def elements.first. end |
#to_tree ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tumblargh/node/block.rb', line 14 def to_tree ary = [type, name, ] # 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 |