First usable generator source.
Still issues with usage rules and error reporting, but functional.
This commit is contained in:
19
examples/dc/dc.argspec
Normal file
19
examples/dc/dc.argspec
Normal file
@@ -0,0 +1,19 @@
|
||||
Program:
|
||||
program dc
|
||||
version "dc (GNU bc 1.07.1) 1.4.1\n\nCopyright 1994, 1997, 1998, 2000, 2001, 2003-2006, 2008, 2010, 2012-2017 Free Software Foundation, Inc."
|
||||
license "This is free software; see the source for copying conditions.\nThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, to the extent permitted by law."
|
||||
help "Email bug reports to: bug-dc@gnu.org"
|
||||
|
||||
Usage:
|
||||
|
||||
dc
|
||||
dc OPTIONS
|
||||
|
||||
OPTIONS = --expression | --file
|
||||
|
||||
Arguments:
|
||||
|
||||
--help, -h, , "shows this help message"
|
||||
--version, -V, , "prints the version of the program"
|
||||
--expression, -e, EXPR, "evaluate expression"
|
||||
--file, -f, FILE, "evaluate contents of file"
|
||||
18
examples/dc/main.cpp
Normal file
18
examples/dc/main.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "src/dcArgGrammarDriver.hpp"
|
||||
#include <sstream>
|
||||
|
||||
using Result = dcArgGrammar::Driver::Result;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
dcArgGrammar::Driver driver{ argc, argv };
|
||||
auto res = driver.parse();
|
||||
|
||||
if (res != Result::success) {
|
||||
if (res == Result::completedAction)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user