diff --git a/CMakeSettings.json b/CMakeSettings.json index 944b567..9204f06 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -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": "", diff --git a/NouVeL/NVL.cpp b/NouVeL/NVL.cpp index ab52be6..213a7f6 100644 --- a/NouVeL/NVL.cpp +++ b/NouVeL/NVL.cpp @@ -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> content = ""; - char c{}; + 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(content); break; default: + for (nvl.get(c); !(c == ' ' || c == '\n' || c == '}' || c == ']' || c == ','); nvl.get(c)) { - content = std::get(content) + c; + content = std::get(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>(parent_context.Scope_Hierarchy.back())).get().Objects.push_back(this_object); else if ((std::get>(parent_context.Scope_Hierarchy.back())).get().Value.index() == 4) // 4 for list @@ -202,7 +210,7 @@ namespace NVL parse_Object(this_context, nvl); - while (nvl.peek() != '\n' && nvl.peek() != '}') + while (!(nvl.peek() == '\n' || nvl.peek() == '}')) { parse_Object(this_context, nvl); } @@ -230,6 +238,7 @@ namespace NVL while (nvl.tellg() < end_pos - static_cast(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) diff --git a/NouVeL/NVL.h b/NouVeL/NVL.h index e84398a..3c5d390 100644 --- a/NouVeL/NVL.h +++ b/NouVeL/NVL.h @@ -17,12 +17,11 @@ namespace NVL struct Object { std::variant< - std::monostate, + Nil, float, std::string, bool, - std::vector, // Implies Object can be an array of other Object - Nil + std::vector // Implies Object can be an array of other Object > Value; bool Is_Symbol = false; diff --git a/test_j.nvl b/test_j.nvl index fd369ae..2fce003 100644 --- a/test_j.nvl +++ b/test_j.nvl @@ -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] }