mirror of
https://github.com/danog/parser.git
synced 2025-01-22 21:11:55 +01:00
lexer: produce nullsafe -> tokens
This commit is contained in:
parent
529bc6f40f
commit
489cb0e884
@ -229,6 +229,10 @@ impl Lexer {
|
|||||||
self.col += 1;
|
self.col += 1;
|
||||||
self.next();
|
self.next();
|
||||||
TokenKind::QuestionColon
|
TokenKind::QuestionColon
|
||||||
|
} else if self.try_read("->") {
|
||||||
|
self.col += 1;
|
||||||
|
self.skip(3);
|
||||||
|
TokenKind::NullsafeArrow
|
||||||
} else {
|
} else {
|
||||||
TokenKind::Question
|
TokenKind::Question
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ pub enum TokenKind {
|
|||||||
Array,
|
Array,
|
||||||
ArrayCast,
|
ArrayCast,
|
||||||
Arrow,
|
Arrow,
|
||||||
|
NullsafeArrow,
|
||||||
As,
|
As,
|
||||||
Asterisk,
|
Asterisk,
|
||||||
Attribute,
|
Attribute,
|
||||||
@ -162,6 +163,7 @@ impl Display for TokenKind {
|
|||||||
Self::And => "&&",
|
Self::And => "&&",
|
||||||
Self::AndEqual => "&=",
|
Self::AndEqual => "&=",
|
||||||
Self::Arrow => "->",
|
Self::Arrow => "->",
|
||||||
|
Self::NullsafeArrow => "?->",
|
||||||
Self::Array => "array",
|
Self::Array => "array",
|
||||||
Self::ArrayCast => "(array)",
|
Self::ArrayCast => "(array)",
|
||||||
Self::As => "as",
|
Self::As => "as",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user