Remove a useless condition and two unnecessary parentheses in lexer.cpp

This commit is contained in:
Username404 2021-11-24 18:35:54 +01:00
parent 3c4586cc70
commit c9a6a6c918
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,9 @@ endif()
if (${IS_GNU} OR ${IS_CLANG}) if (${IS_GNU} OR ${IS_CLANG})
if (NOT MINGW) if (NOT MINGW)
if (CMAKE_VERSION STREQUAL "3.22.0")
message(WARNING "CMake ${CMAKE_VERSION} does not support mingw cross-compilers")
endif()
include(FindOpenMP) include(FindOpenMP)
if (OpenMP_CXX_FOUND) if (OpenMP_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")

View File

@ -19,7 +19,7 @@ vector<tok> lex(const string& in)
switch (current) { switch (current) {
case DIVIDE: if (in[i + 1] == current) i += 2; else goto insertToken; case DIVIDE: if (in[i + 1] == current) i += 2; else goto insertToken;
case TAG: { case TAG: {
if ((current == TAG && in[i + 1] == DEFINE)) { // See the IDENTIFIER case in Parser.hpp if (current == TAG && in[i + 1] == DEFINE) { // See the IDENTIFIER case in Parser.hpp
goto insertToken; goto insertToken;
} else { } else {
while (not (in[i + 1] == EOF_ || in[i + 1] == '\n')) { while (not (in[i + 1] == EOF_ || in[i + 1] == '\n')) {
@ -29,7 +29,7 @@ vector<tok> lex(const string& in)
} }
} }
case ASTERISK: { case ASTERISK: {
if ((in.size() - i) > 2 && in[i + 1] == ASTERISK) { if (in[i + 1] == ASTERISK) {
i += 2; i += 2;
try { try {
while (not (in.at(i) == ASTERISK && in.at(i + 1) == ASTERISK)) { while (not (in.at(i) == ASTERISK && in.at(i + 1) == ASTERISK)) {