Add helper functions for making shared pointers to rules
- start work on item set class
This commit is contained in:
parent
ec8b7ccf20
commit
11e3980319
33 changed files with 486 additions and 150 deletions
|
|
@ -8,10 +8,9 @@ namespace tree_sitter {
|
|||
String::String(std::string value) : value(value) {};
|
||||
|
||||
TransitionMap<Rule> String::transitions() const {
|
||||
rule_ptr result = rule_ptr(new Char(value[0]));
|
||||
for (int i = 1; i < value.length(); i++) {
|
||||
auto result = rule_ptr(new Char(value[0]));
|
||||
for (int i = 1; i < value.length(); i++)
|
||||
result = rule_ptr(new Seq(result, rule_ptr(new Char(value[i]))));
|
||||
}
|
||||
return result->transitions();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue