Add token helper for building token rules
Now you can specify the structure of tokens using all of the rule functions, not just `str` and `pattern`
This commit is contained in:
parent
d685edf015
commit
6d40dcf881
8 changed files with 59 additions and 12 deletions
|
|
@ -8,8 +8,7 @@ namespace tree_sitter {
|
|||
rules::MetadataKey metadata_key;
|
||||
|
||||
int apply_to(const rules::Metadata *rule) {
|
||||
auto pair = rule->value.find(metadata_key);
|
||||
return (pair != rule->value.end()) ? pair->second : 0;
|
||||
return rule->value_for(metadata_key);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue