From 42b15c6bfad96151912501a7253521f86e4781cb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 9 Feb 2020 21:53:36 +0100 Subject: Fix compile error (WIP) --- grammer.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'grammer.h') 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 nodes; // Input - std::vector tokens; + std::vector 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> 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& getNodeExpectedChilds(node_id); + std::vector& getNodeExpectedChilds(index_t node_id); bool subTreeIsComplete(index_t node_id, index_t& to_fill); size_t CommonPrefix(const std::vector& tokens, const std::vector& types); void AddFirstNode(); bool AddRootNode(); void RemoveLastNode(); void ChangeNodeType(); - index_t TrackBack(); + void TrackBack(); void Validate() const; - std::map traverse(lower, upper); + std::map traverse(const std::string& lower, const std::string& upper); std::vector 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& 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> compile(std::vector Tokens); void DumpTree(); }; -- cgit v1.2.3