catchorg/Clara

remainingTokens is not accessible after parsing

vogel opened this issue · 0 comments

vogel commented

I was trying to extract remainingTokens from InternalParseResult from failed parse, but I was not able to. It seems that remainingTokens are a pair of iterators that are no longer valid after Parser::parse() method was finished.

I think it means that return value of Parser::parser() has wrong return type, as it gives access to variables that cannot be accessed. It could be fixed by either changing the return type, make variables valid at that point, or add a new TokenStream/std::vectorstd::string member to Parser class that will contain remainingTokens after parse() is finished.

I've ended up with implementing my own class from Parser that does the last thing.

Please let me know what do you think about it (nb.: in some previous version of clara those values were easily accessible by unusedTokens() method).