[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Matching key/value statement



Hi Yclept,

 

do I understand your proposed match correctly in that only the key node and a '=' sign are guaranteed to exist? Appart from that, try using variables and functions from the generic modules coming with Augeas. That does ease development for you and avoids misunderstandings on this list. E.g. does this maybe already match your pattern (you have not given a regular _expression_ to match "key", "value" or "comment", so I just assume you want to match a simple word and comments are started with '#')?

 

let match = [ Util.del_opt_ws . key  Rx.word . Sep.space_equal . (store Rx.word)? . Util.comment_or_eol ]

 

I haven't tested this, since you did not give a real word example either, so try it for yourself.

 

Ciao,

Xavier.

 

 

From: augeas-devel-bounces redhat com [mailto:augeas-devel-bounces redhat com] On Behalf Of Yclept Nemo
Sent: Friday, October 3
0, 2015 2:18 AM
To: augeas-devel
Subject: [augeas-devel] Matching key/value statement

 

How to unambiguously match:

    # spaces? key spaces? = spaces? value? spaces? comment?

where "key" is the node key, "value" the node value, and "comment" and child node?


These are all accurate but create ambiguities in the put direction:

    = (spaces | ((spaces? . value)? . (spaces? . comment)?))

    = spaces? . (value | comment | (value . spaces? . comment?))?

    = (spaces? | (spaces? . value) | (spaces? . comment) | (spaces? . value . spaces? . comment))

... whether or not the union branches occur on the lens or node level.

Sincerely,

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]