class SyntaxTree::ENDBlock
block. Only braces are permitted.
Interestingly, the END keyword doesn’t allow the do and end keywords for the
}
END {
when the program ends.
lifecycle of the interpreter. Whatever is inside the block will get executed
ENDBlock represents the use of the END
keyword, which hooks into the
def ===(other)
def ===(other) other.is_a?(ENDBlock) && lbrace === other.lbrace && statements === other.statements end
def accept(visitor)
def accept(visitor) visitor.visit_END(self) end
def child_nodes
def child_nodes [lbrace, statements] end
def copy(lbrace: nil, statements: nil, location: nil)
def copy(lbrace: nil, statements: nil, location: nil) node = ENDBlock.new( lbrace: lbrace || self.lbrace, statements: statements || self.statements, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { lbrace: lbrace, statements: statements, location: location, comments: comments } end
def format(q)
def format(q) q.group do q.text("END ") q.format(lbrace) q.indent do q.breakable_space q.format(statements) end q.breakable_space q.text("}") end end
def initialize(lbrace:, statements:, location:)
def initialize(lbrace:, statements:, location:) @lbrace = lbrace @statements = statements @location = location @comments = [] end