From d406783ee41551ee33fe5ee1b9f7e2d546178f39 Mon Sep 17 00:00:00 2001 From: Andreas Drewke Date: Mon, 23 Oct 2023 20:54:21 +0200 Subject: [PATCH] port-clang: this should fix the build --- src/tdme/utilities/MiniScript.cpp | 35 ------------------------------- src/tdme/utilities/MiniScript.h | 35 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/tdme/utilities/MiniScript.cpp b/src/tdme/utilities/MiniScript.cpp index 60bf8122b..d1f3f1c99 100644 --- a/src/tdme/utilities/MiniScript.cpp +++ b/src/tdme/utilities/MiniScript.cpp @@ -8574,41 +8574,6 @@ inline const MiniScript::ScriptVariable MiniScript::initializeVariable(const Scr return variable; } -inline bool MiniScript::viewIsFunctionAssignment(const string_view& candidate, string& function) { - if (candidate.size() == 0) return false; - // - auto i = 0; - // ( - if (candidate[i++] != '(') return false; - // - if (i >= candidate.size()) return false; - // ) - if (candidate[i++] != ')') return false; - // spaces - for (; i < candidate.size() && Character::isSpace(candidate[i]) == true; i++); if (i >= candidate.size()) return false; - // - - if (candidate[i++] != '-') return false; - // - if (i >= candidate.size()) return false; - // > - if (candidate[i++] != '>') return false; - // spaces - for (; i < candidate.size() && Character::isSpace(candidate[i]) == true; i++); if (i >= candidate.size()) return false; - // - string _function; - for (; i < candidate.size(); i++) { - auto c = candidate[i]; - if (Character::isAlphaNumeric(c) == false && c != '_') { - return false; - } - _function+= c; - } - // - function = _function; - // - return true; -} - inline bool MiniScript::viewIsKey(const string_view& candidate) { if (candidate.size() == 0) return false; if (candidate[0] == '$') return false; diff --git a/src/tdme/utilities/MiniScript.h b/src/tdme/utilities/MiniScript.h index d7e882349..eb30f426c 100644 --- a/src/tdme/utilities/MiniScript.h +++ b/src/tdme/utilities/MiniScript.h @@ -2731,7 +2731,40 @@ class tdme::utilities::MiniScript { * @param function function * @return if candidate is a function assignment */ - static bool viewIsFunctionAssignment(const string_view& candidate, string& function); + inline static bool viewIsFunctionAssignment(const string_view& candidate, string& function) { + if (candidate.size() == 0) return false; + // + auto i = 0; + // ( + if (candidate[i++] != '(') return false; + // + if (i >= candidate.size()) return false; + // ) + if (candidate[i++] != ')') return false; + // spaces + for (; i < candidate.size() && Character::isSpace(candidate[i]) == true; i++); if (i >= candidate.size()) return false; + // - + if (candidate[i++] != '-') return false; + // + if (i >= candidate.size()) return false; + // > + if (candidate[i++] != '>') return false; + // spaces + for (; i < candidate.size() && Character::isSpace(candidate[i]) == true; i++); if (i >= candidate.size()) return false; + // + string _function; + for (; i < candidate.size(); i++) { + auto c = candidate[i]; + if (Character::isAlphaNumeric(c) == false && c != '_') { + return false; + } + _function+= c; + } + // + function = _function; + // + return true; + } /** * Returns if a given string is a variable name