Sha256: 0e2fdfbb7ccce105f6a675f0f3a998d3ad89a72cfbabf9a0a8f0a718e3fdbf1e

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative 'ast_visitee'

module Loxxy
  module Ast
    # Abstract class.
    # Instances of its subclasses represent nodes of an abstract syntax tree
    # that is the product of the parse of an input text.
    class LoxNode
      # Let nodes take `visitee` role as defined in the Visitor design pattern
      extend ASTVisitee

      # return [Rley::Lexical::Position] Position of the entry in the input stream.
      attr_reader :position

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      def initialize(aPosition)
        @position = aPosition
      end

      # Notification that the parsing was successfully completed
      def done!
        # Default: do nothing ...
      end

      # Abstract method (must be overriden in subclasses).
      # Part of the 'visitee' role in Visitor design pattern.
      # @param _visitor [LoxxyTreeVisitor] the visitor
      def accept(_visitor)
        raise NotImplementedError
      end
    end # class
  end # module
end # module

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
loxxy-0.4.00 lib/loxxy/ast/lox_node.rb
loxxy-0.3.03 lib/loxxy/ast/lox_node.rb
loxxy-0.3.02 lib/loxxy/ast/lox_node.rb
loxxy-0.3.01 lib/loxxy/ast/lox_node.rb
loxxy-0.3.00 lib/loxxy/ast/lox_node.rb
loxxy-0.2.06 lib/loxxy/ast/lox_node.rb
loxxy-0.2.05 lib/loxxy/ast/lox_node.rb
loxxy-0.2.04 lib/loxxy/ast/lox_node.rb
loxxy-0.2.03 lib/loxxy/ast/lox_node.rb