First usable generator source.

Still issues with usage rules and error reporting, but functional.
This commit is contained in:
2019-09-28 16:01:40 +01:00
parent 54de004ede
commit 60d0446cf0
24 changed files with 1605 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
{{=@@ @@=}}
#include "@@{argspec}@@ArgGrammarScanner.hpp"
#include "@@{argspec}@@ArgGrammarDriver.hpp"
namespace @@{argspec}@@ArgGrammar {
Scanner::Scanner(int argc, char* argv[], Driver& driver)
: yyFlexLexer{}, argc{ argc }, argv{ argv }, argi{ 1 }, streamInput{}, resetVal{}, driver{
driver
} {
if (argi < argc)
streamInput << argv[argi];
switch_streams(&streamInput);
}
int Scanner::yywrap() {
++argi;
bool more = (argi < argc);
if (more) {
streamInput << argv[argi];
resetOnWrap();
}
return more ? 0 : 1;
}
void Scanner::setResult(Scanner::Result result) {
driver.setResult(result);
}
} // namespace @@{argspec}@@ArgGrammar