Mercurial > python-compiler.rs
comparison src/python_ast.rs @ 0:211b0df72e64
Hello world!
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Sun, 29 May 2016 19:15:02 +0100 |
| parents | |
| children | b90e49ab734b |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:211b0df72e64 |
|---|---|
| 1 #[derive(Clone, Debug)] | |
| 2 pub struct Module { | |
| 3 pub name: String, | |
| 4 pub statements: Vec<Statement>, | |
| 5 } | |
| 6 | |
| 7 #[derive(Clone, Debug)] | |
| 8 pub enum Statement { | |
| 9 FunctionDef(Expr, Vec<Expr>, Vec<Statement>), | |
| 10 Global(Vec<String>), | |
| 11 If(Expr, Vec<Statement>, Vec<Statement>), | |
| 12 Assign(Vec<Expr>, Expr), | |
| 13 Return(Expr), | |
| 14 ImportFrom(String, Vec<Expr>), | |
| 15 Expr(Expr), | |
| 16 Error, | |
| 17 } | |
| 18 | |
| 19 #[derive(Clone, Debug, PartialEq, Eq, Hash)] | |
| 20 pub enum Expr { | |
| 21 BinOp(Box<Expr>, BinOp, Box<Expr>), | |
| 22 Compare(Box<Expr>, Vec<BinOp>, Vec<Expr>), | |
| 23 Call(Box<Expr>, Vec<Expr>), | |
| 24 Alias(String, String), | |
| 25 Name(String), | |
| 26 NameConstant(String), | |
| 27 Str(String), | |
| 28 Num(String), | |
| 29 Error | |
| 30 } | |
| 31 | |
| 32 #[derive(Clone, Debug, PartialEq, Eq, Hash)] | |
| 33 pub enum BinOp { | |
| 34 BinAdd, | |
| 35 BinMult, | |
| 36 BinEq, | |
| 37 BinLt, | |
| 38 Error, | |
| 39 } |
