class Rley::RGN::ASTNode
Abstract class. Instances of its subclasses represent nodes of an abstract syntax tree that is the product of the parse of an input text.
Attributes
@return [Hash]
Public Class Methods
Public Instance Methods
Source
# File lib/rley/rgn/ast_node.rb, line 50 def accept(_visitor) raise NotImplementedError end
Abstract method (must be overriden in subclasses). Part of the ‘visitee’ role in Visitor design pattern. @param _visitor [ASTVisitor] the visitor
Source
# File lib/rley/rgn/ast_node.rb, line 16 def annotation=(aMapping) repeat_key = 'repeat' @repetition = aMapping.delete(repeat_key) if aMapping.include?(repeat_key) @annotation = aMapping end
Source
# File lib/rley/rgn/ast_node.rb, line 22 def annotation_to_text map_arr = [] @annotation.each_pair do |key, val| literal = val.is_a?(String) ? "'#{val}'" : val map_arr << "#{key}: #{literal}" end "{ #{map_arr.join(', ')} }" end
Source
# File lib/rley/rgn/ast_node.rb, line 33 def done! # Default: do nothing ... end
Notification that the parsing has successfully completed
Source
# File lib/rley/rgn/ast_node.rb, line 38 def name raise NotImplementedError end
@nodoc
Source
# File lib/rley/rgn/ast_node.rb, line 43 def to_text raise NotImplementedError end
@nodoc