From d62c6772216e81f162e974c3e71099f4a7fadb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=82=A6=E8=A7=A3=E8=AF=B4?= Date: Wed, 12 Jul 2023 17:34:24 +0800 Subject: [PATCH] Modern logical operator for LOR --- compiler/toker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/toker.cpp b/compiler/toker.cpp index 5a2419cc..47a8f818 100644 --- a/compiler/toker.cpp +++ b/compiler/toker.cpp @@ -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));