From 15d43171911a9c2637a1d03a45cec9320e4175ee Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 21 Jan 2016 19:10:21 -0800 Subject: [PATCH] Add null expression --- src/parser.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parser.rs b/src/parser.rs index fb6de0c..e9e9f6f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -37,6 +37,7 @@ pub struct Prototype { #[derive(Debug, Clone)] pub enum Expression { + Null, StringLiteral(String), Number(f64), Variable(String), @@ -257,6 +258,7 @@ impl Parser { fn primary_expression(&mut self) -> ParseResult { use tokenizer::Token::*; Ok(match self.peek() { + Some(Keyword(Kw::Null)) => { self.next(); Expression::Null }, Some(NumLiteral(n)) => { self.next(); Expression::Number(n) }, Some(StrLiteral(s)) => { self.next(); Expression::StringLiteral(s) }, Some(Identifier(_)) => { try!(self.identifier_expr()) },