summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-07-26 18:20:50 -0400
committerAndreas Kling <kling@serenityos.org>2020-07-27 01:04:17 +0200
commit95113d15fe4173b3f04f0a57927fbe808ba5a50f (patch)
treee9e77825cd7039a09be3e8d8876c56b5998b0615
parent29bc97856456b7909ccf62c8796c715b18d84166 (diff)
downloadserenity-95113d15fe4173b3f04f0a57927fbe808ba5a50f.zip
CppLexer: Add token types for "!", "!=", "~", "?", ":"
-rw-r--r--Libraries/LibGUI/CppLexer.cpp16
-rw-r--r--Libraries/LibGUI/CppLexer.h5
2 files changed, 21 insertions, 0 deletions
diff --git a/Libraries/LibGUI/CppLexer.cpp b/Libraries/LibGUI/CppLexer.cpp
index 943cbf105f..0a34b98e18 100644
--- a/Libraries/LibGUI/CppLexer.cpp
+++ b/Libraries/LibGUI/CppLexer.cpp
@@ -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;
diff --git a/Libraries/LibGUI/CppLexer.h b/Libraries/LibGUI/CppLexer.h
index 6a69584a88..80d468f216 100644
--- a/Libraries/LibGUI/CppLexer.h
+++ b/Libraries/LibGUI/CppLexer.h
@@ -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) \