diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-03-24 13:27:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-03-24 13:27:35 +0200 |
commit | fc98bf23c16baf836d2c841792d4e0b35dd82727 (patch) | |
tree | 100aae5a488eddec339e5be579a83bd794134e54 /cli/header.cxx | |
parent | 74fff9901d9529cdde4ed42254aa21afe466ac3a (diff) | |
download | cli-fc98bf23c16baf836d2c841792d4e0b35dd82727.tar.gz cli-fc98bf23c16baf836d2c841792d4e0b35dd82727.tar.xz cli-fc98bf23c16baf836d2c841792d4e0b35dd82727.zip |
Return bool from parse() indicating whether anything has been parsed
Diffstat (limited to 'cli/header.cxx')
-rw-r--r-- | cli/header.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cli/header.cxx b/cli/header.cxx index de20334..64b31d2 100644 --- a/cli/header.cxx +++ b/cli/header.cxx @@ -136,9 +136,16 @@ namespace // Are we generating parsing constructors or parse() functions? // - string n (options.generate_parse () - ? string ("void\n") + (name != "parse" ? "parse" : "parse_") - : name); + string n; + if (options.generate_parse ()) + { + os << "// Return true if anything has been parsed." << endl + << "//" << endl; + + n = string ("bool\n") + (name != "parse" ? "parse" : "parse_"); + } + else + n = name; os << n << " (int& argc," << endl << "char** argv," << endl @@ -247,7 +254,7 @@ namespace // if (!abst) os << "private:" << endl - << "void" << endl + << "bool" << endl << "_parse (" << cli << "::scanner&," << endl << um << " option," << endl << um << " argument);" |