class SyntaxTree::Parser
def on_rescue(exceptions, variable, statements, consequent)
(nil | Rescue) consequent
Statements statements,
(nil | Field | VarField) variable,
(nil | [untyped] | MRHS | MRHSAddStar) exceptions,
on_rescue: (
:call-seq:
def on_rescue(exceptions, variable, statements, consequent) keyword = consume_keyword(:rescue) exceptions = exceptions[0] if exceptions.is_a?(Array) last_node = variable || exceptions || keyword start_char = find_next_statement_start(last_node.end_char) statements.bind( self, start_char, start_char - line_counts[last_node.location.start_line - 1].start, char_pos, current_column ) # We add an additional inner node here that ripper doesn't provide so that # we have a nice place to attach inline comments. But we only need it if # we have an exception or a variable that we're rescuing. rescue_ex = if exceptions || variable RescueEx.new( exceptions: exceptions, variable: variable, location: Location.new( start_line: keyword.location.start_line, start_char: keyword.location.end_char + 1, start_column: keyword.location.end_column + 1, end_line: last_node.location.end_line, end_char: last_node.end_char, end_column: last_node.location.end_column ) ) end Rescue.new( keyword: keyword, exception: rescue_ex, statements: statements, consequent: consequent, location: Location.new( start_line: keyword.location.start_line, start_char: keyword.location.start_char, start_column: keyword.location.start_column, end_line: lineno, end_char: char_pos, end_column: current_column ) ) end