logo separator

[mkgmap-dev] if-then-else in style and style options

From Gerd Petermann GPetermann_muenchen at hotmail.com on Fri Mar 10 10:55:04 GMT 2017

I just noticed that the patch reuse-expression-v1.patch and the latest change (r3839) can make problems:
if (a=b) then
  name(..)
  [0x01 ... resolution 18 continue]
end

is interpreted as
if (a=b) then
  {name ..}  [0x01 ... resolution 18 continue]
end
while the old form
a=b {name ..}
a=b [0x01 ... resolution 18 continue]
has a different meaning

So, I'll revert r3839 for now :-(

Gerd
________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Gerd Petermann <GPetermann_muenchen at hotmail.com>
Gesendet: Freitag, 10. März 2017 09:10:40
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] if-then-else in style and style options

Hi Andrzej,

okay, I think that meant I should apply the patch, done with r3839.

I've also checked your idea for the shorter form. I first thought it is simple but then noticed that
you didn't specify the continue statement in the shorter form.
I guess you want that to be added automatically. Does that also mean that "with_actions" should
be added automatically if there are actions?
In other words: If we have
a=b {name ... } [0x0C ... resolution 24] [0x10801 resolution 18]
would that be the same as
a=b {name ... } [0x0C ... resolution 24 continue with_actions]
a=b [0x10801 resolution 18]

I guess that also means we should allow
a=b {name ... } [0x0C ... resolution 24] {set ... } [0x10801 resolution 18]
as a replacement for
a=b {name ... } [0x0C ... resolution 24 continue with_actions]
a=b {set ... }  [0x10801 resolution 18]

Now, I think that mens we should also allow
a=b {name ... } [0x0C ... resolution 24] {set c=2 }
as a repelacement for
a=b {name ... } [0x0C ... resolution 24 continue with_actions]
a=b  {set c=2 }

The attached patch seems to implement it that way and contains some unit tests.
I hope it doesn't mess up error handling when the style contains syntax errors.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Donnerstag, 9. März 2017 14:57:11
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] if-then-else in style and style options

Hi Gerd,

I don't think that kind of expression is necessary, unless it speeds up
compilation, which it probably doesn't in current implementation. But it
would be nice to have it. Maybe using keyword "apply" would help?
Similarly like in relations.

Just another thought, could we get following syntax:
junction=roundabout & (highway=trunk | highway=trunk_link) [0x0c
road_class=4 road_speed=2 resolution 24][0x10801 resolution 18]

instead of 2 rules:
junction=roundabout & (highway=trunk | highway=trunk_link) [0x0c
road_class=4 road_speed=2 resolution 24 continue]
junction=roundabout & (highway=trunk | highway=trunk_link) [0x10801
resolution 18]

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list