Add helper functions for making shared pointers to rules

- start work on item set class
This commit is contained in:
Max Brunsfeld 2013-11-10 14:24:25 -08:00
parent ec8b7ccf20
commit 11e3980319
33 changed files with 486 additions and 150 deletions

View file

@ -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();
}