Add manual impl of fmt::Debug to Expression
This commit is contained in:
parent
db2e81d518
commit
d8e46e7228
1 changed files with 15 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
|||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use lexer;
|
||||
use types;
|
||||
|
||||
|
@ -18,5 +20,17 @@ impl Program {
|
|||
pub enum Expression {
|
||||
EOF,
|
||||
Atom(Box<types::Value>),
|
||||
List { left: lexer::Token, expression: Vec<Box<Expression>>, right: lexer::Token },
|
||||
List { left: lexer::Token, expr: Vec<Box<Expression>>, right: lexer::Token },
|
||||
}
|
||||
|
||||
impl fmt::Debug for Expression {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Expression::EOF => write!(f, "EOF"),
|
||||
Expression::Atom(ref value) => write!(f, "Atom{{ {:?} }}", value),
|
||||
Expression::List{ left: ref lt, expr: ref expr, right: ref rt } => {
|
||||
write!(f, "{:?} {:?} {:?}", lt, expr, rt)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue