fixed big thing with call splitting, added comments, msvc
This commit is contained in:
parent
9969b522f9
commit
e9f2957c17
4 changed files with 22 additions and 15 deletions
|
@ -4,7 +4,7 @@
|
||||||
"name": "x64-Debug",
|
"name": "x64-Debug",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"configurationType": "Debug",
|
"configurationType": "Debug",
|
||||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
"cmakeCommandArgs": "",
|
"cmakeCommandArgs": "",
|
||||||
|
|
|
@ -10,7 +10,6 @@ namespace {
|
||||||
|
|
||||||
{'\'', '\''}, // SQUOTE
|
{'\'', '\''}, // SQUOTE
|
||||||
{'\"', '\"'} // DQUOTE
|
{'\"', '\"'} // DQUOTE
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool need_escape(char c)
|
bool need_escape(char c)
|
||||||
|
@ -114,9 +113,16 @@ namespace NVL
|
||||||
nvl >> std::ws;
|
nvl >> std::ws;
|
||||||
|
|
||||||
std::streampos end; // unused if object is not scoped
|
std::streampos end; // unused if object is not scoped
|
||||||
|
bool is_comment = false;
|
||||||
|
|
||||||
std::variant<std::string, std::vector<Object>> content = "";
|
std::variant<std::string, std::vector<Object>> content = "";
|
||||||
char c{};
|
char c{};
|
||||||
|
if (nvl.peek() == ';' && is_parent_call)
|
||||||
|
{
|
||||||
|
while (nvl.peek() != '\n')
|
||||||
|
nvl.get(c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (nvl.peek())
|
switch (nvl.peek())
|
||||||
{
|
{
|
||||||
case '[': // List
|
case '[': // List
|
||||||
|
@ -147,12 +153,16 @@ namespace NVL
|
||||||
this_object.Value = std::get<std::string>(content);
|
this_object.Value = std::get<std::string>(content);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
for (nvl.get(c); !(c == ' ' || c == '\n' || c == '}' || c == ']' || c == ','); nvl.get(c))
|
for (nvl.get(c); !(c == ' ' || c == '\n' || c == '}' || c == ']' || c == ','); nvl.get(c))
|
||||||
{
|
{
|
||||||
content = std::get<std::string>(content) + c;
|
content = std::get<std::string>(content) + c;
|
||||||
}
|
}
|
||||||
if (c == ']' || c == '}')
|
if (c == ']' || c == '}' || c == '\n')
|
||||||
|
{
|
||||||
nvl.putback(c);
|
nvl.putback(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -178,8 +188,6 @@ namespace NVL
|
||||||
|
|
||||||
this_object.Is_Symbol = is_symbol;
|
this_object.Is_Symbol = is_symbol;
|
||||||
|
|
||||||
nvl >> std::ws;
|
|
||||||
|
|
||||||
if (is_parent_call)
|
if (is_parent_call)
|
||||||
(std::get<std::reference_wrapper<Call>>(parent_context.Scope_Hierarchy.back())).get().Objects.push_back(this_object);
|
(std::get<std::reference_wrapper<Call>>(parent_context.Scope_Hierarchy.back())).get().Objects.push_back(this_object);
|
||||||
else if ((std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value.index() == 4) // 4 for list
|
else if ((std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value.index() == 4) // 4 for list
|
||||||
|
@ -202,7 +210,7 @@ namespace NVL
|
||||||
|
|
||||||
parse_Object<true, true>(this_context, nvl);
|
parse_Object<true, true>(this_context, nvl);
|
||||||
|
|
||||||
while (nvl.peek() != '\n' && nvl.peek() != '}')
|
while (!(nvl.peek() == '\n' || nvl.peek() == '}'))
|
||||||
{
|
{
|
||||||
parse_Object<true, false>(this_context, nvl);
|
parse_Object<true, false>(this_context, nvl);
|
||||||
}
|
}
|
||||||
|
@ -230,6 +238,7 @@ namespace NVL
|
||||||
while (nvl.tellg() < end_pos - static_cast<std::streampos>(1))
|
while (nvl.tellg() < end_pos - static_cast<std::streampos>(1))
|
||||||
{
|
{
|
||||||
parse_Call(this_context, nvl);
|
parse_Call(this_context, nvl);
|
||||||
|
nvl >> std::ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvl.get(c); // get }
|
nvl.get(c); // get }
|
||||||
|
@ -298,9 +307,6 @@ namespace NVL
|
||||||
x.Print(indent + 1);
|
x.Print(indent + 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
std::cout << "Nil" << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Call::Print(int indent)
|
void Call::Print(int indent)
|
||||||
|
|
|
@ -17,12 +17,11 @@ namespace NVL
|
||||||
struct Object
|
struct Object
|
||||||
{
|
{
|
||||||
std::variant<
|
std::variant<
|
||||||
std::monostate,
|
Nil,
|
||||||
float,
|
float,
|
||||||
std::string,
|
std::string,
|
||||||
bool,
|
bool,
|
||||||
std::vector<Object>, // Implies Object can be an array of other Object
|
std::vector<Object> // Implies Object can be an array of other Object
|
||||||
Nil
|
|
||||||
> Value;
|
> Value;
|
||||||
|
|
||||||
bool Is_Symbol = false;
|
bool Is_Symbol = false;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
mmawesome {
|
mmawesome {
|
||||||
lmao [gkedddadadだsdadge hee hee [2323.4 535 3434]]
|
lmao [gkeddd的dadge hee hee [2323.4]] ;asdad
|
||||||
|
asd gfdg ;dasd
|
||||||
|
xdd [xdd "xddd with space" ;df;;sp 5.5 dasdas [][[[[][][]][][]][][]] :D]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue