BEGINBlock
represents the use of the BEGIN
keyword, which hooks into the lifecycle of the interpreter. Whatever is inside the block will get executed when the program starts.
BEGIN { }
Interestingly, the BEGIN keyword doesn’t allow the do and end keywords for the block. Only braces are permitted.
AttributesLBrace
the left brace that is seen after the keyword
def initialize(lbrace:, statements:, location:) @lbrace = lbrace @statements = statements @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(BEGINBlock) && lbrace === other.lbrace && statements === other.statements endSource
def accept(visitor) visitor.visit_BEGIN(self) endSource
def child_nodes [lbrace, statements] endSource
def copy(lbrace: nil, statements: nil, location: nil) node = BEGINBlock.new( lbrace: lbrace || self.lbrace, statements: statements || self.statements, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { lbrace: lbrace, statements: statements, location: location, comments: comments } endSource
def format(q) q.group do q.text("BEGIN ") q.format(lbrace) q.indent do q.breakable_space q.format(statements) end q.breakable_space q.text("}") end end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4