mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-26 19:32:06 -05:00
CppLexer: Add token type for "*="
This commit is contained in:
parent
b09b8d99f2
commit
5a36d8acb8
2 changed files with 13 additions and 1 deletions
|
@ -243,6 +243,17 @@ Vector<CppToken> CppLexer::lex()
|
|||
tokens.append(token);
|
||||
};
|
||||
|
||||
auto emit_token_equals = [&](auto type, auto equals_type) {
|
||||
if (peek(1) == '=') {
|
||||
begin_token();
|
||||
consume();
|
||||
consume();
|
||||
commit_token(equals_type);
|
||||
return;
|
||||
}
|
||||
emit_token(type);
|
||||
};
|
||||
|
||||
auto match_escape_sequence = [&]() -> size_t {
|
||||
switch (peek(1)) {
|
||||
case '\'':
|
||||
|
@ -336,7 +347,7 @@ Vector<CppToken> CppLexer::lex()
|
|||
continue;
|
||||
}
|
||||
if (ch == '*') {
|
||||
emit_token(CppToken::Type::Asterisk);
|
||||
emit_token_equals(CppToken::Type::Asterisk, CppToken::Type::AsteriskEquals);
|
||||
continue;
|
||||
}
|
||||
if (ch == ';') {
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace GUI {
|
|||
__TOKEN(RightBracket) \
|
||||
__TOKEN(Comma) \
|
||||
__TOKEN(Asterisk) \
|
||||
__TOKEN(AsteriskEquals) \
|
||||
__TOKEN(Semicolon) \
|
||||
__TOKEN(DoubleQuotedString) \
|
||||
__TOKEN(SingleQuotedString) \
|
||||
|
|
Loading…
Add table
Reference in a new issue