<div dir="ltr"><br><br><div class="gmail_quote">On Wed, Sep 3, 2008 at 1:36 AM, David Lutterkort <span dir="ltr"><<a href="mailto:lutter@redhat.com">lutter@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Fri, 2008-08-29 at 15:09 +0200, Raphael Pinson wrote:<br>
> # HG changeset patch<br>
> # User Raphael Pinson <<a href="mailto:raphink@gmail.com">raphink@gmail.com</a>><br>
> # Date 1220015334 -7200<br>
> # Node ID 682d87344dedee300e0829e994ceab1f1baab318<br>
> # Parent  f6b7eed4d4d2a1e9bb598146f13a1e6fff9f4a4b<br>
> Add mysql.aug and associated test<br>
<br>
</div>I get a test failure when I try to run this:<br>
<br>
        Test run encountered exception:<br>
        lenses/tests/test_mysql.aug:46.7-.25:exception: Get did not match entire input<br>
            Lens: lenses/inifile.aug:77.25-.43<br>
            Error encountered here (980 characters into string)<br>
            <ludedir /etc/mysql/conf.d/\n\n|=|><br>
<br>
Could be the changes for '?' I just sent out.<br>
<div class="Ih2E3d"><br>
> +let entry    =<br>
> +      let kw = IniFile.entry_re in<br>
> +         [ key kw . (sep . sto_to_comment?)? . (comment|eol) ] | comment<br>
<br>
</div>This shouldn't typecheck: assume the construct '(sep .<br>
sto_to_comment?)?' is parsed simply as 'sep'. During 'put', there's<br>
nothing in the tree that tells us whether 'sep' should be used or not.<br>
</blockquote><div><br>That makes perfect sense indeed. Unfortunately, I believe that mysql.aug supports both empty key/value pairs (i.e. 'field = \n') and flags (i.e. 'field\n').<br> <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This becomes clearer if you write '(sep . sto_to_comment?)?' as<br>
'(nothing|sep|sep . sto_to_comment)' where 'nothing' is a (hypothetical)<br>
lens that does nothing - when this construct is encountered at a tree<br>
node with no value during put, there's no way to know whether to use<br>
nothing.put or sep.put; right now, the implementation will opt for<br>
nothing.put, and therefore drop existing matches of 'sep' on the floor.<br>
</blockquote><div><br>Ah yes, that's even clearer.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The typechecker doesn't complain about this, so there's still something<br>

missing there.<br>
<font color="#888888"></font></blockquote><div><br><br>I still don't really see how to fix that though, except by making two separated lenses for entries and flags, which forces me to indicate the names of the values for each kind, so they don't overlap on put.<br>
<br><br>Raphael<br></div></div><br></div>