I tried a few permutations with 5.1.x<div><br></div><div>Nested infix appears to have a few problems, as you describe (although your last example is incomplete); e.g.:-</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">rule "Unknown error while parsing. This is a bug. Please contact the Development team."</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">when</font></div><div><font class="Apple-style-span" face="'courier new', monospace">(or </font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>(</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>or Fact( ) Fact( )</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>Fact() </font></div><div><font class="Apple-style-span" face="'courier new', monospace">)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">then</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>//Something</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">end <br></font><br></div><div>Non-nested infix looked OK:-</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">rule "compiles OK - 1"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">when</font></div><div><font class="Apple-style-span" face="'courier new', monospace">(or </font><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">Fact( ) Fact( ) </span><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">Fact()) </span></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">then</span></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre; "> </span>//Something</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">end <br></font></div></div><div><br></div><div>Post-fix appears OK:-</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">rule "compiles OK - 2"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">when</font></div><div><font class="Apple-style-span" face="'courier new', monospace">(</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> Fact() or </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> Fact()</font></div><div><font class="Apple-style-span" face="'courier new', monospace">) or </font></div><div><font class="Apple-style-span" face="'courier new', monospace">Fact() </font></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">then</span></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"> </span>//Something</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">end</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; "><div>
Based on my limited test it appears to be a bug and my advice would be to raise a JIRA.</div><div><br></div><div>As a work around you can change your rules in post-fix notation.</div><div><br></div><div>With kind regards,</div>
<div><br></div><div>Mike</div><div><br></div></span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> <br></font></div><div class="gmail_quote">On 26 October 2010 11:09, Swindells, Thomas <span dir="ltr"><<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What are you actually trying to achieve?<br>
It would probably be a lot cleaner and better just to write these as separate rules - one for each case you want to consider.<br>
<br>
Thomas<br>
<div><div></div><div class="h5"><br>
> -----Original Message-----<br>
> From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-">rules-users-</a><br>
> <a href="mailto:bounces@lists.jboss.org">bounces@lists.jboss.org</a>] On Behalf Of chrbonte<br>
> Sent: 26 October 2010 10:52<br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Subject: [rules-users] no viable alternative at input 'or'<br>
><br>
><br>
> Hi<br>
><br>
> I'm struggling with the rule syntax. I took over this drools project of a<br>
> collegue who left the company and am struggling with a bug in our<br>
> application.<br>
><br>
> The following works:<br>
><br>
> rule "cbo2"<br>
> when<br>
> (or<br>
> Patient(sex == "F")<br>
> Patient(sex == "")<br>
> )<br>
> then<br>
> ...<br>
> end<br>
><br>
> What doesn't work is the following:<br>
><br>
> rule "cbo"<br>
> when<br>
> (or<br>
> (or<br>
> Patient(sex == "F")<br>
> Patient(age > 2)<br>
> )<br>
> Patient(sex == "")<br>
> )<br>
> then<br>
> ...<br>
> end<br>
><br>
> AND<br>
><br>
> rule "cbo"<br>
> when<br>
> (or<br>
> (or<br>
> Patient(sex == "F")<br>
> Patient(age > 2)<br>
> )<br>
> )<br>
> then<br>
> ...<br>
> end<br>
><br>
> -------------------<br>
><br>
> Can someone please point me in the right direction or explain to me why I<br>
> get "no viable alternative at input 'or' with the last 2 examples?<br>
><br>
> Regards<br>
> Christophe<br>
> --<br>
> View this message in context: <a href="http://drools-java-rules-" target="_blank">http://drools-java-rules-</a><br>
> <a href="http://engine.46999.n3.nabble.com/no-viable-alternative-at-input-or-" target="_blank">engine.46999.n3.nabble.com/no-viable-alternative-at-input-or-</a><br>
> tp1772702p1772702.html<br>
> Sent from the Drools - User mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
</div></div>**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>