Remove public hidden symbol function
Now, you can't a particular occurrence of a symbol in a grammar. You can only hide a symbol globally (right now, by beginning its name with an underscore).
This commit is contained in:
parent
3f0203d928
commit
2df56f01c8
8 changed files with 1288 additions and 1387 deletions
|
|
@ -37,10 +37,6 @@ namespace tree_sitter {
|
|||
return make_shared<Symbol>(name);
|
||||
}
|
||||
|
||||
rule_ptr _sym(const string &name) {
|
||||
return make_shared<Symbol>(name, SymbolTypeHidden);
|
||||
}
|
||||
|
||||
rule_ptr pattern(const string &value) {
|
||||
return make_shared<Pattern>(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ namespace tree_sitter {
|
|||
switch (type) {
|
||||
case SymbolTypeNormal:
|
||||
return string("#<sym '") + name + "'>";
|
||||
case SymbolTypeHidden:
|
||||
return string("#<hidden_sym '") + name + "'>";
|
||||
case SymbolTypeAuxiliary:
|
||||
return string("#<aux_sym '") + name + "'>";
|
||||
case SymbolTypeBuiltIn:
|
||||
|
|
@ -56,7 +54,7 @@ namespace tree_sitter {
|
|||
}
|
||||
|
||||
bool Symbol::is_hidden() const {
|
||||
return (type == SymbolTypeHidden || type == SymbolTypeAuxiliary);
|
||||
return (name.front() == '_' || type == SymbolTypeAuxiliary);
|
||||
}
|
||||
|
||||
void Symbol::accept(Visitor *visitor) const {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ namespace tree_sitter {
|
|||
namespace rules {
|
||||
typedef enum {
|
||||
SymbolTypeNormal,
|
||||
SymbolTypeHidden,
|
||||
SymbolTypeAuxiliary,
|
||||
SymbolTypeBuiltIn
|
||||
} SymbolType;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue