From 36e3bc290d58ad29692a4d594f37a6cb761912c7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 28 Nov 2009 11:41:15 +0200 Subject: Use a scanner interface instead of argc/argv This will allow supporting other sources of options, for example, an option file. --- cli/runtime-header.cxx | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'cli/runtime-header.cxx') diff --git a/cli/runtime-header.cxx b/cli/runtime-header.cxx index 055754c..cf3ebd3 100644 --- a/cli/runtime-header.cxx +++ b/cli/runtime-header.cxx @@ -145,5 +145,65 @@ generate_runtime_header (context& ctx) << "std::string value_;" << "};"; + os << "class eos_reached: public exception" + << "{" + << "public:" << endl + << "virtual void" << endl + << "print (std::ostream&) const;" + << endl + << "virtual const char*" << endl + << "what () const throw ();" + << "};"; + + // scanner + // + os << "class scanner" + << "{" + << "public:" << endl + << "virtual" << endl + << "~scanner ();" + << endl + << "virtual bool" << endl + << "more () = 0;" + << endl + << "virtual const char*" << endl + << "peek () = 0;" + << endl + << "virtual const char*" << endl + << "next () = 0;" + << endl + << "virtual void" << endl + << "skip () = 0;" + << "};"; + + // argv_scanner + // + os << "class argv_scanner: public scanner" + << "{" + << "public:" << endl + << "argv_scanner (int argc, char** argv);" + << "argv_scanner (int start, int argc, char** argv);" + << endl + << "int" << endl + << "end () const;" + << endl + << "virtual bool" << endl + << "more ();" + << endl + << "virtual const char*" << endl + << "peek ();" + << endl + << "virtual const char*" << endl + << "next ();" + << endl + << "virtual void" << endl + << "skip ();" + << endl + << "private:" + << "int i_;" + << "int argc_;" + << "char** argv_;" + << "};"; + os << "}"; // namespace cli } -- cgit v1.1