Sha256: 259d8e62ecfbae32cd826bc05a66032a6b8ebe735302aa11c5943e5059bf55df

Contents?: true

Size: 1.04 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
loxxy-0.4.08 lib/loxxy/ast/lox_node.rb
loxxy-0.4.07 lib/loxxy/ast/lox_node.rb
loxxy-0.4.06 lib/loxxy/ast/lox_node.rb
loxxy-0.4.05 lib/loxxy/ast/lox_node.rb
loxxy-0.4.04 lib/loxxy/ast/lox_node.rb
loxxy-0.4.03 lib/loxxy/ast/lox_node.rb
loxxy-0.4.02 lib/loxxy/ast/lox_node.rb
loxxy-0.4.01 lib/loxxy/ast/lox_node.rb