class SyntaxTree::Parser
def on_while(predicate, statements)
:call-seq:
def on_while(predicate, statements) beginning = consume_keyword(:while) ending = consume_keyword(:end) delimiter = find_keyword_between(:do, predicate, statements) || find_token_between(Semicolon, predicate, statements) tokens.delete(delimiter) if delimiter # Update the Statements location information start_char = find_next_statement_start((delimiter || predicate).location.end_char) statements.bind( self, start_char, start_char - line_counts[predicate.location.end_line - 1].start, ending.location.start_char, ending.location.start_column ) WhileNode.new( predicate: predicate, statements: statements, location: beginning.location.to(ending.location) ) end