# HG changeset patch # User Bastien Orivel # Date 1465399317 -7200 # Node ID 5edbc24b625f83673f8cd73c9f1480958ad6b4c1 # Parent 141f1769e1f0c61ec1ba8d811c2f9dc53f7a4658 Add ast.Continue. diff --git a/src/ast_convert.rs b/src/ast_convert.rs --- a/src/ast_convert.rs +++ b/src/ast_convert.rs @@ -442,6 +442,7 @@ fn parse_statement(py: Python, ast: PyOb let break_type = ast_module.get(py, "Break").unwrap(); let delete_type = ast_module.get(py, "Delete").unwrap(); let pass_type = ast_module.get(py, "Pass").unwrap(); + let continue_type = ast_module.get(py, "Continue").unwrap(); assert!(is_instance(&ast, &ast_type)); @@ -577,6 +578,8 @@ fn parse_statement(py: Python, ast: PyOb stmt::Delete(targets) } else if is_instance(&ast, &pass_type) { stmt::Pass + } else if is_instance(&ast, &continue_type) { + stmt::Continue } else { println!("stmt {}", ast); panic!() diff --git a/src/ast_dump.rs b/src/ast_dump.rs --- a/src/ast_dump.rs +++ b/src/ast_dump.rs @@ -225,7 +225,8 @@ impl stmt { stmt::Expr(expr) => format!("{}{}", current_indent, expr.to_string()), stmt::Break => format!("{}break", current_indent), stmt::Delete(targets) => format!("{}del {}", current_indent, args_to_string(targets)), - stmt::Pass => format!("{}pass", current_indent) + stmt::Pass => format!("{}pass", current_indent), + stmt::Continue => format!("{}continue", current_indent) } } } diff --git a/src/python_ast.rs b/src/python_ast.rs --- a/src/python_ast.rs +++ b/src/python_ast.rs @@ -72,7 +72,7 @@ pub enum stmt { // Pass | Break | Continue Pass, Break, - //Continue + Continue } #[derive(Clone, Debug, PartialEq, Eq, Hash)] diff --git a/tests/test_parse_files/test_continue.py b/tests/test_parse_files/test_continue.py new file mode 100644 --- /dev/null +++ b/tests/test_parse_files/test_continue.py @@ -0,0 +1,2 @@ +for i in range(5): + continue