fixed da comma
This commit is contained in:
parent
73b9f4c81d
commit
bb58da84ce
2 changed files with 24 additions and 22 deletions
|
@ -36,20 +36,29 @@ namespace {
|
||||||
stream.get(c);
|
stream.get(c);
|
||||||
|
|
||||||
bool no_more_nesting_quotes = false;
|
bool no_more_nesting_quotes = false;
|
||||||
for (auto const& x : current_scope.Scope)
|
for (auto& x : current_scope.Scope)
|
||||||
|
{
|
||||||
if (x == '\'' || x == '\"')
|
if (x == '\'' || x == '\"')
|
||||||
|
{
|
||||||
no_more_nesting_quotes = true;
|
no_more_nesting_quotes = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool set_scope_on_this_iter = false;
|
||||||
if (!no_more_nesting_quotes) {
|
if (!no_more_nesting_quotes) {
|
||||||
for (auto const& x : SCOPER_MAP)
|
for (auto const& x : SCOPER_MAP)
|
||||||
{
|
{
|
||||||
if (c == x.first) {
|
if (c == x.first) {
|
||||||
current_scope.Scope.push_back(c);
|
current_scope.Scope.push_back(c);
|
||||||
|
set_scope_on_this_iter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!set_scope_on_this_iter && c == SCOPER_MAP.at(current_scope.Scope.back()))
|
||||||
|
current_scope.Scope.pop_back();
|
||||||
|
|
||||||
if (c == '\\') // encounters an escaped sequence
|
if (c == '\\') // encounters an escaped sequence
|
||||||
{
|
{
|
||||||
char cc = stream.peek();
|
char cc = stream.peek();
|
||||||
|
@ -59,14 +68,12 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == SCOPER_MAP.at(current_scope.Scope.back()))
|
|
||||||
current_scope.Scope.pop_back();
|
|
||||||
|
|
||||||
if (stream.eof())
|
if (stream.eof())
|
||||||
{
|
{
|
||||||
std::cerr << "Can't cope with scope!" << std::endl;
|
std::cerr << "Can't cope with scope!" << std::endl;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final = stream.tellg();
|
final = stream.tellg();
|
||||||
|
@ -114,7 +121,7 @@ namespace NVL
|
||||||
char c{};
|
char c{};
|
||||||
switch (nvl.peek())
|
switch (nvl.peek())
|
||||||
{
|
{
|
||||||
case '[': // List, fucked
|
case '[': // List
|
||||||
nvl.get(c); // do not exchange this line with the next one
|
nvl.get(c); // do not exchange this line with the next one
|
||||||
end = scope_cope('[', nvl);
|
end = scope_cope('[', nvl);
|
||||||
while (nvl.tellg() < end - static_cast<std::streampos>(1))
|
while (nvl.tellg() < end - static_cast<std::streampos>(1))
|
||||||
|
@ -133,6 +140,8 @@ namespace NVL
|
||||||
while (nvl.tellg() < end - static_cast<std::streampos>(1))
|
while (nvl.tellg() < end - static_cast<std::streampos>(1))
|
||||||
{
|
{
|
||||||
nvl.get(c);
|
nvl.get(c);
|
||||||
|
if (c == '\\' && (nvl.peek() == '\'' || nvl.peek() == '\"'))
|
||||||
|
continue;
|
||||||
content = std::get<std::string>(content) + c;
|
content = std::get<std::string>(content) + c;
|
||||||
}
|
}
|
||||||
nvl.get(c); // rid of final scoper
|
nvl.get(c); // rid of final scoper
|
||||||
|
@ -144,7 +153,7 @@ namespace NVL
|
||||||
{
|
{
|
||||||
content = std::get<std::string>(content) + c;
|
content = std::get<std::string>(content) + c;
|
||||||
}
|
}
|
||||||
if (c == ']' || c == ',' || c == '}')
|
if (c == ']' || c == '}')
|
||||||
nvl.putback(c);
|
nvl.putback(c);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -175,12 +184,12 @@ namespace NVL
|
||||||
|
|
||||||
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
|
||||||
;
|
{
|
||||||
std::get<std::vector<Object>>((std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value).push_back(this_object);
|
std::get<std::vector<Object>>((std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value).push_back(this_object);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
;
|
{
|
||||||
(std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value = std::vector<Object> { this_object };
|
(std::get<std::reference_wrapper<Object>>(parent_context.Scope_Hierarchy.back())).get().Value = std::vector<Object> { this_object };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
test.nvl
11
test.nvl
|
@ -1,10 +1,3 @@
|
||||||
mmawesome
|
mmawesome {
|
||||||
{
|
lmao [gkepokge hee hee [2323.4 535 3434]]
|
||||||
mmawesome mmaji awesome asduhjaiodhj kl;d 3434.3434 true false
|
|
||||||
}
|
|
||||||
|
|
||||||
dasijhdoisaj {}
|
|
||||||
|
|
||||||
uihf98 {
|
|
||||||
dasdj [39439048 jidjao] [] [] [] [[][[][[[[[] hi [2323 d]]]]]]]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue