fix: reset last token when needed

This commit is contained in:
3lswear
2022-01-22 18:11:29 +03:00
parent 24e49f63e8
commit 3b2469b130
3 changed files with 8 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ namespace config
bool hasMoreTokens();
bool firstToken();
void rollBackToken();
void set_last(e_token type);
};

View File

@@ -48,6 +48,7 @@ namespace config
if (nextToken.type == MAPARRAY_DECL)
{
tokenizer.rollBackToken();
tokenizer.set_last(NEWLINE);
break;
}
else if (nextToken.type == OPEN_BRACKET)
@@ -289,6 +290,7 @@ namespace config
if (current.type == MAPARRAY_DECL)
{
/* parseMapArray(); */
tokenizer.set_last(NEWLINE);
tokenizer.rollBackToken();
parseMapArray();
}

View File

@@ -204,4 +204,9 @@ namespace config
file.clear();
file.seekg(prev_pos);
}
void Tokenizer::set_last(e_token type)
{
last_token = type;
}
}