summaryrefslogtreecommitdiffhomepage
path: root/grammer.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-02-15 16:12:15 +0100
committerRoland Reichwein <mail@reichwein.it>2020-02-15 16:12:15 +0100
commit477d82f44f5303b55b456f58f53e878289710743 (patch)
treeb2df26884095acf21e1f00e308b8c5f97df5563a /grammer.cpp
parent0950c449066770292beae220ba4289ce124b4680 (diff)
First compile of statement list
Diffstat (limited to 'grammer.cpp')
-rw-r--r--grammer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/grammer.cpp b/grammer.cpp
index 55e31c8..22b874e 100644
--- a/grammer.cpp
+++ b/grammer.cpp
@@ -426,6 +426,9 @@ bool Compiler::FillTree()
index_t to_fill{};
while (!subTreeIsComplete(root_node_id, to_fill)) {
+ if (tokens_used >= tokens.size())
+ return false; // Unexpected end of program?
+
auto& node {nodes[to_fill]};
std::string next_child {bnf[node.type][node.variant][node.child_ids.size()]};
if (next_child == tokens[tokens_used].type) { // add token directly