class SyntaxTree::Parser
def on_for(index, collection, statements)
Statements statements
untyped collection,
(MLHS | VarField) value,
on_for: (
:call-seq:
def on_for(index, collection, statements) beginning = consume_keyword(:for) in_keyword = consume_keyword(:in) ending = consume_keyword(:end) delimiter = find_keyword_between(:do, collection, ending) || find_token_between(Semicolon, collection, ending) tokens.delete(delimiter) if delimiter start_char = find_next_statement_start((delimiter || collection).location.end_char) statements.bind( self, start_char, start_char - line_counts[(delimiter || collection).location.end_line - 1].start, ending.location.start_char, ending.location.start_column ) if index.is_a?(MLHS) comma_range = index.location.end_char...in_keyword.location.start_char index.comma = true if source[comma_range].strip.start_with?(",") end For.new( index: index, collection: collection, statements: statements, location: beginning.location.to(ending.location) ) end