fix: allow self/parent as identifier

This commit is contained in:
Ryan Chandler 2022-12-06 16:55:34 +00:00
parent 72f2588509
commit d85b682d4f
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
3 changed files with 13 additions and 1 deletions

View File

@ -423,6 +423,8 @@ pub enum Expression {
},
Identifier(Identifier),
Static,
Self_,
Parent,
Array {
items: Vec<ArrayItem>,
},

View File

@ -108,6 +108,8 @@ pub fn is_reserved_ident(kind: &TokenKind) -> bool {
matches!(
kind,
TokenKind::Static
| TokenKind::Parent
| TokenKind::Self_
| TokenKind::Abstract
| TokenKind::Final
| TokenKind::For

View File

@ -1112,7 +1112,15 @@ impl Parser {
TokenKind::Static => {
state.next();
Expression::Static
}
},
TokenKind::Self_ => {
state.next();
Expression::Self_
},
TokenKind::Parent => {
state.next();
Expression::Parent
},
TokenKind::LiteralString(s) => {
let e = Expression::LiteralString { value: s.clone() };
state.next();