[augeas-devel] how to make lens accept both quoted and unquoted values with trailing comments

Timur Batyrshin erthad at gmail.com
Tue Nov 11 16:04:34 UTC 2014


Hi all,

I'm trying to create a lens that accepts both quoted and unquoted values
and is able to process trailing comments of both ; and #-style

Here is my lens (actually it is only a part of bigger pre-1.1 inifile-based
one but this is enough to reproduce the issue):

module Testtest =

let to_comment_re = /[^";# \t\n][^;#\n]*[^;# \t\n]|[^";# \t\n]/
let sto_to_comment = Sep.opt_space . store to_comment_re

let quote = del "\"" "\""
let quoted_value_re = /[^"]*/
let quoted_value = Sep.opt_space . (quote . (store quoted_value_re) . quote)

let value = sto_to_comment | quoted_value


When I try to process it with augparse I see the following result:

$ augparse /tmp/testtest.aug
Syntax error in lens definition
/tmp/testtest.aug:10.0-.41:Failed to compile value
/tmp/testtest.aug:10.12-.41:exception: overlapping lenses in tree union.put
    Example matched by both:
    First lens: /tmp/testtest.aug:4.21-.56:
    Second lens: /tmp/testtest.aug:8.19-.76:

How should I deal with errors like that?
I understand that augeas can't figure out if it should quote my value or
not when writing it but I have no ideas how to make it separate between
them.
How do you usually handle the case like this one?


Thanks,
Timur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20141111/4025e402/attachment.htm>


More information about the augeas-devel mailing list