Property statement in ST

Syntax
{
name_1 := 'string_1',
name_2 := 'string_2',
name_3 := 'string_3',
...
name_n := 'string_n'
};

Meaning

a property statement in order to specify e.g. requirements within the ST-code

Implementer-specific realization

According to the →IEC-standard, this property statement is an i mplementer-specific realization of a →pragma.

Property statements can be inserted where other statements are possible as well.
Example: You are able to insert the property statements after the declaration of variables. In this case, the message Missing IEC-keyword or IEC-identifier is displayed. As workaround, insert an empty statement before the property statements (see the following example).

Observe that the property statements are transferred to the generated code as comment.

Syntax:

  • The name on the left side of the assignment operator ":=" must be an →IEC-identifier.

  • The expression on the right side of the assignment operator ":=" must be a character string literal within a →pragma.

    Examples for character string literals within pragmas

    Character string literals in pragmas consist of zero or more characters prefixed and terminated by the single quote character ' or by the double quote character ".

    Description

    Examples

    literal with single quote

    '' (empty literal), 'OK', 'ABCDEF', 'B', ' ' (only a blank within the literal)

    literal with double quote

    "" (empty literal), "OK", "ABCDEF", "B", " " (only a blank within the literal)

    You are able to directly enter special characters, such as umlauts or €, but $ excepted, within the literal in ' as well as in ".
    As alternative, you are able to enter the special characters as a three-character combination of the dollar sign ($) followed by two hexadecimal digits. This is analogous to the input within character string literals.

    Examples:

    • Instead of "Änderung" or 'Änderung', you are able to enter "$C4nderung" or '$C4nderung'.

    • Instead of "€300" or '€300', you are able to enter "$80300" or '$80300'.

    See the glossary article "→Character string literal" for more examples on these combinations and informative links.

    Moreover, the following specifications are possible for character string literals in pragmas:

    Specification

    Meaning

    Example

    '$''

    in ': literal with single quote character '

    'This is $'just$' a test.'

    '$"'

    in ': literal with double quote character "

    'This is $"just$" a test.'

    '"'

    in ': literal with double quote character "

    'This is "just" a test.'

    "'"

    in ": literal with single quote character '

    "This is 'just' a test."

    """"

    in ": literal with double quote character "

    "This is ""just"" a test."

    "$""

    in ": literal with double quote character "

    "This is $"just$" a test."

    "$'"

    in ": literal with single quote character '

    "This is $'just$' a test."

    Moreover, the following specifications are possible for character string literals in ' as well as in ":

    Specification

    Meaning

    $$

    literal with dollar sign $

    $L or $l

    literal with line feed

    $N or $n

    literal with newline

    $P or $p

    literal with form feed (page)

    $R or $r

    literal with carriage return

    $T or $t

    literal with tabulator

    $0A

    literal as a three-character combination of the dollar sign ($) followed by two hexadecimal digit (e.g. for special characters – as mentioned above)

Example
FUNCTION_BLOCK ExamplePropertyStatementDocumentation
VAR
var1, var2 : BOOL;
END_VAR
; (* the empty statement as workaround *)
{
REQ := 'JIRA-2740'
};
var1 := TRUE;
var2 := var1;
END_FUNCTION_BLOCK