From 3476d3c64296b1017b88a4e85c9eb1828b218c86 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 12 Aug 2023 13:02:36 +0200 Subject: [PATCH] lexer.cpp: Rename isString to isStringDelimiter Add a few comments in other files Signed-off-by: Username404 --- src/etc/lexer.cpp | 6 +++--- src/headers/transpiler/Target.hpp | 2 +- src/main.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/etc/lexer.cpp b/src/etc/lexer.cpp index b11187d..325ef98 100644 --- a/src/etc/lexer.cpp +++ b/src/etc/lexer.cpp @@ -64,9 +64,9 @@ vector lex(const string_view& in) string formedString; for (;i < in.size(); ++i) { const tok::type currentCharType = getIdentifierCharType(in[i]); - const bool isString = currentCharType == STRING; - if (isTypeString && (i == in.size() - 1 && not isString)) throw tok::LexerException("A never ending string was found", lineNumber); - if ((currentCharType == type || isTypeString) && !isString) { + const bool isStringDelimiter = currentCharType == STRING; + if (isTypeString && (i == in.size() - 1 && not isStringDelimiter)) throw tok::LexerException("A never ending string was found", lineNumber); + if ((currentCharType == type || isTypeString) && !isStringDelimiter) { formedString += in[i]; } else { if (not isTypeString) --i; diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index 324d909..2060c7f 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -93,7 +93,7 @@ protected: } catch (const out_of_range&) { throw Yerbacon::Exception(string( #ifndef __GNUC__ - id.name() + id.name() // This is undefined behaviour but most other compilers should output the name #else abi::__cxa_demangle(id.name(), nullptr, nullptr, nullptr) #endif diff --git a/src/main.cpp b/src/main.cpp index 75f388a..9315327 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { unit_result resultingPair; try { resultingPair.first = Target::forName(target, newLines)->transpileWithTree( - parseString(text_provided ? string(currentArgument) + '\n' : getFileContent(file_path->string())) + parseString(text_provided ? string(currentArgument) + '\n' : getFileContent(file_path->string(/* NOTE: This string is expected to finish with a line ending */))) ); if (!text_provided or output_directory.has_value()) outputFileContent(