[rules-users] Running through Collection using DSL

Markus Helbig info at markushelbig.de
Thu Apr 3 02:22:24 EDT 2008


Hi,

i'd like to do the following in consequence:


for (Iterator it = $collection.iterator(); it.hasNext(); $item = it.next()) {
      System.out.println($item);
}

But as always i'd like to use a DSL

[consequence][]For each {item} from {collection}=for (Iterator it =
{collection}.iterator(); it.hasNext(); {item} = it.next()) {
[consequence][]End=}

The Rule:

For each $item from $pli.getItems()
	Show $item
End


The DRL Viewer exactly shows what i want to have. But compiling any
rulefile expanding this DSL (also the consequences are not used)
resolve into following errors:

line 68:0 mismatched character '<EOF>' expecting '"'
[0,-1]: unknown:0:-1 mismatched token: [@-1,0:0='<no
text>',<-1>,0:-1]; expecting type END

or

line 131:80 required (...)+ loop did not match anything at character '+'
line 15:74 no viable alternative at character '\'

The reason theems to be

[consequence][]End=}

But why?? Any suggestions, thans very much in advance

Cheers

Markus



More information about the rules-users mailing list