Skip to content

Commit

Permalink
port-clang: this should fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Oct 23, 2023
1 parent e9f41e4 commit d406783
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
35 changes: 0 additions & 35 deletions src/tdme/utilities/MiniScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 34 additions & 1 deletion src/tdme/utilities/MiniScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d406783

Please sign in to comment.