Mercurial > python-compiler.rs
diff src/ast_convert.rs @ 52:d9838e8b3ec5
Add ast.Ellipsis.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Wed, 08 Jun 2016 19:01:46 +0200 |
parents | ded1907b7a69 |
children | 1a815946c2e5 |
line wrap: on
line diff
--- a/src/ast_convert.rs +++ b/src/ast_convert.rs @@ -251,6 +251,7 @@ fn parse_expr(py: Python, ast: PyObject) let listcomp_type = ast_module.get(py, "ListComp").unwrap(); let dictcomp_type = ast_module.get(py, "DictComp").unwrap(); let tuple_type = ast_module.get(py, "Tuple").unwrap(); + let ellipsis_type = ast_module.get(py, "Ellipsis").unwrap(); assert!(is_instance(&ast, &ast_type)); @@ -361,6 +362,8 @@ fn parse_expr(py: Python, ast: PyObject) let elts = ast.getattr(py, "elts").unwrap(); let elts = parse_list(py, elts, parse_expr); expr::Tuple(elts, get_ctx(py, ast)) + } else if is_instance(&ast, &ellipsis_type) { + expr::Ellipsis } else { println!("expr {}", ast); unreachable!()