Organize source into compiler and runtime dirs

This commit is contained in:
Max Brunsfeld 2013-12-15 23:57:30 -08:00
parent e480cf538d
commit 9618efd12a
46 changed files with 169 additions and 38 deletions

View file

@ -0,0 +1,26 @@
#include "symbol.h"
#include "blank.h"
#include "transition_map.h"
namespace tree_sitter {
namespace rules {
Symbol::Symbol(const std::string &name) : name(name) {};
sym_ptr sym(const std::string &name) {
return std::make_shared<Symbol>(name);
}
TransitionMap<Rule> Symbol::transitions() const {
return TransitionMap<Rule>({{ sym(name) , blank() }});
}
bool Symbol::operator==(const Rule &rule) const {
const Symbol *other = dynamic_cast<const Symbol *>(&rule);
return other && (other->name == name);
}
std::string Symbol::to_string() const {
return std::string("(sym '") + name + "')";
}
}
}