Make the EOF be an auxiliary symbol

This way, it couldn’t conflict if a user had a rule called “__END__”
This commit is contained in:
Max Brunsfeld 2014-02-10 18:53:01 -08:00
parent 15c9e2d398
commit 3cb65c9c81
6 changed files with 659 additions and 670 deletions

View file

@ -10,17 +10,6 @@
using std::cout;
namespace std {
template<typename T>
inline std::ostream& operator<<(std::ostream &stream, const std::unordered_set<T> &set) {
stream << std::string("#<set: ");
bool started = false;
for (auto item : set) {
if (started) stream << std::string(", ");
stream << item;
started = true;
}
return stream << ">";
}
template<typename T>
inline std::ostream& operator<<(std::ostream &stream, const std::vector<T> &vector) {
@ -59,6 +48,20 @@ namespace std {
}
return stream << ">";
}
template<typename TKey, typename TValue>
inline std::ostream& operator<<(std::ostream &stream, const std::map<TKey, TValue> &map) {
stream << std::string("#<map: ");
bool started = false;
for (auto pair : map) {
if (started) stream << std::string(", ");
stream << pair.first;
stream << std::string(" => ");
stream << pair.second;
started = true;
}
return stream << ">";
}
}
#endif