parser: support true/false (bool) expressions

This commit is contained in:
Ryan Chandler 2022-07-28 14:45:05 +01:00
parent 39c7d9887d
commit ea1365c77d
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 4 additions and 1 deletions

View File

@ -269,7 +269,8 @@ pub enum Expression {
ConstFetch(Box<Self>, Identifier),
MethodCall(Box<Self>, Identifier, Vec<Self>),
StaticMethodCall(Box<Self>, Identifier, Vec<Self>),
AnonymousClass(Option<Identifier>, Vec<Identifier>, Block)
AnonymousClass(Option<Identifier>, Vec<Identifier>, Block),
Bool(bool),
}
#[derive(Debug, Clone, PartialEq, Serialize)]

View File

@ -713,6 +713,8 @@ impl Parser {
TokenKind::Int(i) => Expression::Int(*i),
TokenKind::Identifier(i) => Expression::Identifier(i.to_string()),
TokenKind::ConstantString(s) => Expression::ConstantString(s.to_string()),
TokenKind::True => Expression::Bool(true),
TokenKind::False => Expression::Bool(false),
TokenKind::LeftParen => {
self.next();