summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/CppLexer.cpp28
-rw-r--r--Libraries/LibGUI/CppLexer.h2
2 files changed, 28 insertions, 2 deletions
diff --git a/Libraries/LibGUI/CppLexer.cpp b/Libraries/LibGUI/CppLexer.cpp
index c1f8853519..66d8647977 100644
--- a/Libraries/LibGUI/CppLexer.cpp
+++ b/Libraries/LibGUI/CppLexer.cpp
@@ -394,11 +394,35 @@ Vector<CppToken> CppLexer::lex()
continue;
}
if (ch == '+') {
- emit_token_equals(CppToken::Type::Plus, CppToken::Type::PlusEquals);
+ begin_token();
+ consume();
+ if (peek() == '+') {
+ consume();
+ commit_token(CppToken::Type::PlusPlus);
+ continue;
+ }
+ if (peek() == '=') {
+ consume();
+ commit_token(CppToken::Type::PlusEquals);
+ continue;
+ }
+ commit_token(CppToken::Type::Plus);
continue;
}
if (ch == '-') {
- emit_token_equals(CppToken::Type::Minus, CppToken::Type::MinusEquals);
+ begin_token();
+ consume();
+ if (peek() == '-') {
+ consume();
+ commit_token(CppToken::Type::MinusMinus);
+ continue;
+ }
+ if (peek() == '=') {
+ consume();
+ commit_token(CppToken::Type::MinusEquals);
+ continue;
+ }
+ commit_token(CppToken::Type::Minus);
continue;
}
if (ch == '*') {
diff --git a/Libraries/LibGUI/CppLexer.h b/Libraries/LibGUI/CppLexer.h
index 88d0ebcf4e..8bd80c355d 100644
--- a/Libraries/LibGUI/CppLexer.h
+++ b/Libraries/LibGUI/CppLexer.h
@@ -54,8 +54,10 @@ namespace GUI {
__TOKEN(LessGreater) \
__TOKEN(Comma) \
__TOKEN(Plus) \
+ __TOKEN(PlusPlus) \
__TOKEN(PlusEquals) \
__TOKEN(Minus) \
+ __TOKEN(MinusMinus) \
__TOKEN(MinusEquals) \
__TOKEN(Asterisk) \
__TOKEN(AsteriskEquals) \