Sha256: b9ca9abff21802b6f9bac68487c45b864e9a73a5605295ae27156b294b39ed12

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require_relative 'lox_compound_expr'

module Loxxy
  module Ast
    class LoxForStmt < LoxCompoundExpr
      # @return [LoxNode] test expression
      attr_reader :test_expr

      # @return [LoxNode] update expression
      attr_reader :update_expr

      # @return [LoxNode] body statement
      attr_accessor :body_stmt

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param initialization [Loxxy::Ast::LoxNode]
      # @param testExpr [Loxxy::Ast::LoxNode]
      # @param updateExpr [Loxxy::Ast::LoxNode]
      def initialize(aPosition, initialization, testExpr, updateExpr)
        child = initialization ? [initialization] : []
        super(aPosition, child)
        @test_expr = testExpr
        @update_expr = updateExpr
      end

      # Part of the 'visitee' role in Visitor design pattern.
      # @param visitor [Ast::ASTVisitor] the visitor
      def accept(visitor)
        visitor.visit_for_stmt(self)
      end

      # Accessor to the condition expression
      # @return [LoxNode]
      def condition
        subnodes[0]
      end
    end # class
  end # module
end # module

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
loxxy-0.2.02 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.2.01 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.2.00 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.17 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.16 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.15 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.14 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.13 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.12 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.11 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.10 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.09 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.08 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.07 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.06 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.05 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.04 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.03 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.02 lib/loxxy/ast/lox_for_stmt.rb
loxxy-0.1.01 lib/loxxy/ast/lox_for_stmt.rb