1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 02:18:11 +00:00

CppLexer: Add token types for ".", "->"

This commit is contained in:
Nico Weber 2020-07-26 18:26:04 -04:00 committed by Andreas Kling
parent 95113d15fe
commit 1992dbd637
2 changed files with 11 additions and 0 deletions

View file

@ -422,6 +422,11 @@ Vector<CppToken> CppLexer::lex()
commit_token(CppToken::Type::MinusEquals); commit_token(CppToken::Type::MinusEquals);
continue; continue;
} }
if (peek() == '>') {
consume();
commit_token(CppToken::Type::Arrow);
continue;
}
commit_token(CppToken::Type::Minus); commit_token(CppToken::Type::Minus);
continue; continue;
} }
@ -493,6 +498,10 @@ Vector<CppToken> CppLexer::lex()
emit_token(CppToken::Type::Semicolon); emit_token(CppToken::Type::Semicolon);
continue; continue;
} }
if (ch == '.') {
emit_token(CppToken::Type::Dot);
continue;
}
if (ch == '#') { if (ch == '#') {
begin_token(); begin_token();
consume(); consume();

View file

@ -81,6 +81,8 @@ namespace GUI {
__TOKEN(QuestionMark) \ __TOKEN(QuestionMark) \
__TOKEN(Colon) \ __TOKEN(Colon) \
__TOKEN(Semicolon) \ __TOKEN(Semicolon) \
__TOKEN(Dot) \
__TOKEN(Arrow) \
__TOKEN(DoubleQuotedString) \ __TOKEN(DoubleQuotedString) \
__TOKEN(SingleQuotedString) \ __TOKEN(SingleQuotedString) \
__TOKEN(EscapeSequence) \ __TOKEN(EscapeSequence) \