class BlockToken
Holds logic and information for block token management.
Attributes
children[R]
Public Class Methods
new(tokens)
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 7 def initialize(tokens) @children = tokens end
Public Instance Methods
accept(visitor)
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 32 def accept(visitor) method_name = "generate_#{type.to_s.downcase}" visitor.send(method_name.to_sym, self) end
node_representation()
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 15 def node_representation opening_tag = "<#{type} child_count=#{children.count}>" closing_tag = "<#{type} />" contents = children.map { |token| " #{token.node_representation}" }.join("\n") "#{opening_tag}\n#{contents}\n#{closing_tag}" end
to_s()
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 11 def to_s "<Token type='#{type}' child_count='#{children.count}' children='#{children}'>" end
type()
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 24 def type raise 'Subclass should handle #type.' end
value()
click to toggle source
# File lib/rosetta/tokens/block_token.rb, line 28 def value raise 'Subclass should handle #value.' end