[augeas-devel] Recursive lenses and counter

Raphaël Pinson raphink at gmail.com
Mon Feb 14 15:17:47 UTC 2011


Hi all,

I'm writing a lens for apt.conf (5) and I have a problem with counters
in recursive lenses. Here is my code:


   let rec entry =
      let value = [ seq "foo" . store Rx.word ] in
      [ counter "foo"
      . label "entry"
      . Build.opt_list value Sep.space
      . (Util.eol . entry)? ]

   let test_entry = "foo bar\nbaz foo bar"

   test entry get test_entry = ?


And here is what augparse (0.7.4) says of it:

  Test result: tests/test_aptconf.aug:70.3-.32:
    { "entry"
      { "2" = "foo" }
      { "1" = "bar" }
      { "entry"
        { "3" = "baz" }
        { "1" = "foo" }
        { "2" = "bar" }
      }
    }


The numbers are all mixed up! Why is that happening?


Cheers,


Raphaël




More information about the augeas-devel mailing list