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:
parent
15c9e2d398
commit
3cb65c9c81
6 changed files with 659 additions and 670 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue