mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
started to develop build_visitor
This commit is contained in:
parent
195c536620
commit
d1cd6d4b83
9 changed files with 879 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue