|
Boost : |
From: Patrick Guio (patrick.guio_at_[hidden])
Date: 2002-01-15 04:44:56
On Mon, 14 Jan 2002, Vladimir Prus wrote:
> Patrick Guio wrote:
> > Dear all,
> > I have written a parser class and I wanted to know whether it could be of
> > any interest to be included in the boost system. Here is a short
> > description of it.
> > This class is meant to be used in two ways, either to be included in
> > another class as an inherited class and/or to be included in the main
> > routine.
>
> Well, up to this moment I was pretty sure your parser is the parser in the
> conventional sense (LR or LL) :-)
>
> > As an example, the class Parser can be used in the class Foo as
> >
> > class Foo : public Parser {
> > Foo::Foo(int nargs, char *args[]);
> > private:
> > enum { var1_enum, ... };
> > int var1;
> > ....
> > };
>
> Ah, so this is command line parser! Actually, I have been promising to finish
Actually it can be both used to parse command line and commands contained
in a file.
> one soon for a long time. At this moment what is missing from my code is
> support for sundry styles of options and checking from ambiguity. From code
> examples that you've given, I'm not sure about:
> i) Can be have validation of input arguments
I am not sure to understand what you mean. If it is to check whether an
option was found on the command line, it is yes.
> ii) How such thing as '-I' option to a compiler may be implemented (example
> please).
I have added a new member function ParseOption, actually a template
member function that do the job,
template<class T>
bool ParseOptions(int key, vector<T> &values) const;
So the option -I is added as I explained and every occurences of -Idir
will be parsed in a vector<string> for example.
> ii) Is there low-level access to parsed options, such as in form of
> vector< pair<string,/*option*/ string /*value*/> >
>
No but I guess it should not be a heavy task to provide.
Sincerely, Patrick
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk