From 044e7a6a26d0666d17406682a7849c56da72f5a4 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 22 Jul 2015 02:54:30 -0700 Subject: [PATCH] Rename ASTNode -> AST saves typing --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 03e537d..3eab353 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,16 +26,16 @@ enum Token { } #[derive(Debug)] -enum ASTNode { +enum AST { Name(String), LangString(String), Number(f64), - BinOp(Box, Box, Box), - Binding(String, Box) + BinOp(Box, Box, Box), + Binding(String, Box) } enum ParseResult { - Ok(ASTNode), + Ok(AST), Err(String) } @@ -177,17 +177,17 @@ fn let_expression<'a>(input: &mut Iter) -> ParseResult { if s == "=" { let next = input.next(); if let Some(&Identifier(ref value)) = next { - let ast = ASTNode::Binding(name.clone(), Box::new(ASTNode::Name(value.clone()))); + let ast = AST::Binding(name.clone(), Box::new(AST::Name(value.clone()))); return ParseResult::Ok(ast); } if let Some(&StrLiteral(ref value)) = next { - let ast = ASTNode::Binding(name.clone(), Box::new(ASTNode::LangString(value.clone()))); + let ast = AST::Binding(name.clone(), Box::new(AST::LangString(value.clone()))); return ParseResult::Ok(ast); } if let Some(&NumLiteral(n)) = next { - let ast = ASTNode::Binding(name.clone(), Box::new(ASTNode::Number(n))); + let ast = AST::Binding(name.clone(), Box::new(AST::Number(n))); return ParseResult::Ok(ast); } }