[mkgmap-dev] To do: If-Then-Else
From Dave Swarthout daveswarthout at gmail.com on Wed Feb 8 12:32:18 GMT 2017
It would be easier for the parser without curly braces: +1 I was gonna suggest not using curly-braces earlier but don't know enough about parsers to make such a request. Seeing as they're already required in other places, it would be advantageous to not require them again in this context. Dave On Wed, Feb 8, 2017 at 6:28 PM, Steve Ratcliffe <steve at parabola.me.uk> wrote: > > Hi > > don't know if this helps: >> I see one possible implementation for a conditional rule like >> if (<exp>) { >> some rules >> } else { >> other rules >> } >> where <exp> would be something like tag=val, maybe also a parameter given >> to the program. >> If someone knows how to implement the syntax parser for such an >> if-thent-else clause the evaluation could simply >> > > It would be easier for the parser without curly braces: > > if (<exp) > some rules > else > other rules > endif > > I could make that work. > > ..Steve > > translate the if (<exp>) to a rule like >> exp {set special_var_x=true;} >> and then add this special tag with tag=true or tag!=true to each >> conditional rule. >> So, we would not need many changes in the evaluation of the rules, only >> in the parser. >> >> Gerd >> >> ________________________________________ >> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von >> Mike Baggaley <mike at tvage.co.uk> >> Gesendet: Dienstag, 7. Februar 2017 18:22:32 >> An: mkgmap-dev at lists.mkgmap.org.uk >> Betreff: Re: [mkgmap-dev] To do: If-Then-Else >> >> Hi Andrzej, can you not make use of mkgmap:country to handle this >> scenario? >> >> mkgmap:country=DZA | mkgmap:country=AGO | mkgmap:country=SHN | >> mkgmap:country=BEN ... {set continent=AF} >> >> continent=AF & landuse=farmland [0x10f01 level 1] >> >> Would mkgmap be better with a mkgmap:continent variable using >> place=continent added? >> >> Regards, >> Mike >> >> -----Original Message----- >> From: Andrzej Popowski [mailto:popej at poczta.onet.pl] >> Sent: 07 February 2017 12:39 >> To: mkgmap-dev at lists.mkgmap.org.uk >> Subject: Re: [mkgmap-dev] To do: If-Then-Else >> >> Hi Dave, >> >> I think the idea is to include some preprocessing capability to style >> interpreter. >> >> I develop a single style for my topo maps, but I need some possibility >> to get a small variation in style depending on region. For example I >> prefer to show landuse=farmland on a map of Africa but to remove it on a >> map of Europe. So instead of maintaining 2 nearly identical styles, I >> would like to get a conditional statement, something like: >> >> if (SHOW_FARMS) ( >> landuse=farmland [0x10f01 level 1] >> ) >> >> and then add (or not) an option to mkgmap like --style-define=SHOW_FARMS >> >> -- >> Best regards, >> Andrzej >> >> >> _______________________________________________ >> mkgmap-dev mailing list >> mkgmap-dev at lists.mkgmap.org.uk >> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev >> _______________________________________________ >> mkgmap-dev mailing list >> mkgmap-dev at lists.mkgmap.org.uk >> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev >> >> > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at lists.mkgmap.org.uk > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > -- Dave Swarthout Homer, Alaska Chiang Mai, Thailand Travel Blog at http://dswarthout.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20170208/8ffd2b60/attachment-0001.html>
- Previous message: [mkgmap-dev] To do: If-Then-Else
- Next message: [mkgmap-dev] To do: If-Then-Else
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list