diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-03-26 14:50:20 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-03-26 14:50:20 +0100 |
commit | 94b1f232ea51767fc30c9ed6b3e5912d776bda30 (patch) | |
tree | bd8076524c65337856d439c21687ce07e06f2eb5 /grammer.h | |
parent | 0e1d2ab5ca0f0fde5d2dd83b95230a8d93b58e7b (diff) |
Remove old bottom-up algorithm
Diffstat (limited to 'grammer.h')
-rw-r--r-- | grammer.h | 19 |
1 files changed, 0 insertions, 19 deletions
@@ -20,7 +20,6 @@ struct TreeNode { std::string type; index_t variant; // bnf[type][variant] - 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 }; @@ -34,9 +33,6 @@ private: // Input std::vector<Token> tokens; - // Helper data - index_t tokens_used{0}; // number of tokens used, this is also the next token index to use - BNF &bnf; // not const for access via operator[] const std::string m_top; @@ -50,24 +46,9 @@ private: std::string GetTypeOfNode(index_t node_id) const; bool IsRootNode(index_t node_id) const; bool rootIsStartSymbol() const; - bool AllTokensUsed() const; bool treeIsComplete() const; - 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 removeTokensUpTo(index_t token_id); - void removeTokensUpTo(index_t token_id, index_t node_id); - void RemoveLastNode(); - void ChangeNodeType(); - void TrackBack(); void Validate() const; - std::unordered_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& child_type, index_t parent_index); - void AddPath(const std::vector<std::string>& path, index_t current_index); - bool FillTree(); // top-down algorithm std::unordered_map<std::string, size_t> m_min; // cache |