lexer: produce nullsafe -> tokens

This commit is contained in:
Ryan Chandler 2022-08-09 21:23:47 +01:00
parent 529bc6f40f
commit 489cb0e884
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 6 additions and 0 deletions

View File

@ -229,6 +229,10 @@ impl Lexer {
self.col += 1;
self.next();
TokenKind::QuestionColon
} else if self.try_read("->") {
self.col += 1;
self.skip(3);
TokenKind::NullsafeArrow
} else {
TokenKind::Question
}

View File

@ -16,6 +16,7 @@ pub enum TokenKind {
Array,
ArrayCast,
Arrow,
NullsafeArrow,
As,
Asterisk,
Attribute,
@ -162,6 +163,7 @@ impl Display for TokenKind {
Self::And => "&&",
Self::AndEqual => "&=",
Self::Arrow => "->",
Self::NullsafeArrow => "?->",
Self::Array => "array",
Self::ArrayCast => "(array)",
Self::As => "as",