mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue