[augeas-devel] Fixing ambiguous iteration errors

Raphaël Pinson raphink at gmail.com
Fri Oct 14 18:00:12 UTC 2011


2011/10/14 Tom Limoncelli <tal at whatexit.org>

> Thanks for the feedback.  I'm attaching the file and the test.  It's
> changed a little since the error I showed before.  now it is:
>
>
You're doing low level here. There's quite a few primitives you could use to
ease your development:

let lbracket = del /\(/ "("
> let rbracket = del /\)/ ")"


You can use Util.del_str for that:

let lbracket = Util.del_str "("
let rbracket = Util.del_str ")"

let var_name = key /[a-zA-Z0-9]+/
>

Have a look at the Rx module for that, for example with Rx.word (a bit
looser, but fine for your needs):

let var_name = Rx.word

let simple_value = store /[^a-zA-Z0-9]+/
>

Do you *really* want anything but letters? That means, you're trying to
store pretty much everything but letters, including spaces and even
newlines.
I think you don't want the '^' here, and you could probably use Rx.word as
well.


let simple_list = [ lbracket . var_name . del /[ \t\n]+/ " " . simple_value
> . rbracket ]


Are you sure you want to allow '\n' as a separator between var_name and
simple_value? If not, you could use Sep.space for the separator here.

Now this is were you have your problem, because of your definition of
simple_value. What happens is that if the string contains a '\n', there's no
way to know if it belongs to the separator ( /[ \t\n]+/ ) or the value
( /[^a-zA-Z0-9]+/ ).



Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20111014/7cd65b30/attachment.htm>


More information about the augeas-devel mailing list