Add null expression

This commit is contained in:
greg 2016-01-21 19:10:21 -08:00
parent 7114e446a4
commit 15d4317191
1 changed files with 2 additions and 0 deletions

View File

@ -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<Expression> {
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()) },