This callback-based API allows the parser to easily visit each interior node of the stack when searching for an error repair. It also is a better abstraction over the stack's DAG implementation than having the public functions for accessing entries and their successor entries.
18 lines
658 B
C++
18 lines
658 B
C++
#ifndef HELPERS_TREE_HELPERS_H_
|
|
#define HELPERS_TREE_HELPERS_H_
|
|
|
|
#include "runtime/tree.h"
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
extern const char *symbol_names[24];
|
|
TSTree ** tree_array(std::vector<TSTree *> trees);
|
|
|
|
std::ostream &operator<<(std::ostream &stream, const TSTree *tree);
|
|
std::ostream &operator<<(std::ostream &stream, const TSNode &node);
|
|
std::ostream &operator<<(std::ostream &stream, const TSLength &length);
|
|
bool operator==(const TSNode &left, const TSNode &right);
|
|
bool operator==(const TSLength &left, const TSLength &right);
|
|
bool operator==(const std::vector<TSTree *> &right, const TreeArray &array);
|
|
|
|
#endif // HELPERS_TREE_HELPERS_H_
|