feat: working subtables

This commit is contained in:
3lswear
2022-01-23 13:50:12 +03:00
parent 3b2469b130
commit d9b66c8795
4 changed files with 90 additions and 26 deletions

View File

@@ -88,9 +88,9 @@ namespace config
file.get(c);
}
}
else if (c == '[')
else if (c == '[' && firstToken())
{
std::streampos prev_pos = file.tellg();
/* std::streampos prev_pos = file.tellg(); */
file.get(c);
if (c == '[')
{
@@ -108,10 +108,21 @@ namespace config
}
else
{
token.type = OPEN_BRACKET;
file.seekg(prev_pos);
token.type = MAP_DECL;
token.value += c;
file.get(c);
while (c != ']')
{
token.value += c;
file.get(c);
}
if (c != ']')
throw std::logic_error("malformed MAP_DECL");
}
}
else if (c == '[')
{
token.type = OPEN_BRACKET;
}
else if (c == ']')
token.type = CLOSE_BRACKET;