summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGUI/CppLexer.cpp32
-rw-r--r--Libraries/LibGUI/CppLexer.h6
2 files changed, 38 insertions, 0 deletions
diff --git a/Libraries/LibGUI/CppLexer.cpp b/Libraries/LibGUI/CppLexer.cpp
index 0a812a134c..c1f8853519 100644
--- a/Libraries/LibGUI/CppLexer.cpp
+++ b/Libraries/LibGUI/CppLexer.cpp
@@ -413,6 +413,38 @@ Vector<CppToken> CppLexer::lex()
emit_token_equals(CppToken::Type::Equals, CppToken::Type::EqualsEquals);
continue;
}
+ if (ch == '&') {
+ begin_token();
+ consume();
+ if (peek() == '&') {
+ consume();
+ commit_token(CppToken::Type::AndAnd);
+ continue;
+ }
+ if (peek() == '=') {
+ consume();
+ commit_token(CppToken::Type::AndEquals);
+ continue;
+ }
+ commit_token(CppToken::Type::And);
+ continue;
+ }
+ if (ch == '|') {
+ begin_token();
+ consume();
+ if (peek() == '|') {
+ consume();
+ commit_token(CppToken::Type::PipePipe);
+ continue;
+ }
+ if (peek() == '=') {
+ consume();
+ commit_token(CppToken::Type::PipeEquals);
+ continue;
+ }
+ commit_token(CppToken::Type::Pipe);
+ continue;
+ }
if (ch == ';') {
emit_token(CppToken::Type::Semicolon);
continue;
diff --git a/Libraries/LibGUI/CppLexer.h b/Libraries/LibGUI/CppLexer.h
index 4a7d077daa..88d0ebcf4e 100644
--- a/Libraries/LibGUI/CppLexer.h
+++ b/Libraries/LibGUI/CppLexer.h
@@ -65,6 +65,12 @@ namespace GUI {
__TOKEN(PercentEquals) \
__TOKEN(Equals) \
__TOKEN(EqualsEquals) \
+ __TOKEN(And) \
+ __TOKEN(AndAnd) \
+ __TOKEN(AndEquals) \
+ __TOKEN(Pipe) \
+ __TOKEN(PipePipe) \
+ __TOKEN(PipeEquals) \
__TOKEN(Semicolon) \
__TOKEN(DoubleQuotedString) \
__TOKEN(SingleQuotedString) \