class SyntaxTree::WhileNode
end
while predicate
While represents a while loop.
def ===(other)
def ===(other) other.is_a?(WhileNode) && predicate === other.predicate && statements === other.statements end
def accept(visitor)
def accept(visitor) visitor.visit_while(self) end
def child_nodes
def child_nodes [predicate, statements] end
def copy(predicate: nil, statements: nil, location: nil)
def copy(predicate: nil, statements: nil, location: nil) node = WhileNode.new( predicate: predicate || self.predicate, statements: statements || self.statements, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { predicate: predicate, statements: statements, location: location, comments: comments } end
def format(q)
def format(q) LoopFormatter.new("while", self).format(q) end
def initialize(predicate:, statements:, location:)
def initialize(predicate:, statements:, location:) @predicate = predicate @statements = statements @location = location @comments = [] end
def modifier?
def modifier? predicate.location.start_char > statements.location.start_char end