[augeas-devel] Matching key/value statement

Yclept Nemo orbisvicis at gmail.com
Mon Nov 2 16:55:48 UTC 2015


Hi,

 > Yet I feel like you actually wanted to point out something different
with your mail from the start

I want to illustrate how augeas' limitations make it difficult or
impossible to match even the simplest statements. For those comfortable
with the generic modules, here are the equivalences:
        let spaces              = /[ \t]+/ " "          = Sep.space
        let spaces_none         = del /[ \t]*/ ""       = Sep.opt_space
        let equal               = del /=/ "="           = Sep.equal

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

Now these are the conditions violated in each case by your suggestion:

n   |    let record  = [ key Rx.word . Sep.space? . Sep.equal . Sep.space? ]
n   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. comment ]
n   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. value ]
y   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. value . spaces? . comment ]

y   |    let record  = [ key Rx.word . Sep.space? . Sep.equal .
Sep.opt_space ]
n   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. comment ]
y   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. value . Sep.opt_space ]
y   |                | [ key Rx.word . Sep.space? . Sep.equal . Sep.space?
. value . Sep.space? . comment ]

That said, I have already worked out a possible and complicated solution
for each of the above ambiguous cases.

Sincerely,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151102/bc464e69/attachment.htm>


More information about the augeas-devel mailing list