[rules-users] Are implicit ANDs allowed in "not" blocks?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Nov 23 01:57:35 EST 2010


Look at the syntax diagram for ConditionalElement in
http://members.inode.at/w.laun/drools/DroolsSyntax.pdf, p.7, to get an idea
of the overall complexity. (Attention: this document incorporates some
changes that will happen only with version 5.2., it's still work in
progress) The omission of 'and' in the WhenPArt (p.5)  is traditional
syntactic sugar. Not permitting the same in subexpressions is much easier to
handle the parser.

So, the answer is: easier parsing and, hopefully, better error recovery.

-W



2010/11/23 Nathan Bell <Nathan.Bell at pharmacyonesource.com>

>  This rule:
>
>
>
> *rule* "Not"
>
> *when*
>
>       *not*(
>
>           RuleTime()
>
>           Patient()
>
>           )
>
> *then*
>
>       System.out.println("not");
>
> *end*
>
>
>
> produces the following errors when compiled:
>
>
>
> [ERR 102] Line 43:5 mismatched input 'Patient' expecting ')' in rule "Not"
>
> [ERR 102] Line 44:5 mismatched input ')' expecting 'then' in rule "Not"
>
>
>
>
>
> But if I change it to use explicit ANDs instead of implicit ANDs it
> compiles and runs.
>
>
>
> *rule* "NotBlock"
>
> *when*
>
>       *not*(
>
>           RuleTime()
>
>           *and*
>
>           Patient()
>
>           )
>
> *then*
>
>       System.out.println("notBlock");
>
> *end*
>
>
>
>
>
> Is it invalid syntax to use implicit ANDs in a not block? If so, why?
>
>
>
>
>
> Thank You,
>
>
>
> Nathan Bell
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101123/d16b9e88/attachment.html 


More information about the rules-users mailing list