Make token extraction work for repeat rules
This commit is contained in:
parent
ca33c3942a
commit
19e5b2a563
3 changed files with 32 additions and 0 deletions
|
|
@ -53,6 +53,10 @@ namespace tree_sitter {
|
|||
void visit(const Seq *rule) {
|
||||
value = seq({ apply(rule->left), apply(rule->right) });
|
||||
}
|
||||
|
||||
void visit(const Repeat *rule) {
|
||||
value = repeat(apply(rule->content));
|
||||
}
|
||||
};
|
||||
|
||||
pair<Grammar, Grammar> extract_tokens(const Grammar &input_grammar) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ namespace tree_sitter {
|
|||
void visit(const rules::Seq *seq) {
|
||||
value = apply(seq->left) || apply(seq->right);
|
||||
}
|
||||
|
||||
void visit(const rules::Repeat *rule) {
|
||||
value = apply(rule->content);
|
||||
}
|
||||
};
|
||||
|
||||
bool search_for_symbols(const rules::rule_ptr &rule) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue