First, std::exception doesn't have a constructor taking const char *; I fixed this by subclassing std::runtime_error instead, as suggested at https://en.cppreference.com/w/cpp/error/exception/exception:
The Microsoft implementation includes non-standard constructors taking strings thus allowing instances to be thrown directly with a meaningful error message. The nearest standard equivalents are std::runtime_error or std::logic_error.
Running into (added flag to treat as warning):
MyTokenizer.cpp: warning: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say &MyTokenizer::MyTokenizer::actionRegister105 [-fpermissive]
And then, trying to use the example documentation to make my stuff run...
TextFileStream tfs("Testfile");
MyTokenizer::MyTokenizer myTokenizer;
auto tokenizedStream = myTokenizer.processStreamWithIgnorance(tfs);
auto processedStream(tokenizedStream);
MyParser::MyParser myParser;
auto parsedStream = myParser.parseStream(processedStream);
gives
main.cpp: In function ‘int main()’:
main.cpp:77:44: error: cannot convert ‘std::__cxx11::list<std::shared_ptr<MyTokenizer::MyTokenizerTerminal>, std::allocator<std::shared_ptr<MyTokenizer::MyTokenizerTerminal> > >’ to ‘ProductionStream<MyTokenizer::MyTokenizerTerminal>&’
77 | auto parsedStream = myParser.parseStream(processedStream);
| ^~~~~~~~~~~~~~~
| |
| std::__cxx11::list<std::shared_ptr<MyTokenizer::MyTokenizerTerminal>, std::allocator<std::shared_ptr<MyTokenizer::MyTokenizerTerminal> > >
In file included from MyParser.h:15,
from main.cpp:15:
Parser.h:71:133: note: initializing argument 1 of ‘std::__cxx11::list<std::shared_ptr<_Tp> > Parser<InputStreamType, OutputProductionType>::parseStream(InputStreamType&) [with InputStreamType = ProductionStream<MyTokenizer::MyTokenizerTerminal>; OutputProductionType = Production]’
71 | inline std::list<std::shared_ptr<OutputProductionType>> Parser<InputStreamType, OutputProductionType>::parseStream(InputStreamType& rs) {
| ~~~~~~~~~~~~~~~~~^~
It seems like perhaps ListProductionStream template class is meant to be used somewhere, but I haven't been able to figure out what needs changing.
Building with g++ 9.3.0 and current master.
First,
std::exceptiondoesn't have a constructor takingconst char *; I fixed this by subclassingstd::runtime_errorinstead, as suggested at https://en.cppreference.com/w/cpp/error/exception/exception:Running into (added flag to treat as warning):
MyTokenizer.cpp: warning: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say &MyTokenizer::MyTokenizer::actionRegister105 [-fpermissive]And then, trying to use the example documentation to make my stuff run...
gives
It seems like perhaps
ListProductionStreamtemplate class is meant to be used somewhere, but I haven't been able to figure out what needs changing.Building with g++ 9.3.0 and current master.