+#ifdef FILEDEBUG
+extern void debugToken(std::ostream & os, Token const & t, unsigned int flags);
+#endif
+
+/// A docstream version that supports putback even when not buffered
+class iparserdocstream
+{
+public:
+ typedef idocstream::int_type int_type;
+
+ iparserdocstream(idocstream & is) : is_(is) {}
+
+ /// Like std::istream::operator bool()
+ /// Do not convert is_ implicitly to bool, since that is forbidden in C++11.
+ explicit operator bool() const { return s_.empty() ? !is_.fail() : true; }
+
+ /// change the encoding of the input stream to \p e (iconv name)
+ void setEncoding(std::string const & e);
+
+ // add to the list of characters to read before actually reading
+ // the stream
+ void putback(char_type c);
+
+ // add to the list of characters to read before actually reading
+ // the stream
+ void putback(docstring s);
+
+ /// Like std::istream::get()
+ iparserdocstream & get(char_type &c);
+
+ /// Like std::istream::good()
+ bool good() const { return s_.empty() ? is_.good() : true; }
+
+ /// Like std::istream::peek()
+ int_type peek() const { return s_.empty() ? is_.peek() : s_[0]; }
+private:
+ ///
+ idocstream & is_;
+ /// characters to read before actually reading the stream
+ docstring s_;
+};
+