changeset 50:5edbc24b625f

Add ast.Continue.
author Bastien Orivel <eijebong@bananium.fr>
date Wed, 08 Jun 2016 17:21:57 +0200
parents 141f1769e1f0
children ded1907b7a69
files src/ast_convert.rs src/ast_dump.rs src/python_ast.rs tests/test_parse_files/test_continue.py
diffstat 4 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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!()
--- 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)
         }
     }
 }
--- 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)]
new file mode 100644
--- /dev/null
+++ b/tests/test_parse_files/test_continue.py
@@ -0,0 +1,2 @@
+for i in range(5):
+    continue