MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Whitespace characters in element names
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Whitespace characters in element names

 Post Reply Post Reply
Author
Message
stefanvw View Drop Down
Member
Member


Joined: 04.Jul.2008
Location: Munich, Germany
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefanvw Quote  Post ReplyReply Direct Link To This Post Topic: Whitespace characters in element names
    Posted: 10.Jul.2008 at 18:17
Hej,

in my state machine using the WatchApplication DSL I have names with whitespaces and dot-characters. This causes problems for compilation of the generated c files. Is it possible to replace these characters in the generator on the fly by underscore characters?
I would not like using the oid property, because it would impair the readability of the generated code.

Thanks in advance!
Stefan
Back to Top
janne View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote janne Quote  Post ReplyReply Direct Link To This Post Posted: 11.Jul.2008 at 09:26
Yes, translators can be used for that.

In the generator script you had to have call to the subreport '_translators', which initializes the predefined translators. Then you may use e.g. %var translator, which makes a legal variable name by mapping non-alphanumerics to underscore.

e.g.
subreport '_translators' run
foreach .State [Watch]
{   
   id%var newline
}


In the sample above all the State [Watch] id property values are translated to have only alphanumeric values (all other characters are replaced with underscore). Subreport '_translators' is stored in the Graph, so any DSM language can access it. In the _translator script there exists predefiened translators e.g. having upper or lower case, XML, adding and removing indentations etc.

See more details from the online manual Translating stings
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.061 seconds.