Mercurial > python-compiler.rs
comparison src/ast_convert.rs @ 15:a0fb169fe0f9
Add forgotten cmpop values.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 02 Jun 2016 05:45:22 +0100 |
parents | 719a27f1c1c7 |
children | b21a246349f3 |
comparison
equal
deleted
inserted
replaced
14:719a27f1c1c7 | 15:a0fb169fe0f9 |
---|---|
81 let ast_module = py.import("ast").unwrap(); | 81 let ast_module = py.import("ast").unwrap(); |
82 let ast_type = ast_module.get(py, "AST").unwrap(); | 82 let ast_type = ast_module.get(py, "AST").unwrap(); |
83 let eq_type = ast_module.get(py, "Eq").unwrap(); | 83 let eq_type = ast_module.get(py, "Eq").unwrap(); |
84 let noteq_type = ast_module.get(py, "NotEq").unwrap(); | 84 let noteq_type = ast_module.get(py, "NotEq").unwrap(); |
85 let lt_type = ast_module.get(py, "Lt").unwrap(); | 85 let lt_type = ast_module.get(py, "Lt").unwrap(); |
86 let lte_type = ast_module.get(py, "LtE").unwrap(); | |
86 let gt_type = ast_module.get(py, "Gt").unwrap(); | 87 let gt_type = ast_module.get(py, "Gt").unwrap(); |
88 let gte_type = ast_module.get(py, "GtE").unwrap(); | |
89 let is_type = ast_module.get(py, "Is").unwrap(); | |
90 let is_not_type = ast_module.get(py, "IsNot").unwrap(); | |
91 let in_type = ast_module.get(py, "In").unwrap(); | |
92 let not_in_type = ast_module.get(py, "NotIn").unwrap(); | |
87 | 93 |
88 assert!(is_instance(&ast, &ast_type)); | 94 assert!(is_instance(&ast, &ast_type)); |
89 | 95 |
90 if is_instance(&ast, &eq_type) { | 96 if is_instance(&ast, &eq_type) { |
91 cmpop::Eq | 97 cmpop::Eq |
92 } else if is_instance(&ast, ¬eq_type) { | 98 } else if is_instance(&ast, ¬eq_type) { |
93 cmpop::NotEq | 99 cmpop::NotEq |
94 } else if is_instance(&ast, <_type) { | 100 } else if is_instance(&ast, <_type) { |
95 cmpop::Lt | 101 cmpop::Lt |
102 } else if is_instance(&ast, <e_type) { | |
103 cmpop::LtE | |
96 } else if is_instance(&ast, >_type) { | 104 } else if is_instance(&ast, >_type) { |
97 cmpop::Gt | 105 cmpop::Gt |
106 } else if is_instance(&ast, >e_type) { | |
107 cmpop::GtE | |
108 } else if is_instance(&ast, &is_type) { | |
109 cmpop::Is | |
110 } else if is_instance(&ast, &is_not_type) { | |
111 cmpop::IsNot | |
112 } else if is_instance(&ast, &in_type) { | |
113 cmpop::In | |
114 } else if is_instance(&ast, ¬_in_type) { | |
115 cmpop::NotIn | |
98 } else { | 116 } else { |
99 unreachable!() | 117 unreachable!() |
100 } | 118 } |
101 } | 119 } |
102 | 120 |