class SyntaxTree::Parser
def on_when(arguments, statements, consequent)
(nil | Else | When) consequent
Statements statements,
Args arguments,
on_when: (
:call-seq:
def on_when(arguments, statements, consequent) beginning = consume_keyword(:when) ending = consequent || consume_keyword(:end) statements_start = arguments if (token = find_keyword(:then)) tokens.delete(token) statements_start = token end start_char = find_next_statement_start((token || statements_start).location.end_char) statements.bind( self, start_char, start_char - line_counts[statements_start.location.start_line - 1].start, ending.location.start_char, ending.location.start_column ) When.new( arguments: arguments, statements: statements, consequent: consequent, location: beginning.location.to(ending.location) ) end