|
Boost : |
From: John Max Skaller (skaller_at_[hidden])
Date: 2001-07-26 15:30:01
John Maddock wrote:
> Yep, although its not the backtracking as such that mandates this - if you
> want to be able to return iterators denoting what matched then they have to
> be at least forward iterators in any case. The only reason that
> bidirection iterators are required is to make it easier to match things
> like $ and ^, in some cases.
It is possible to build interator category adaptors:
input->forward -> bidirectional -> random
There are also some interesting non-standard iterator categories,
for example: 'anchored bidirectional iterator' which is a pair
consisting of a forward iterator (the anchor) and a bidirectional
iterator which can't move backwards past the anchor.
By using an input->forward iterator adaptor for the anchor,
you can write a parser which provides bidirectional iterators
for look ahead, but actually uses an _input_ iterator
to get source tokens.
Are there any such 'category adaptors' in boost?
Any interest?
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 New generation programming language Felix http://felix.sourceforge.net Literate Programming tool Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk