On Thu, Jan 17, 2013 at 01:06:48PM +0100, Mario Camou wrote:
>
> I am testing something like this:
>
> Ruote.define do
> set 'f:x' => '1x'
> set 'f:y' => '2x'
> sequence :if => "${f:x} == ${f:y}" do
> echo 'IF IF IF IF IF IF'
> end
> end
>
> My problem here is that I'm getting the echo out even though the values are
> different. If I invert the condition I also get the echo. This seems to
> happen any time the field values start with a digit.
>
> If I change the values to start with an alphabetical character things work
> fine. If I change ${f:x} to ${'f:x} (and also for f:y) it also works fine
> but I'm trying to get my head around what is going on here and the rules
> for quoting within an if.
Hello Mario,
ruote, behind the scene, is using RubyParser to get the parse tree of the
expression. "1x == 2x" is not valid Ruby, it results in a syntax error, so
ruote defaults to considering the whole as a string, "1x == 2x".
I've pushed this small change:
https://github.com/jmettraux/ruote/commit/7e18daacacf2f57d28f7a482729108d0d747ab21
that tries a bit harder if it finds something like "x == y" or "x != y".
Note that older versions of ruote (until 2.1 maybe), accepted "2x == 2x", so
with this commit, I'm moving back to a ruote that is more tolerant with its
conditions.
If there are objections with this commit, please raise your voice.
Cheers,
--
John Mettraux - http://lambda.io/jmettraux
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en