CppLexer: Add token types for "!", "!=", "~", "?", ":"

This commit is contained in:
Nico Weber 2020-07-26 18:20:50 -04:00 committed by Andreas Kling
parent 29bc978564
commit 95113d15fe
2 changed files with 21 additions and 0 deletions

View file

@ -437,6 +437,10 @@ Vector<CppToken> CppLexer::lex()
emit_token_equals(CppToken::Type::Caret, CppToken::Type::CaretEquals);
continue;
}
if (ch == '!') {
emit_token_equals(CppToken::Type::ExclamationMark, CppToken::Type::ExclamationMarkEquals);
continue;
}
if (ch == '=') {
emit_token_equals(CppToken::Type::Equals, CppToken::Type::EqualsEquals);
continue;
@ -473,6 +477,18 @@ Vector<CppToken> CppLexer::lex()
commit_token(CppToken::Type::Pipe);
continue;
}
if (ch == '~') {
emit_token(CppToken::Type::Tilde);
continue;
}
if (ch == '?') {
emit_token(CppToken::Type::QuestionMark);
continue;
}
if (ch == ':') {
emit_token(CppToken::Type::Colon);
continue;
}
if (ch == ';') {
emit_token(CppToken::Type::Semicolon);
continue;

View file

@ -67,6 +67,8 @@ namespace GUI {
__TOKEN(PercentEquals) \
__TOKEN(Caret) \
__TOKEN(CaretEquals) \
__TOKEN(ExclamationMark) \
__TOKEN(ExclamationMarkEquals) \
__TOKEN(Equals) \
__TOKEN(EqualsEquals) \
__TOKEN(And) \
@ -75,6 +77,9 @@ namespace GUI {
__TOKEN(Pipe) \
__TOKEN(PipePipe) \
__TOKEN(PipeEquals) \
__TOKEN(Tilde) \
__TOKEN(QuestionMark) \
__TOKEN(Colon) \
__TOKEN(Semicolon) \
__TOKEN(DoubleQuotedString) \
__TOKEN(SingleQuotedString) \