mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00: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);
|
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 {
|
auto match_escape_sequence = [&]() -> size_t {
|
||||||
switch (peek(1)) {
|
switch (peek(1)) {
|
||||||
case '\'':
|
case '\'':
|
||||||
|
@ -336,7 +347,7 @@ Vector<CppToken> CppLexer::lex()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ch == '*') {
|
if (ch == '*') {
|
||||||
emit_token(CppToken::Type::Asterisk);
|
emit_token_equals(CppToken::Type::Asterisk, CppToken::Type::AsteriskEquals);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ch == ';') {
|
if (ch == ';') {
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace GUI {
|
||||||
__TOKEN(RightBracket) \
|
__TOKEN(RightBracket) \
|
||||||
__TOKEN(Comma) \
|
__TOKEN(Comma) \
|
||||||
__TOKEN(Asterisk) \
|
__TOKEN(Asterisk) \
|
||||||
|
__TOKEN(AsteriskEquals) \
|
||||||
__TOKEN(Semicolon) \
|
__TOKEN(Semicolon) \
|
||||||
__TOKEN(DoubleQuotedString) \
|
__TOKEN(DoubleQuotedString) \
|
||||||
__TOKEN(SingleQuotedString) \
|
__TOKEN(SingleQuotedString) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue