class SyntaxTree::UntilNode

Until represents an until loop.

until predicate
end

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

predicate[R]
Node

the expression to be checked

statements[R]
Statements

the expressions to be executed

Public Class Methods

new(predicate:, statements:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 11464
def initialize(predicate:, statements:, location:)
  @predicate = predicate
  @statements = statements
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 11506
def ===(other)
  other.is_a?(UntilNode) && predicate === other.predicate &&
    statements === other.statements
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 11471
def accept(visitor)
  visitor.visit_until(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 11475
def child_nodes
  [predicate, statements]
end
Also aliased as: deconstruct
copy(predicate: nil, statements: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 11479
def copy(predicate: nil, statements: nil, location: nil)
  node =
    UntilNode.new(
      predicate: predicate || self.predicate,
      statements: statements || self.statements,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 11493
def deconstruct_keys(_keys)
  {
    predicate: predicate,
    statements: statements,
    location: location,
    comments: comments
  }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 11502
def format(q)
  LoopFormatter.new("until", self).format(q)
end
modifier?() click to toggle source
# File lib/syntax_tree/node.rb, line 11511
def modifier?
  predicate.location.start_char > statements.location.start_char
end