Auto-update dlang core files [skip ci]
This commit is contained in:
1 parent
c8a040ed7c
commit
890f4290b6
4 files changed
+19
-8
No files matched your search
@@ -14,10 +14,10 @@ static void NativeRegexMatch(DlangVM* vm)
|
|||||||
try {
|
try {
|
||||||
std::regex rx(pattern);
|
std::regex rx(pattern);
|
||||||
bool matched = std::regex_match(text, rx);
|
bool matched = std::regex_match(text, rx);
|
||||||
dlang_pushnumber(vm, matched ? 1.0 : 0.0);
|
dlang_pushboolean(vm, matched);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
dlang_pushnumber(vm, 0.0);
|
dlang_pushboolean(vm, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@ static void NativeRegexSearch(DlangVM* vm)
|
|||||||
try {
|
try {
|
||||||
std::regex rx(pattern);
|
std::regex rx(pattern);
|
||||||
bool found = std::regex_search(text, rx);
|
bool found = std::regex_search(text, rx);
|
||||||
dlang_pushnumber(vm, found ? 1.0 : 0.0);
|
dlang_pushboolean(vm, found);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
dlang_pushnumber(vm, 0.0);
|
dlang_pushboolean(vm, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +45,7 @@ static void NativeRegexReplace(DlangVM* vm)
|
|||||||
try {
|
try {
|
||||||
std::regex rx(pattern);
|
std::regex rx(pattern);
|
||||||
std::string result = std::regex_replace(text, rx, fmt);
|
std::string result = std::regex_replace(text, rx, fmt);
|
||||||
|
|
||||||
dlang_pushstring(vm, result);
|
dlang_pushstring(vm, result);
|
||||||
dlang_pushindex(vm);
|
dlang_pushindex(vm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,13 @@ Token& Parser::ShouldBe(TokenType type, const std::string& value)
|
|||||||
const auto& current = Current();
|
const auto& current = Current();
|
||||||
|
|
||||||
if (current.type != type)
|
if (current.type != type)
|
||||||
throw std::runtime_error("Unexpected type '" + std::string(TokenTypeToString(current.type)) + "' where '" + std::string(TokenTypeToString(type)) + "' should be " + LocationText(current));
|
throw std::runtime_error("Syntax Error: Expected token type '" + std::string(TokenTypeToString(type)) +
|
||||||
|
"' but got '" + std::string(TokenTypeToString(current.type)) +
|
||||||
|
"' (value: '" + current.value + "') " + LocationText(current));
|
||||||
|
|
||||||
if (!value.empty() && value != current.value)
|
if (!value.empty() && value != current.value)
|
||||||
throw std::runtime_error("Unexpected value '" + current.value + "' where '" + value + "' should be " + LocationText(current));
|
throw std::runtime_error("Syntax Error: Expected specific value '" + value +
|
||||||
|
"' but got '" + current.value + "' " + LocationText(current));
|
||||||
|
|
||||||
return Consume();
|
return Consume();
|
||||||
}
|
}
|
||||||
@@ -481,7 +484,11 @@ std::unique_ptr<Expression> Parser::ParsePrimary()
|
|||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Expected expression " + LocationText(current));
|
std::string tokenDesc = std::string(TokenTypeToString(current.type));
|
||||||
|
if (!current.value.empty()) {
|
||||||
|
tokenDesc += " ('" + current.value + "')";
|
||||||
|
}
|
||||||
|
throw std::runtime_error("Expected expression, but found unexpected token type " + tokenDesc + " " + LocationText(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Expression> Parser::ParseMultiplicative()
|
std::unique_ptr<Expression> Parser::ParseMultiplicative()
|
||||||
|
|||||||
@@ -545,6 +545,9 @@ StackValue DlangVM::GetField(const std::string& key, bool popTable)
|
|||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Cant get field on non table type %s!\n", StackValueTypeToString(stackTable.type).c_str());
|
||||||
|
return StackValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
StackValue DlangVM::GetTableKeys()
|
StackValue DlangVM::GetTableKeys()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
inline ModuleManager* pluginManager = nullptr;
|
inline ModuleManager* pluginManager = nullptr;
|
||||||
|
|
||||||
#define DEBUG_MODE 1
|
#define DEBUG_MODE 1
|
||||||
#define VERSION "{DEVBUILD}"
|
#define VERSION "v1.0.29"
|
||||||
|
|
||||||
using ByteCodeArray = std::vector<double>;
|
using ByteCodeArray = std::vector<double>;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user