mirror of
https://github.com/danog/parser.git
synced 2025-01-22 21:11:55 +01:00
lexer: produce shorthand ternary tokens
This commit is contained in:
parent
dc4cb10ac3
commit
0ae93c2ea1
@ -225,6 +225,10 @@ impl Lexer {
|
||||
} else {
|
||||
TokenKind::Coalesce
|
||||
}
|
||||
} else if let Some(':') = self.peek {
|
||||
self.col += 1;
|
||||
self.next();
|
||||
TokenKind::QuestionColon
|
||||
} else {
|
||||
TokenKind::Question
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ pub enum TokenKind {
|
||||
Public,
|
||||
QualifiedIdentifier(String),
|
||||
Question,
|
||||
QuestionColon,
|
||||
Require,
|
||||
RequireOnce,
|
||||
Return,
|
||||
@ -258,6 +259,7 @@ impl Display for TokenKind {
|
||||
Self::Public => "public",
|
||||
Self::QualifiedIdentifier(id) => &id[..],
|
||||
Self::Question => "?",
|
||||
Self::QuestionColon => "?:",
|
||||
Self::Require => "require",
|
||||
Self::RequireOnce => "require_once",
|
||||
Self::Return => "return",
|
||||
|
Loading…
x
Reference in New Issue
Block a user