changeset 49:141f1769e1f0

Add ast.Pass.
author Bastien Orivel <eijebong@bananium.fr>
date Wed, 08 Jun 2016 17:18:28 +0200
parents 039f85b187f2
children 5edbc24b625f
files src/ast_convert.rs src/ast_dump.rs src/python_ast.rs tests/test_parse_files/test_pass.py
diffstat 4 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ast_convert.rs
+++ b/src/ast_convert.rs
@@ -441,6 +441,7 @@ fn parse_statement(py: Python, ast: PyOb
     let expr_type = ast_module.get(py, "Expr").unwrap();
     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();
 
     assert!(is_instance(&ast, &ast_type));
 
@@ -574,6 +575,8 @@ fn parse_statement(py: Python, ast: PyOb
         let targets = ast.getattr(py, "targets").unwrap();
         let targets = parse_list(py, targets, parse_expr);
         stmt::Delete(targets)
+    } else if is_instance(&ast, &pass_type) {
+        stmt::Pass
     } else {
         println!("stmt {}", ast);
         panic!()
--- a/src/ast_dump.rs
+++ b/src/ast_dump.rs
@@ -224,7 +224,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::Delete(targets) => format!("{}del {}", current_indent, args_to_string(targets)),
+            stmt::Pass => format!("{}pass", current_indent)
         }
     }
 }
--- a/src/python_ast.rs
+++ b/src/python_ast.rs
@@ -70,7 +70,7 @@ pub enum stmt {
     Expr(expr),
 
     // Pass | Break | Continue
-    //Pass,
+    Pass,
     Break,
     //Continue
 }
new file mode 100644
--- /dev/null
+++ b/tests/test_parse_files/test_pass.py
@@ -0,0 +1,1 @@
+pass