'TO',
'DO',
'WHILE',
+ 'BREAK',
'NAME',
'NUMBER', # Python decimals
'STRING', # single quoted strings only; syntax of raw strings
"if": "IF",
"then": "THEN",
"else": "ELSE",
+ "leave": "BREAK",
"for": "FOR",
"to": "TO",
"while": "WHILE",
# import_stmt | global_stmt | exec_stmt | assert_stmt
def p_small_stmt(p):
"""small_stmt : flow_stmt
+ | break_stmt
| expr_stmt"""
p[0] = p[1]
"""
p[0] = p[1]
+def p_break_stmt(p):
+ """break_stmt : BREAK
+ """
+ p[0] = ast.Break()
+
def p_for_stmt(p):
"""for_stmt : FOR test FOREQ test TO test COLON suite
"""
else index <- 5
do while index < 5
index <- 0
+ leave
for i = 0 to 7
index <- 0
"""