Skip to content

Commit

Permalink
Modern logical operator for LOR
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Jul 12, 2023
1 parent f4d9b63 commit d62c677
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/toker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,16 @@ void Toker::nextline()
tokes.push_back(Toke(AND, from, k += 2));
continue;
}
if (c == '|') {
if (c == '|' && n != '|') {
if (n != ' ') line = line.insert(k, 1, ' ');
tokes.push_back(Toke(OR, from, k += 2));
continue;
}
if (c == '|' && n == '|') {
if (line[k + 2] != ' ') line = line.insert(k + 2, 1, ' ');
tokes.push_back(Toke(LOR, from, k += 2));
continue;
}
if (c == '!') {
if (n != ' ') line = line.insert(k, 1, ' ');
tokes.push_back(Toke(NOT, from, k += 2));
Expand Down

0 comments on commit d62c677

Please # to comment.