Added first example.

This commit is contained in:
2019-09-19 14:11:48 +01:00
commit 8a292241e3
13 changed files with 451 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
#pragma once
#if !defined(yyFlexLexerOnce)
# include <FlexLexer.h>
#endif
#include "trueArgGrammarDriver.hpp"
#include <cstring>
#include <optional>
#include <sstream>
namespace trueArgGrammar {
class Scanner : public yyFlexLexer {
public:
using Result = Driver::Result;
Scanner(int argc, char* argv[], Driver& driver);
virtual ~Scanner() = default;
using FlexLexer::yylex;
virtual int yylex(trueArgGrammar::Parser::semantic_type* const lval);
void resetOnWrap();
void setResult(Result result);
private:
int argc, argi;
char** argv;
Driver& driver;
std::stringstream streamInput;
std::optional<int> resetVal;
trueArgGrammar::Parser::semantic_type* yyval = nullptr;
protected:
int yywrap() override;
};
} // namespace trueArgGrammar