Consolidate logic for making shared pointers to rules

This commit is contained in:
Max Brunsfeld 2013-12-19 23:05:54 -08:00
parent 9f78d72a7c
commit 6f444fcc79
22 changed files with 113 additions and 94 deletions

View file

@ -1,18 +1,18 @@
#include "rule.h"
#include <set>
using std::ostream;
using std::string;
namespace tree_sitter {
namespace rules {
std::ostream& operator<<(std::ostream& stream, const Rule &rule)
{
stream << rule.to_string();
return stream;
ostream& operator<<(ostream& stream, const Rule &rule) {
return stream << rule.to_string();
}
std::ostream& operator<<(std::ostream& stream, const rule_ptr &rule)
{
ostream& operator<<(ostream& stream, const rule_ptr &rule) {
if (rule.get() == nullptr)
stream << std::string("<NULL rule>");
stream << string("<NULL rule>");
else
stream << rule->to_string();
return stream;