diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-11-28 11:41:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-11-28 11:41:15 +0200 |
commit | 36e3bc290d58ad29692a4d594f37a6cb761912c7 (patch) | |
tree | 3ebbc1edf910e5168fb819404ecedbf23c95b9d0 /cli/runtime-header.cxx | |
parent | a376ccf37122f0768fce8e3c5a16561e01ee2351 (diff) | |
download | cli-36e3bc290d58ad29692a4d594f37a6cb761912c7.tar.gz cli-36e3bc290d58ad29692a4d594f37a6cb761912c7.tar.xz cli-36e3bc290d58ad29692a4d594f37a6cb761912c7.zip |
Use a scanner interface instead of argc/argv
This will allow supporting other sources of options, for example, an
option file.
Diffstat (limited to 'cli/runtime-header.cxx')
-rw-r--r-- | cli/runtime-header.cxx | 60 |
1 files changed, 60 insertions, 0 deletions
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 } |