mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:28:12 +00:00
CppLexer: Add token types for "+", "+=", "-", "-=", "=", "==", "/", "/="
Mostly so that TextEdit doesn't emit logspam when I write `int a = 4` in a test program.
This commit is contained in:
parent
5a36d8acb8
commit
96d13f75cf
2 changed files with 24 additions and 0 deletions
|
@ -346,10 +346,22 @@ Vector<CppToken> CppLexer::lex()
|
||||||
emit_token(CppToken::Type::Comma);
|
emit_token(CppToken::Type::Comma);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ch == '+') {
|
||||||
|
emit_token_equals(CppToken::Type::Plus, CppToken::Type::PlusEquals);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch == '-') {
|
||||||
|
emit_token_equals(CppToken::Type::Minus, CppToken::Type::MinusEquals);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ch == '*') {
|
if (ch == '*') {
|
||||||
emit_token_equals(CppToken::Type::Asterisk, CppToken::Type::AsteriskEquals);
|
emit_token_equals(CppToken::Type::Asterisk, CppToken::Type::AsteriskEquals);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ch == '=') {
|
||||||
|
emit_token_equals(CppToken::Type::Equals, CppToken::Type::EqualsEquals);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ch == ';') {
|
if (ch == ';') {
|
||||||
emit_token(CppToken::Type::Semicolon);
|
emit_token(CppToken::Type::Semicolon);
|
||||||
continue;
|
continue;
|
||||||
|
@ -422,6 +434,10 @@ Vector<CppToken> CppLexer::lex()
|
||||||
commit_token(CppToken::Type::Comment);
|
commit_token(CppToken::Type::Comment);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ch == '/') {
|
||||||
|
emit_token_equals(CppToken::Type::Slash, CppToken::Type::SlashEquals);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ch == '"') {
|
if (ch == '"') {
|
||||||
begin_token();
|
begin_token();
|
||||||
consume();
|
consume();
|
||||||
|
|
|
@ -44,8 +44,16 @@ namespace GUI {
|
||||||
__TOKEN(LeftBracket) \
|
__TOKEN(LeftBracket) \
|
||||||
__TOKEN(RightBracket) \
|
__TOKEN(RightBracket) \
|
||||||
__TOKEN(Comma) \
|
__TOKEN(Comma) \
|
||||||
|
__TOKEN(Plus) \
|
||||||
|
__TOKEN(PlusEquals) \
|
||||||
|
__TOKEN(Minus) \
|
||||||
|
__TOKEN(MinusEquals) \
|
||||||
__TOKEN(Asterisk) \
|
__TOKEN(Asterisk) \
|
||||||
__TOKEN(AsteriskEquals) \
|
__TOKEN(AsteriskEquals) \
|
||||||
|
__TOKEN(Slash) \
|
||||||
|
__TOKEN(SlashEquals) \
|
||||||
|
__TOKEN(Equals) \
|
||||||
|
__TOKEN(EqualsEquals) \
|
||||||
__TOKEN(Semicolon) \
|
__TOKEN(Semicolon) \
|
||||||
__TOKEN(DoubleQuotedString) \
|
__TOKEN(DoubleQuotedString) \
|
||||||
__TOKEN(SingleQuotedString) \
|
__TOKEN(SingleQuotedString) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue