mirror of
https://github.com/danog/parser.git
synced 2024-11-27 04:14:55 +01:00
parser: support true/false (bool) expressions
This commit is contained in:
parent
39c7d9887d
commit
ea1365c77d
@ -269,7 +269,8 @@ pub enum Expression {
|
|||||||
ConstFetch(Box<Self>, Identifier),
|
ConstFetch(Box<Self>, Identifier),
|
||||||
MethodCall(Box<Self>, Identifier, Vec<Self>),
|
MethodCall(Box<Self>, Identifier, Vec<Self>),
|
||||||
StaticMethodCall(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)]
|
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||||
|
@ -713,6 +713,8 @@ impl Parser {
|
|||||||
TokenKind::Int(i) => Expression::Int(*i),
|
TokenKind::Int(i) => Expression::Int(*i),
|
||||||
TokenKind::Identifier(i) => Expression::Identifier(i.to_string()),
|
TokenKind::Identifier(i) => Expression::Identifier(i.to_string()),
|
||||||
TokenKind::ConstantString(s) => Expression::ConstantString(s.to_string()),
|
TokenKind::ConstantString(s) => Expression::ConstantString(s.to_string()),
|
||||||
|
TokenKind::True => Expression::Bool(true),
|
||||||
|
TokenKind::False => Expression::Bool(false),
|
||||||
TokenKind::LeftParen => {
|
TokenKind::LeftParen => {
|
||||||
self.next();
|
self.next();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user