started to develop build_visitor

This commit is contained in:
ProgramSnail 2023-03-28 12:05:20 +03:00
parent 195c536620
commit d1cd6d4b83
9 changed files with 879 additions and 28 deletions

View file

@ -12,13 +12,13 @@ class ParseTree {
public:
class Node {
public:
Node() = delete;
std::string GetType();
std::pair<size_t, size_t> GetStartPoint();
std::pair<size_t, size_t> GetEndPoint();
std::string GetAsSExpression();
std::string GetValue(); // from source
bool IsNull();
bool IsNamed();
bool IsMissing();
@ -31,14 +31,14 @@ public:
Node NthNamedChild(size_t n);
size_t NamedChildCount();
Node ChildByName(const std::string& name);
Node ChildByFieldName(const std::string& name);
// ?? use field id instaed of name ??
// ?? node equality check needed ??
private:
TSNode node_;
};
class Cursor {
class Cursor { // ?? needed ??
public:
Cursor(const Node& node);
@ -56,9 +56,10 @@ public:
ParseTree(const std::string& input);
Node GetRoot();
Node GetRoot() const;
private:
TSTree* tree_;
std::string source; // for token value extraction
};
} // namespace parser