|
Boost : |
From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-01-17 17:48:35
> <quote>
> my_program ( 0, 1) ( 1, 3) (( 0, 1), 15 ), (( 0,1), (7.8) )
> This is input of 2 points circle and line.
> </quote>
>
> This isn't a simple parsing task anymore.
>
> Regards Hartmut
Depends.
Imagine we have defined input operators for Shape classes
istream& operator>>( istream&, Point& ); // accept format (x,y); in other
case throw an exception
istream& operator>>( istream&, Circle& ); // accept format ((x,y), r); in
other case throw an exception
istream& operator>>( istream&, Line& ); // accept format ((x1,y1),
(x2,y2)) in other case throw an exception
They could even exist by itself without CLA processing needs. Each one of
them is easily implemented (with tokenizer for example). Now In combination
with chain_lookup_policy we could have a cla::parser that accept above
syntax with arbitrary order of elements. The idea is originated by the
article "Industrial strength Pluggable Factories" that could be found
online.
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk