[augeas-devel] [PATCH 4/6] Generic square lens v3

David Lutterkort lutter at redhat.com
Tue Aug 14 00:33:22 UTC 2012


On Sun, 2012-08-12 at 23:37 +0200, Francis Giraldeau wrote:
> Lens square now takes lenses instead of regular expressions as arguments, as follow:
> 
>   square left body right
> 
> The left and right lenses must accept the same language. The left lens can be
> either key or del, while the right lens must be del.

ACK. Very nice.

One comment that I don't think is easily fixible (and shouldn't keep you
from committing):

> diff --git a/src/put.c b/src/put.c
> index 56732d2..5e6212e 100644
> --- a/src/put.c
> +++ b/src/put.c
 
> @@ -598,9 +598,32 @@ static void put_rec(struct lens *lens, struct state *state) {
>  }
>  
>  static void put_square(struct lens *lens, struct state *state) {
> +    assert(lens->tag == L_SQUARE);

It's very annoying that put_square and create_square are essentially
copies of the same code for L_CONCAT. But since we have to wait to set
state->override until putting the right lens (so that (square l1 (square
l2 l3 l4) l5) can work), I don't see an easy way out, unless we want to
pass a callback into put/create_concat ... but that's food for another
patch.

David





More information about the augeas-devel mailing list