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 hasMoreTokens();
bool firstToken(); bool firstToken();
void rollBackToken(); void rollBackToken();
void set_last(e_token type);
}; };

View File

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

View File

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