replace '<string>' source name with '[string]'

This commit is contained in:
MihailRis 2024-11-19 09:53:15 +03:00
parent 134deb0ae6
commit c543575150
8 changed files with 20 additions and 20 deletions

View File

@ -265,5 +265,5 @@ dv::value json::parse(
}
dv::value json::parse(std::string_view source) {
return parse("<string>", source);
return parse("[string]", source);
}

View File

@ -250,7 +250,7 @@ std::string Parser::parseText() {
}
nextChar();
}
return Parser("<string>", std::string(source.substr(start, pos - start)))
return Parser("[string]", std::string(source.substr(start, pos - start)))
.parseString('\0', false);
}

View File

@ -20,7 +20,7 @@ std::shared_ptr<gui::UINode> guiutil::create(const std::string& source, scripten
env = scripting::get_root_environment();
}
UiXmlReader reader(env);
return reader.readXML("<string>", source);
return reader.readXML("[string]", source);
}
void guiutil::alert(GUI* gui, const std::wstring& text, const runnable& on_hidden) {

View File

@ -418,7 +418,7 @@ Command Command::create(
std::string_view description,
executor_func executor
) {
return CommandParser("<string>", scheme)
return CommandParser("[string]", scheme)
.parseScheme(std::move(executor), description);
}
@ -440,5 +440,5 @@ Command* CommandsRepository::get(const std::string& name) {
}
Prompt CommandsInterpreter::parse(std::string_view text) {
return CommandParser("<string>", text).parsePrompt(this);
return CommandParser("[string]", text).parsePrompt(this);
}

View File

@ -11,7 +11,7 @@ static int l_json_stringify(lua::State* L) {
static int l_json_parse(lua::State* L) {
auto string = lua::require_string(L, 1);
auto element = json::parse("<string>", string);
auto element = json::parse("[string]", string);
return lua::pushvalue(L, element);
}

View File

@ -16,7 +16,7 @@ static int l_toml_stringify(lua::State* L) {
static int l_toml_parse(lua::State* L) {
auto string = lua::require_string(L, 1);
auto element = toml::parse("<string>", string);
auto element = toml::parse("[string]", string);
return lua::pushvalue(L, element);
}

View File

@ -14,66 +14,66 @@ namespace scripting {
runnable create_runnable(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
wstringconsumer create_wstring_consumer(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
wstringsupplier create_wstring_supplier(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
wstringchecker create_wstring_validator(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
boolconsumer create_bool_consumer(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
boolsupplier create_bool_supplier(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
doubleconsumer create_number_consumer(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
doublesupplier create_number_supplier(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
int_array_consumer create_int_array_consumer(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
vec2supplier create_vec2_supplier(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
value_to_string_func create_tostring(
const scriptenv& env,
const std::string& src,
const std::string& file = "<string>"
const std::string& file = "[string]"
);
}

View File

@ -31,7 +31,7 @@ TEST(TOML, EncodeDecode) {
std::cout << text << std::endl;
}
try {
auto object = toml::parse("<string>", text);
auto object = toml::parse("[string]", text);
EXPECT_EQ(object["name"].asString(), name);
EXPECT_EQ(object["year"].asInteger(), year);
EXPECT_FLOAT_EQ(object["score"].asNumber(), score);
@ -86,7 +86,7 @@ inline std::string SRC_EXAMPLE =
TEST(TOML, ExampleCode) {
try {
std::cout << SRC_EXAMPLE << std::endl;
auto object = toml::parse("<string>", SRC_EXAMPLE);
auto object = toml::parse("[string]", SRC_EXAMPLE);
std::cout << object << std::endl;
} catch (const parsing_error& err) {
std::cerr << err.errorLog() << std::endl;