Add keyword helper for making higher-priority string tokens
This commit is contained in:
parent
60e2728acc
commit
93620b3ed1
13 changed files with 54 additions and 27 deletions
|
|
@ -55,6 +55,10 @@ namespace tree_sitter {
|
|||
return make_shared<String>(value);
|
||||
}
|
||||
|
||||
rule_ptr keyword(const string &value) {
|
||||
return metadata(make_shared<String>(value), { { PRECEDENCE, 100}, { IS_TOKEN, 1 } });
|
||||
}
|
||||
|
||||
rule_ptr err(const rule_ptr &rule) {
|
||||
return choice({ rule, ERROR().copy() });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue