Currently whenever we encounter an argument we look for any parameter that can accept it (and if that's the case, we see it as valid). Unfortunately it leads to weird bugs. My idea is to add new member (possibly a pointer) of class Parser called CurrentlyParsedElement or whatever - we add arguments to that parameter until either of following conditions is not met:
Argument is not in parameters AcceptedArgument vector
We have already parsed maximum amount of arguments for given parameter. This might render CheckArgCount obsolete since we would try to treat 'overflowing' arguments as parameters - and that should fail, obviously.
What about parameters with no argument limit and no requirements for their arguments? (Example: list of input files for your program - you can neither have requirements nor limit here). I think we have to check all the valid parameter names and see whether our argument matches any of those. If that's the case, we stop parsing current command.
Currently whenever we encounter an argument we look for any parameter that can accept it (and if that's the case, we see it as valid). Unfortunately it leads to weird bugs. My idea is to add new member (possibly a pointer) of class
Parser
calledCurrentlyParsedElement
or whatever - we add arguments to that parameter until either of following conditions is not met:AcceptedArgument
vectorCheckArgCount
obsolete since we would try to treat 'overflowing' arguments as parameters - and that should fail, obviously.What about parameters with no argument limit and no requirements for their arguments? (Example: list of input files for your program - you can neither have requirements nor limit here). I think we have to check all the valid parameter names and see whether our argument matches any of those. If that's the case, we stop parsing current command.