Substract 1 to the lexed vector's size in Parser.hpp to avoid getting out of bounds because of the next reference.

This commit is contained in:
Username404-59 2021-07-06 20:49:28 +02:00
parent 07ca24c610
commit b82faeb399
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1

View File

@ -7,7 +7,7 @@ namespace Parser {
ParseTree parseVector(const vector<tok>& lexed) { ParseTree parseVector(const vector<tok>& lexed) {
ParseTree parseTree; ParseTree parseTree;
using namespace StandardComponents::types; using namespace StandardComponents::types;
for (unsigned int i = 0; i < lexed.size(); ++i) { for (unsigned int i = 0; i < lexed.size() - 1; ++i) {
const auto& current = lexed[i]; const auto& current = lexed[i];
const auto& next = lexed[i + 1]; const auto& next = lexed[i + 1];