On 18/01/10 07:47, Marko Mäkelä wrote:
Hi Marko
> I see. I guess that only the first matching [] rule will be run
> and that any {set} or {add} rules will not affect further tests.
There is a 'continue' keyword that allows further matches to take
place.
The set and add actions are expected to affect further matches (as in
people expect it to happen, as it is meant to work as-if the rules
were applied in order), but as you will realise this is difficult to
implement as you have to throw away optimisation if you detect that it
could happen.
The style branch implements that a bit better.
> The same would apply to second.isType(OR), I suppose.
What kind of rule would that work for?
> Do you have any idea why the surface ~ '...\|...' would omit some definitions
> that are included by the surface=... | surface=...?
The backslashes should not be there. Running the following
works fine with all backslashes removed (in RuleFileReaderTest).
@Test
public void testRegex() {
RuleSet rs = makeRuleSet("highway=* & (surface ~
'cobblestone|compacted"
+
"|dirt|earth|grass(_paver)?|gravel|grit|ground" +
"|mud|pebblestone|sand|unpaved') " +
"[0x42]");
Way el = new Way(1);
el.addTag("highway", "primary");
el.addTag("surface", "grass");
GType type = rs.resolveType(el);
assertNotNull("regex matches surface=grass", type);
}
..Steve
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev