Mercurial > python-compiler.rs
comparison src/ast_convert.rs @ 50:5edbc24b625f
Add ast.Continue.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Wed, 08 Jun 2016 17:21:57 +0200 |
parents | 141f1769e1f0 |
children | ded1907b7a69 |
comparison
equal
deleted
inserted
replaced
49:141f1769e1f0 | 50:5edbc24b625f |
---|---|
440 let for_type = ast_module.get(py, "For").unwrap(); | 440 let for_type = ast_module.get(py, "For").unwrap(); |
441 let expr_type = ast_module.get(py, "Expr").unwrap(); | 441 let expr_type = ast_module.get(py, "Expr").unwrap(); |
442 let break_type = ast_module.get(py, "Break").unwrap(); | 442 let break_type = ast_module.get(py, "Break").unwrap(); |
443 let delete_type = ast_module.get(py, "Delete").unwrap(); | 443 let delete_type = ast_module.get(py, "Delete").unwrap(); |
444 let pass_type = ast_module.get(py, "Pass").unwrap(); | 444 let pass_type = ast_module.get(py, "Pass").unwrap(); |
445 let continue_type = ast_module.get(py, "Continue").unwrap(); | |
445 | 446 |
446 assert!(is_instance(&ast, &ast_type)); | 447 assert!(is_instance(&ast, &ast_type)); |
447 | 448 |
448 /* | 449 /* |
449 // TODO: implement Hash for PyObject. (trivial) | 450 // TODO: implement Hash for PyObject. (trivial) |
575 let targets = ast.getattr(py, "targets").unwrap(); | 576 let targets = ast.getattr(py, "targets").unwrap(); |
576 let targets = parse_list(py, targets, parse_expr); | 577 let targets = parse_list(py, targets, parse_expr); |
577 stmt::Delete(targets) | 578 stmt::Delete(targets) |
578 } else if is_instance(&ast, &pass_type) { | 579 } else if is_instance(&ast, &pass_type) { |
579 stmt::Pass | 580 stmt::Pass |
581 } else if is_instance(&ast, &continue_type) { | |
582 stmt::Continue | |
580 } else { | 583 } else { |
581 println!("stmt {}", ast); | 584 println!("stmt {}", ast); |
582 panic!() | 585 panic!() |
583 } | 586 } |
584 } | 587 } |