[augeas-devel] Iterated lens leads to 'ambiguous tree iteration'

Mol, Xavier (SCC) xavier.mol at kit.edu
Wed Mar 22 07:47:06 UTC 2017


Hi Štěpán,

I guess, you should not try to match the line break twice. So something similar to the following (which I have not verified to work properly) might work better:

let eol = ws* . [ label "#comment" . del /[;#]/ ";" . store /[^\n]*/ ]? . del_str "\n"


Furthermore, I guess that you try to match for comments with a ';' as well as '#', right? Then maybe you could try to use the Util.comment_generic lens, which allows you redefine the #comment node with a different regular expression?

Ciao,
Xavier.

> -----Original Message-----
> From: augeas-devel-bounces at redhat.com [mailto:augeas-devel-bounces at redhat.com] On Behalf Of Štepán Balážik
> Sent: Tuesday, March 21, 2017 6:16 PM
> To: augeas-devel at redhat.com
> Subject: [augeas-devel] Iterated lens leads to 'ambiguous tree iteration'
> 
> Hi,
> 
> While writing a lens for Deckard tests
> (https://gitlab.labs.nic.cz/knot/deckard) I ran into a problem.
> 
> This lens
> 
>      let eol = ws . ((del /[;#]/ ";" . [label "#comment" . store /[^\n]*/]
>                . del_str "\n") | (del_str "\n"))* . del_str "\n"
> 
> results in this error:
> 
>      $ augparse /usr/share/augeas/lenses/dist/deckard.aug
>      Syntax error in lens definition
>      /usr/share/augeas/lenses/dist/deckard.aug:22.0-.119:Failed to
> compile eol
> /usr/share/augeas/lenses/dist/deckard.aug:22.15-.104:exception:
> ambiguous tree iteration
>        Iterated regexp: /     { /#comment/ = /[^\001-\004\n]*/ }
>        | ()/
>        ' { "#comment" }' can be split into
>        '|=| { "#comment" }'
> 
>       and
>        ' { "#comment" }|=|'
> 
>      Iterated lens: /usr/share/augeas/lenses/dist/deckard.aug:22.15-.102:
> 
> I can't get my head around the notation of Augeas' `tree -> plaintext`
> exception notation so I have no idea what is `augparse` trying to say.
> 
> Can anyone help me with an explanation or a fix for the lens?
> 
> Thanks for tips and help,
> 
> Štěpán
> 
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6401 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20170322/f23fd494/attachment.p7s>


More information about the augeas-devel mailing list