Class: Loxxy::Ast::LoxNode

Inherits:
Object
  • Object
show all
Extended by:
ASTVisitee
Defined in:
lib/loxxy/ast/lox_node.rb

Overview

Abstract class. Instances of its subclasses represent nodes of an abstract syntax tree that is the product of the parse of an input text.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ASTVisitee

define_accept, snake_case

Constructor Details

#initialize(aPosition) ⇒ LoxNode

Returns a new instance of LoxNode.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.



18
19
20
# File 'lib/loxxy/ast/lox_node.rb', line 18

def initialize(aPosition)
  @position = aPosition
end

Instance Attribute Details

#positionRley::Lexical::Position (readonly)

Returns Position of the entry in the input stream.

Returns:

  • (Rley::Lexical::Position)

    Position of the entry in the input stream.



15
16
17
# File 'lib/loxxy/ast/lox_node.rb', line 15

def position
  @position
end

Instance Method Details

#accept(_visitor) ⇒ Object

Abstract method (must be overriden in subclasses). Part of the 'visitee' role in Visitor design pattern.

Parameters:

  • _visitor (LoxxyTreeVisitor)

    the visitor

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/loxxy/ast/lox_node.rb', line 30

def accept(_visitor)
  raise NotImplementedError
end

#done!Object

Notification that the parsing was successfully completed



23
24
25
# File 'lib/loxxy/ast/lox_node.rb', line 23

def done!
  # Default: do nothing ...
end