[augeas-devel] Recursive lenses and counter

Raphaël Pinson raphink at gmail.com
Tue Feb 15 07:42:27 UTC 2011


2011/2/15 David Lutterkort <lutter at redhat.com>:
> On Mon, 2011-02-14 at 16:17 +0100, Raphaël Pinson wrote:
>> The numbers are all mixed up! Why is that happening?
>
> When using recursive lenses, Augeas uses a context-free parser. The
> first step in parsing is to construct a parse tree, the second step
> consists of traversing the parse tree. Leaves in the parse tree
> correspond to the non-recursive parts of your lens, for example 'value'
> and 'counter "foo"'
>
> The traversal of the parse tree does not visit leaves in strict
> left-to-right order - in fact, the traversal is mostly right-to-left.
> That explains why you see nodes in reverse order; for the 'jumbled'
> sequence 3, 1, 2 you'd have to look at the actual parse tree.
>
> In a nutshell: seq/counter don't really work with recursive lenses.
> Fixing that would be a serious amount of work since it would affect the
> whole recursive lens machinery.
>

Alright, so the best solution is really to use label instead of seq.
Thanks for the explanation.


Raphaël




More information about the augeas-devel mailing list