Clean up helper functions in example grammars
This commit is contained in:
parent
8e1b78ca8e
commit
2cd595d81a
3 changed files with 4 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ namespace tree_sitter_examples {
|
|||
return seq({ element, repeat(seq({ str(","), element })) });
|
||||
}
|
||||
|
||||
static rule_ptr comma_sep(const rule_ptr &element) {
|
||||
static rule_ptr comma_sep(rule_ptr element) {
|
||||
return choice({ comma_sep1(element), blank() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ namespace tree_sitter_examples {
|
|||
using tree_sitter::Grammar;
|
||||
using namespace tree_sitter::rules;
|
||||
|
||||
static rule_ptr optional(const rule_ptr &rule) {
|
||||
static rule_ptr optional(rule_ptr rule) {
|
||||
return choice({ rule, blank() });
|
||||
}
|
||||
|
||||
static rule_ptr comma_sep(const rule_ptr &element) {
|
||||
static rule_ptr comma_sep(rule_ptr element) {
|
||||
return choice({
|
||||
seq({ element, repeat(seq({ str(","), element })) }),
|
||||
blank(),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace tree_sitter_examples {
|
|||
using tree_sitter::Grammar;
|
||||
using namespace tree_sitter::rules;
|
||||
|
||||
static rule_ptr comma_sep(const rule_ptr &rule) {
|
||||
static rule_ptr comma_sep(rule_ptr rule) {
|
||||
return choice({
|
||||
seq({ rule, repeat(seq({ str(","), rule })) }),
|
||||
blank(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue