lexer: produce increment tokens

This commit is contained in:
Ryan Chandler 2022-07-28 20:18:08 +01:00
parent 129b4f9626
commit 212a46b2ac
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 8 additions and 0 deletions

View File

@ -604,6 +604,12 @@ impl Lexer {
it.next();
TokenKind::PlusEquals
} else if let Some('+') = it.peek() {
self.col += 1;
it.next();
TokenKind::Increment
} else {
TokenKind::Plus
}

View File

@ -85,6 +85,7 @@ pub enum TokenKind {
Identifier(String),
If,
Implements,
Increment,
InlineHtml(String),
Int(i64),
Interface,
@ -215,6 +216,7 @@ impl Display for TokenKind {
Self::Identifier(id) => &id[..],
Self::If => "if",
Self::Implements => "implements",
Self::Increment => "++",
Self::InlineHtml(_) => "InlineHtml",
Self::Int(_) => "int",
Self::LeftBrace => "{",