[augeas-devel] Inexpressible Language

Raphaël Pinson raphael.pinson at camptocamp.com
Sun Jun 29 09:46:02 UTC 2014


What's missing in your case is [ ] around your comment definition:

    let comment (r:regexp)  = [ del r "" ]


This is to avoid an ambiguous tree (in the direction a → c). That said, I
personally prefer to map comments in the tree, if we're going to parse them
anyway.


Regards,

Raphaël



On Sun, Jun 29, 2014 at 10:45 AM, Raphaël Pinson <
raphael.pinson at camptocamp.com> wrote:

> You're using a lot of /.*/, which is rarely a good idea.
>
> Could you provide an example of a string that does not parse with the lens
> I provided, and the tree you expect the lens should produce from it?
>
>
> Regards,
>
> Raphaël
>
>
>
> On Sun, Jun 29, 2014 at 8:37 AM, Yclept Nemo <orbisvicis at gmail.com> wrote:
>
>> Thanks,
>>
>> Now I'm using your example as guidance since there was one additional
>> restriction I failed to demonstrate. Unfortunately my schema generates an
>> "ambiguous tree iteration" exception:
>>
>>     let option              = key /[A-Z_]+/
>>     let value               = Sep.colon . Sep.opt_space . store /[^]
>> \t\n:]+/ . Sep.opt_space
>>     let values              = counter "value" . [ seq "value" . value ] +
>>     let setting             = [ Util.del_str "[" . option . values .
>> Util.del_str "]" ]
>>     let comment (r:regexp)  = del r ""
>>     let entry               =
>>         let not_setting = /.*/ - ( lens_ctype setting . /.*/ )
>>         in  setting . comment /.*/ | comment not_setting
>>     let line                = entry . Util.del_str "\n"
>>     let lns                 = line *
>>
>>     given the input [1]
>>
>> If I understand regex subtraction correctly, "re1 - re2" is interpreted
>> as the set of all possible matches generated by re2 subtracted from the set
>> of all possible matches generated by re1. However this generates massively
>> long and complex regexes, is this possibly the root of the problem?
>>
>> Anyway I'm grateful for your help and I apologize for responding so late
>> and not having provided a proper example.
>>
>> Sincerely,
>>
>
>
>
> --
> Raphaël Pinson
> Infrastructure Developer & Trainer
> +33 479 26 57 93
> +33 781 90 00 79
>
> Camptocamp France
> Savoie Technolac
> BP 352
> 48, avenue du Lac du Bourget
> 73372 Le Bourget du Lac, Cedex
> www.camptocamp.com
>



-- 
Raphaël Pinson
Infrastructure Developer & Trainer
+33 479 26 57 93
+33 781 90 00 79

Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20140629/a219c122/attachment.htm>


More information about the augeas-devel mailing list