def origin_for_statement(ast, context): expression_no_in(ast[3], context) while expression_no_in(ast[5], context): statement(ast[9], context) if context.return_value is not None: break expression_no_in(ast[7], context)
def return_statement(ast, context): if ast[len(ast) - 1] == ";": ast.pop() if len(ast) == 2: context.return_value = UNDEFINED elif len(ast) == 3: context.return_value = expression_no_in(ast[2], context)
def do_statement(ast, context): while True: statement(ast[2], context) if context.return_value is not None: break if not expression_no_in(ast[5], context): break
def print_statement(ast, context): print(expression_no_in(ast[2], context))
def for_each_statement(ast, context): for context[ast[4][1]] in expression_no_in(ast[6], context): statement(ast[8], context) if context.return_value is not None: break
def while_statement(ast, context): while expression_no_in(ast[3], context): statement(ast[5], context) if context.return_value is not None: break
def if_statement(ast, context): if expression_no_in(ast[3], context): statement(ast[5], context) else: if len(ast) == 8: statement(ast[7], context)
def expression_no_in_statement(ast, context): return expression_no_in(ast[1], context)