The Action Script language comes with a syntax scheme as explained below. Also, the reserved keywords of the Action Script language cannot be used as variable names.
When writing action scripts, you should respect the following explanations regarding
Syntax Scheme
The following syntax scheme applies to the action script language.
Topic
Description
Examples
Names
All object and attribute names in Action Scripts must follow the syntax below:
[a-zA-Z]([a-zA-Z0-9])*
However, UML names are not restricted and may contain any character. To use these names in Action Scripts apply backticks as follows:
If the name of an element contains other characters, it must be escaped by backticks as follows:
`invalid name`
Consequently, the only characters not allowed in element names that are to be used in action scripts are backticks (`).
If the invalid attribute name is given by an external representation, e.g. it has to be serialized into an XML document, flat file, IDocs or such, you can also use the attribute externalName on attributes to hold the external name. This way, you can use a valid name internally. Once the data is serialized, the external name will be used.
Some escaping examples:
Element
Name
Usage With Escaping
Class attribute
strange name having blanks and dots: ...
object.`strange name having blanks and dots: ...`;
Class attribute
a-b
object.`a-b`;
Operation
::my strange operation name::
object.`::my strange operation name::`();
Parameter
äparam
set `äparam` = "test";
Object
a//b
create `a//b`;
17_name
create `17_name`;
Case Sensitivity
All operations, statements, variable names, class names, and attribute names are case sensitive.
The variables myVar and myvar are two different variables.
The xUML Compiler will not recognize an assignment statement Set. you need to write set in lowercase instead.
Scripting Style
Operations can be scripted in an object-oriented or a procedural syntax style. The differences are shown in the example table on the right.
Object-Oriented Style
Procedural Style
myVariable.exists();
exists(myVariable);
myDataItem.myAttr.exists();
exists(myDataItem.myAttr);
s.substring(0, 5);
substring(s, 0, 5);
set aString = s.substring(0, 5).toUpper();
set aString = toUpper(substring(s, 0, 5));
Reserved Keywords
The following keywords should not be used as variable names as they are reserved for action script execution: