Sha256: fd2aa4994800ce5a18834ae0d67392222cee5355ad46606586c79aff4a378bec

Contents?: true

Size: 798 Bytes

Versions: 18

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

require_relative 'lox_compound_expr'

module Loxxy
  module Ast
    class LoxWhileStmt < LoxCompoundExpr
      # @return [LoxNode] body of the while loop (as a statement)
      attr_reader :body

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param condExpr [Loxxy::Ast::LoxNode] iteration condition
      # @param theBody [Loxxy::Ast::LoxNode]
      def initialize(aPosition, condExpr, theBody)
        super(aPosition, [condExpr])
        @body = theBody
      end

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

      define_accept # Add `accept` method as found in Visitor design pattern
    end # class
  end # module
end # module

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
loxxy-0.4.09 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.08 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.07 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.06 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.05 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.04 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.03 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.02 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.01 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.4.00 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.3.03 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.3.02 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.3.01 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.3.00 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.2.06 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.2.05 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.2.04 lib/loxxy/ast/lox_while_stmt.rb
loxxy-0.2.03 lib/loxxy/ast/lox_while_stmt.rb