Fix the parsing of ParseTree to ignore previous parsed instances

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-04-20 15:23:00 +02:00
parent 014ea9060b
commit 7df47da354
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 1 deletions

View File

@ -119,7 +119,9 @@ namespace Parser {
if (not parseTree.empty()) {
try {
auto& previous = dynamic_cast<ParseTree&>(*parseTree.at(parseTree.size() - 1));
if (current.toktype != LPAR or previous.getId() == typeid(Call)) {
if (find_if(reverse_iterator(lexed.begin() + i), lexed.rend(), [&closingCharacter](const tok& token){
return token.toktype != SEMICOLON;
})->toktype != *closingCharacter) {
previous = parse(subTokens);
i = distance(lexed.begin(), closingCharacter);
break;