-

Data Types Parser Error (various between DTP0003 and DTP0024): '...' expected.

This topic relates to various data parser errors. The error IDs are mentioned in the table.

The data types parser detected a syntactical fault in a declaration construct. The element mentioned in the error message is missing and the declaration position where the element is expected is underlined red in the editor.

The following declaration elements can be demanded in the error message:

Error messageMeaning / Remedy
';' expected.
(DTP0003)
Insert a semicolon completing a declaration at the end of the marked line.
',' expected.
(DTP00018)
In the element list of an enumeration, the contained elements must be separated by a comma. The affected declaration is underlined in the editor.
':' expected.
(DTP0005)
Insert a colon before the underlined base data type or, in case of an enumeration, before the parentheses with the element list.
':=' expected.
(DTP0024)
An assignment operator ':=' is missing in the underlined declaration line.

The ':=' operator is used to assign an initial value to data types. Make sure that the data types on both sides of the operator are matching. In the example shown below, two initial values are assigned: first, the enumeration INT element Blue is initialized with the value 5, and then the default enumeration value Red is set (MyEnum is initialized with Red).

Example:

')', ':=' or ',' expected.
(DTP0021)
One of operators ')', ':=' or ',' is missing in the underlined declaration line.
'OF' expected.
(DTP0011)
The keyword 'OF' is missing in the underlined declaration line.

The 'OF' operator is used to specify the elementary data type in user-defined data types. In the example below, 'OF' introduces the INT data type which is taken as basis for the elements of MyEnum.

Example:

'OF' or ':=' expected.
(DTP0008)
The keyword 'OF' or an assignment operator ':=' is missing in the underlined declaration line.
'(' expected.
(DTP0017)

')' expected.
(DTP0009)
An opening or closing parentheses, which is used to specify the elements of an enumeration data type, is missing in the underlined declaration line.
'[' expected.
(DTP0014)

']' expected.
(DTP0012)
An opening or closing bracket, which is used to specify ARRAY dimensions or the length of user-defined strings, is missing in the underlined declaration line.
'(', 'ARRAY', 'STRUCT' or 'STRING' expected.
(DTP0006)
In the declaration of user-defined data types, the base type (array, struct, etc.) must be defined to derive the user-defined data type. This base type or an opening parentheses is missing in the affected declaration.

Example (STRUCT must be entered after MyStruct :)

'END_TYPE' expected.
(DTP0007)
User-defined declarations must be entered in so-called declaration blocks, each block enclosed by the IEC declaration keywords TYPE and END_TYPE.

Correct statement syntax:

TYPE
   (* declarations here *)
END_TYPE
'END_STRUCT' expected.
(DTP0015)
STRUCT data types must be declared using the IEC declaration keywords STRUCT and END_STRUCT.

Further Info
For information on user-defined data types and how to declare them refer to the chapter "User-defined data types".