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",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace {
|
|||
|
||||
{'\'', '\''}, // SQUOTE
|
||||
{'\"', '\"'} // DQUOTE
|
||||
|
||||
};
|
||||
|
||||
bool need_escape(char c)
|
||||
|
@ -114,9 +113,16 @@ namespace NVL
|
|||
nvl >> std::ws;
|
||||
|
||||
std::streampos end; // unused if object is not scoped
|
||||
bool is_comment = false;
|
||||
|
||||
std::variant<std::string, std::vector<Object>> content = "";
|
||||
char c{};
|
||||
if (nvl.peek() == ';' && is_parent_call)
|
||||
{
|
||||
while (nvl.peek() != '\n')
|
||||
nvl.get(c);
|
||||
return;
|
||||
}
|
||||
switch (nvl.peek())
|
||||
{
|
||||
case '[': // List
|
||||
|
@ -147,12 +153,16 @@ namespace NVL
|
|||
this_object.Value = std::get<std::string>(content);
|
||||
break;
|
||||
default:
|
||||
|
||||
for (nvl.get(c); !(c == ' ' || c == '\n' || c == '}' || c == ']' || c == ','); nvl.get(c))
|
||||
{
|
||||
content = std::get<std::string>(content) + c;
|
||||
}
|
||||
if (c == ']' || c == '}')
|
||||
if (c == ']' || c == '}' || c == '\n')
|
||||
{
|
||||
nvl.putback(c);
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -178,8 +188,6 @@ namespace NVL
|
|||
|
||||
this_object.Is_Symbol = is_symbol;
|
||||
|
||||
nvl >> std::ws;
|
||||
|
||||
if (is_parent_call)
|
||||
(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
|
||||
|
@ -202,7 +210,7 @@ namespace 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);
|
||||
}
|
||||
|
@ -230,6 +238,7 @@ namespace NVL
|
|||
while (nvl.tellg() < end_pos - static_cast<std::streampos>(1))
|
||||
{
|
||||
parse_Call(this_context, nvl);
|
||||
nvl >> std::ws;
|
||||
}
|
||||
|
||||
nvl.get(c); // get }
|
||||
|
@ -298,9 +307,6 @@ namespace NVL
|
|||
x.Print(indent + 1);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
std::cout << "Nil" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Call::Print(int indent)
|
||||
|
|
|
@ -17,12 +17,11 @@ namespace NVL
|
|||
struct Object
|
||||
{
|
||||
std::variant<
|
||||
std::monostate,
|
||||
Nil,
|
||||
float,
|
||||
std::string,
|
||||
bool,
|
||||
std::vector<Object>, // Implies Object can be an array of other Object
|
||||
Nil
|
||||
std::vector<Object> // Implies Object can be an array of other Object
|
||||
> Value;
|
||||
|
||||
bool Is_Symbol = false;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
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