From 7d1620e433e53912302925b7931bb6dfeaea8bd8 Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Wed, 18 May 2022 10:46:36 -0400 Subject: [PATCH] Allow for escaped quotes, start allowing for semicolon line endings --- ZSharp/Main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ZSharp/Main.cpp b/ZSharp/Main.cpp index 1dc70b7..7f829ff 100644 --- a/ZSharp/Main.cpp +++ b/ZSharp/Main.cpp @@ -172,7 +172,7 @@ boost::any EvalExpression(const string& ex, unordered_map& v for (int i = 0; i < expression.size(); i++) { - if (expression[i] == '\"') + if (expression[i] == '\"' && expression[i-1] != '\\') inQuotes = !inQuotes; if (isalpha(expression[i])) @@ -235,7 +235,7 @@ boost::any EvalExpression(const string& ex, unordered_map& v bool addStrings = false; for (int i = 0; i < (int)newExpression.size(); i++) - if (isalpha(newExpression[i]) || newExpression[i] == '\"') + if (isalpha(newExpression[i]) || (newExpression[i] == '\"' && expression[i-1] != '\\')) { addStrings = true; break; @@ -246,7 +246,7 @@ boost::any EvalExpression(const string& ex, unordered_map& v string withoutParenthesis = ""; for (int i = 0; i < (int)newExpression.size(); i++) { - if (newExpression[i] == '\"') + if (newExpression[i] == '\"' && expression[i-1] != '\\') { inQuotes = !inQuotes; continue; @@ -571,7 +571,6 @@ boost::any ExecuteFunction(const string& functionName, const vector& } catch (const std::exception&) { - LogCriticalError("\'" + unWrapVec(words.at(lineNum)) + "\'\n In function: " + functionName + "\n Line: " + to_string(lineNum)); } } return nullType; @@ -584,7 +583,7 @@ int parseZSharp(string script) InterpreterLog("Contents:\n" + script); #endif - vector lines = split(script, '\n'); + vector lines = split(script, ';'); vector> words; for (int i = 0; i < (int)lines.size(); i++) words.push_back(split(lines.at(i), ' '));