From 151e0d90c34effcb78ac4189c11b095b045d803b Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Thu, 28 Jul 2022 15:53:47 +0100 Subject: [PATCH] parser: support null constant --- trunk_parser/src/ast.rs | 1 + trunk_parser/src/parser/mod.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/trunk_parser/src/ast.rs b/trunk_parser/src/ast.rs index 6f1db28..c82dd21 100644 --- a/trunk_parser/src/ast.rs +++ b/trunk_parser/src/ast.rs @@ -272,6 +272,7 @@ pub enum Expression { AnonymousClass(Option, Vec, Block), Bool(bool), ArrayIndex(Box, Option>), + Null, } #[derive(Debug, Clone, PartialEq, Serialize)] diff --git a/trunk_parser/src/parser/mod.rs b/trunk_parser/src/parser/mod.rs index dfd9ea0..68d629e 100644 --- a/trunk_parser/src/parser/mod.rs +++ b/trunk_parser/src/parser/mod.rs @@ -739,6 +739,10 @@ impl Parser { self.next(); e }, + TokenKind::Null => { + self.next(); + Expression::Null + }, TokenKind::LeftParen => { self.next();