Collapse rules that contain only a single token
This commit is contained in:
parent
04d18b56ed
commit
0985fa3008
7 changed files with 70 additions and 61 deletions
|
|
@ -6,6 +6,10 @@ using std::string;
|
|||
|
||||
namespace tree_sitter {
|
||||
namespace rules {
|
||||
bool Rule::operator!=(const Rule &other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& stream, const Rule &rule) {
|
||||
return stream << rule.to_string();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace tree_sitter {
|
|||
class Rule {
|
||||
public:
|
||||
virtual bool operator==(const Rule& other) const = 0;
|
||||
bool operator!=(const Rule& other) const;
|
||||
virtual size_t hash_code() const = 0;
|
||||
virtual rule_ptr copy() const = 0;
|
||||
virtual std::string to_string() const = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue