Mapping properties |
Post Reply |
Author | |
Tinhinane
Member Joined: 16.Mar.2018 Points: 4 |
Post Options
Thanks(0)
Posted: 02.May.2018 at 20:32 |
Hello,
I am using MetaEdit+ to describe a small language for automation. What I want to do is to map my objects states with signal states; meaning say a Switch object with property 'state' (fixed list) [Pressed, Released], I want to map that with [1, 0]. Is there a way to add that on top of my language? |
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
DSM is about raising the level of abstraction, so the default answer would be that the language should be human-readable - just Pressed/Released - and the generator should be responsible for mapping that to 1/0.
With just two values, you can simply say "if :state='Pressed' then '1' else '0' endif". If there were more values, I often like to put the mapping as a translator rather than logic:
If some strings on the left-hand side of the translator are substrings of later strings, either re-order or switch to using more precise regular expressions like /^Pressed$/.
|
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |