mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
CppLexer: Add token types for "++", "--"
This commit is contained in:
parent
598b5e4595
commit
c38b8d63f8
Notes:
sideshowbarker
2024-07-19 04:35:08 +09:00
Author: https://github.com/nico
Commit: c38b8d63f8
Pull-request: https://github.com/SerenityOS/serenity/pull/2893
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