Increment i after finding the end iterator when parsing variables

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-03-22 13:14:32 +01:00
parent 01abadc1fa
commit adbe98ec00
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 5 additions and 6 deletions

View File

@ -77,12 +77,11 @@ namespace Parser {
}
const unsigned increment = 2 + isFinalDefine;
const auto beginning = lexed.begin() + i + increment;
parseTree << Define(isFinalDefine, current.toktext, parse( // TODO Find another way of choosing the tokens to parse
beginning, find_if(beginning, lexed.end(), [&current](const tok& it){
return it.line != current.line;
})
));
i += increment;
const auto end = find_if(beginning, lexed.end(), [&current](const tok& it){ // TODO Find another way of choosing the tokens to parse
return it.line != current.line;
});
parseTree << Define(isFinalDefine, current.toktext, parse(beginning, end));
i += 1 + isFinalDefine + distance(beginning, end);
} else if (next.toktype == LPAR) {
parseTree << Call(current.toktext);
} else