mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
CppLexer: Add token types for "&", "&&", "&=", "|", "||", "|="
This commit is contained in:
parent
345b303262
commit
598b5e4595
2 changed files with 38 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue