#define __SFJP_ROAST__lexical__util_HPP__
//#include <string> // str_generate()
+ #include "roast/lexical/iterator_util.hpp"
#include "roast/stream/string_stream.hpp"
+#include "roast/stream/console_stream.hpp"
+//#include <iostream>
namespace roast
{
return to_string(r, null_document);
}
+ template <typename _Rule>
+ ::std::string to_string2(_Rule& r)
+ {
+
+ ::std::string s;
+ ::roast::string_output_stream ss(s);
+ //generate(ss,r);
+
+ //if ( r.generate(ss,doc) == false )
+ r.generate(ss,r);
+ return s;
+ }
+
//////////////////////////////////////////////////////////////////////////////////
+
+ template <typename _Rule, typename _Document>
+ void print(_Rule& r, _Document& doc){
+ //r.generate(::std::cout, doc);
+ r.generate(::roast::stream::cout, doc);
+ }
+
+ template <typename _Rule>
+ void print(_Rule& r){
+ //r.generate(::std::cout, doc);
+ r.generate(::roast::stream::cout, null_document);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
}
+
+ template <typename _Rule>
+ ::std::string lex_to_string(_Rule& r)
+ {
+ return lexical::to_string2(r);
+ }
}
#include "roast/lexical/iterator_util.hpp"