summaryrefslogtreecommitdiffhomepage
path: root/grammer.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-01-30 08:47:51 +0100
committerRoland Reichwein <mail@reichwein.it>2020-01-30 08:47:51 +0100
commitd99d80e862c2799d0dc9a567b710c7b05d6a47a4 (patch)
tree6a6f0f66751c6080389904937757ce4ea0daa606 /grammer.h
parent1f3f7c2693686d847bf1a9bb3e47a023fe9d7992 (diff)
Fix alternatives handling
Diffstat (limited to 'grammer.h')
-rw-r--r--grammer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/grammer.h b/grammer.h
index 18719cd..996d023 100644
--- a/grammer.h
+++ b/grammer.h
@@ -4,6 +4,7 @@
#include "minicc.h"
#include <cstdint>
+#include <utility>
namespace Gram {
@@ -16,7 +17,7 @@ struct TreeNode {
std::string type;
index_t variant; // bnf[type][variant]
- std::deque<std::string> alternative_types; // alternatives that we can consider if type fails. Discard after parsing!
+ std::deque<std::pair<std::string, index_t>> alternatives; // [type][value] alternatives that we can consider on fail. Discard after parsing!
std::vector<int32_t> child_ids; // < 0: terminal: token_id; >= 0: non-terminal: node_id; fill token by token
};