mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 02:04:58 +00:00
CppLexer: Add token types for "++", "--"
This commit is contained in:
parent
598b5e4595
commit
c38b8d63f8
2 changed files with 28 additions and 2 deletions
|
@ -394,11 +394,35 @@ Vector<CppToken> CppLexer::lex()
|
|||
continue;
|
||||
}
|
||||
if (ch == '+') {
|
||||
emit_token_equals(CppToken::Type::Plus, CppToken::Type::PlusEquals);
|
||||
begin_token();
|
||||
consume();
|
||||
if (peek() == '+') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::PlusPlus);
|
||||
continue;
|
||||
}
|
||||
if (peek() == '=') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::PlusEquals);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::Plus);
|
||||
continue;
|
||||
}
|
||||
if (ch == '-') {
|
||||
emit_token_equals(CppToken::Type::Minus, CppToken::Type::MinusEquals);
|
||||
begin_token();
|
||||
consume();
|
||||
if (peek() == '-') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::MinusMinus);
|
||||
continue;
|
||||
}
|
||||
if (peek() == '=') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::MinusEquals);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::Minus);
|
||||
continue;
|
||||
}
|
||||
if (ch == '*') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue