mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
CppLexer: Add token types for "::", "::*", ".*", "->*"
This commit is contained in:
parent
1992dbd637
commit
7a1c328417
Notes:
sideshowbarker
2024-07-19 04:34:53 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/7a1c3284179 Pull-request: https://github.com/SerenityOS/serenity/pull/2893
2 changed files with 30 additions and 2 deletions
|
@ -424,6 +424,11 @@ Vector<CppToken> CppLexer::lex()
|
|||
}
|
||||
if (peek() == '>') {
|
||||
consume();
|
||||
if (peek() == '*') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::ArrowAsterisk);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::Arrow);
|
||||
continue;
|
||||
}
|
||||
|
@ -491,7 +496,19 @@ Vector<CppToken> CppLexer::lex()
|
|||
continue;
|
||||
}
|
||||
if (ch == ':') {
|
||||
emit_token(CppToken::Type::Colon);
|
||||
begin_token();
|
||||
consume();
|
||||
if (peek() == ':') {
|
||||
consume();
|
||||
if (peek() == '*') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::ColonColonAsterisk);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::ColonColon);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::Colon);
|
||||
continue;
|
||||
}
|
||||
if (ch == ';') {
|
||||
|
@ -499,7 +516,14 @@ Vector<CppToken> CppLexer::lex()
|
|||
continue;
|
||||
}
|
||||
if (ch == '.') {
|
||||
emit_token(CppToken::Type::Dot);
|
||||
begin_token();
|
||||
consume();
|
||||
if (peek() == '*') {
|
||||
consume();
|
||||
commit_token(CppToken::Type::DotAsterisk);
|
||||
continue;
|
||||
}
|
||||
commit_token(CppToken::Type::Dot);
|
||||
continue;
|
||||
}
|
||||
if (ch == '#') {
|
||||
|
|
|
@ -80,9 +80,13 @@ namespace GUI {
|
|||
__TOKEN(Tilde) \
|
||||
__TOKEN(QuestionMark) \
|
||||
__TOKEN(Colon) \
|
||||
__TOKEN(ColonColon) \
|
||||
__TOKEN(ColonColonAsterisk) \
|
||||
__TOKEN(Semicolon) \
|
||||
__TOKEN(Dot) \
|
||||
__TOKEN(DotAsterisk) \
|
||||
__TOKEN(Arrow) \
|
||||
__TOKEN(ArrowAsterisk) \
|
||||
__TOKEN(DoubleQuotedString) \
|
||||
__TOKEN(SingleQuotedString) \
|
||||
__TOKEN(EscapeSequence) \
|
||||
|
|
Loading…
Add table
Reference in a new issue