summaryrefslogtreecommitdiffhomepage
path: root/grammer.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-02-09 21:53:36 +0100
committerRoland Reichwein <mail@reichwein.it>2020-02-09 21:53:36 +0100
commit42b15c6bfad96151912501a7253521f86e4781cb (patch)
tree7e102f5b8200bccedf3d6d412e222af04d0712f5 /grammer.h
parentff0c8036659ea31f60b6b3523b8e4e044a70ecf4 (diff)
Fix compile error (WIP)
Diffstat (limited to 'grammer.h')
-rw-r--r--grammer.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/grammer.h b/grammer.h
index 0e9ed32..4f0d235 100644
--- a/grammer.h
+++ b/grammer.h
@@ -30,12 +30,12 @@ private:
std::vector<TreeNode> nodes;
// Input
- std::vector<std::string> tokens;
+ std::vector<Token> tokens;
// Helper data
index_t tokens_used{0}; // number of tokens used, this is also the next token index to use
- const BNF &bnf;
+ BNF &bnf; // not const for access via operator[]
const std::string& Top;
std::map<std::string, std::set<std::string>> ReverseBNF; // possible parent types of a given type
@@ -47,26 +47,26 @@ private:
// Node specific
std::string GetTypeOfNode(index_t node_id) const;
bool IsRootNode(index_t node_id) const;
- bool RootIsStartSymbol() const;
+ bool rootIsStartSymbol() const;
bool AllTokensUsed() const;
bool treeIsComplete() const;
- std::vector<std::string>& getNodeExpectedChilds(node_id);
+ std::vector<std::string>& getNodeExpectedChilds(index_t node_id);
bool subTreeIsComplete(index_t node_id, index_t& to_fill);
size_t CommonPrefix(const std::vector<Token>& tokens, const std::vector<std::string>& types);
void AddFirstNode();
bool AddRootNode();
void RemoveLastNode();
void ChangeNodeType();
- index_t TrackBack();
+ void TrackBack();
void Validate() const;
- std::map<std::string, std::string> traverse(lower, upper);
+ std::map<std::string, std::string> traverse(const std::string& lower, const std::string& upper);
std::vector<std::string> GetPath(std::string upper, std::string lower);
- index_t AddNode(const std::string& name, const std::string& child_type, index_t parent_index);
+ index_t AddNode(const std::string& child_type, index_t parent_index);
void AddPath(const std::vector<std::string>& path, index_t current_index);
bool FillTree();
public:
- Compiler(const BNF& bnf, const std::string& Top);
+ Compiler(BNF& bnf, const std::string& Top);
std::pair<index_t, std::vector<TreeNode>> compile(std::vector<Token> Tokens);
void DumpTree();
};