Uwe Stöhr <[EMAIL PROTECTED]> writes: >> I think the new method is not needed because direct code is almost as >> compact. >> Moreover, it is better IMO to keep the Parser interface small. > > But getting an option that is in parentheses will surely be useful for > the future as well, therefore I didn't use the direct code but > introduced this function in parser.cpp. The function is as small as > possible and easy to understand.
Your getParenthesesOpt function has a problem: since it is modelled after getOpt(), it allows for an optional argument. But () arguments are not optional in general. So at least this function should be renamed to Parser::getFullParentheseArg() and should fail (how?) when the opening parenthesis is not found. Still, it would have semantics different from the other functions. I think therefore that this function is very misleading. What could be useful for ERT, though, is a version of getFullArg that returns the outer delimiters. Moreover, one could make use of the currently unused FLAG_OPTION = 1 << 11, // read [...] style option FLAG_BRACED = 1 << 12, // read {...} style argument enum flags instead of passing explicitly the left and right delimiters. Note also that the new code just needs one more line, so there is not much lost. JMarc