-

ST Parser Error (various between STP0003 and STP0030): '...' expected.

This topic relates to several ST parser errors. The error numbers are shown in the table below.

The ST parser has detected a syntactical fault in an ST code construct. The code element mentioned in the error message is missing and the code position where the element is expected is underlined red in the code editor.

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

Error messageMeaning / Remedy
';' expected.
(STP0003)
Insert a semicolon completing a statement line at the end of the marked line.
'THEN' expected.
(STP0006)
A selection statement (IF or ELSIF) is not complete without the 'THEN' element.

Correct statement syntax:

IF a < b THEN c:=1;
ELSIF a=b THEN c:=2;
ELSE c:=3;
END_IF;
'END_IF' expected.
(STP0007)
An 'IF' selection statement must be closed by an 'END_IF' element. Correct statement syntax see line above.
'END_FOR' expected.
(STP0008)
A 'FOR' iteration statement must be closed by an 'END_FOR' element.
Correct statement syntax:

FOR a:=1 TO 10 BY 3 DO
   f[a] :=b;
END_FOR;
'END_CASE' expected.
(STP0009)
A 'CASE' selection statement must be closed by an 'END_CASE' element.
Correct statement syntax:

CASE f OF
   1: a:=3;
   2..5: a:=4;
   6: a:=2;
   b:=1;
ELSE a:=0;
END_CASE;
'END_REPEAT' expected.
(STP0010)
A 'REPEAT' iteration statement must be closed by an 'END_REPEAT' element.
Correct statement syntax:

REPEAT
   a := a*b;
UNTIL a <  10000
END_REPEAT;
'END_WHILE' expected.
(STP0011)
A 'WHILE' iteration statement must be closed by an 'END_WHILE' element.
Correct statement syntax:

WHILE b > 1 DO
   b:= b/2;
END_WHILE;
'(' or ':=' expected
(STP0013)
An opening parentheses operator '(', used to specify the priority of operands within a statement or an assignment statement ':=' is missing in the underlined expression.
')' expected.
(STP0015)
A closing parentheses operator ')', used to specify the priority of operands within a statement is missing in the underlined expression.
']' expected.
(STP0016)
A closing bracket is missing in the underlined FOR iteration statement. The control variable must be enclosed by brackets:

FOR a:=1 TO 10 BY 3 DO
   f[a] :=b;
END_FOR;
':=' expected.
(STP0017)
An assignment operator ':=' is missing in the underlined code line.

An assignment is the simplest ST statement type. It copies the value of the expression on the right to the variable on the left. Both the variable on the left and the value of the expression on the right must have the same data type.
'TO' expected.
(STP0018)

'DO' expected.
(STP0019)
The 'TO' or 'DO' keyword to complete a FOR iteration statement is missing.

Correct statement syntax:

FOR a:=1 TO 10 BY 3 DO
   f[a] :=b;
END_FOR;
'UNTIL' expected.
(STP0020)
The 'UNTIL' keyword to complete a REPEAT iteration statement is missing. This keyword introduces the condition for the further execution of the iteration.

Correct statement syntax:

REPEAT
   a := a*b;
UNTIL a <  10000
END_REPEAT;
'OF' expected.
(STP0021)
The 'OF' keyword is missing to complete a CASE selection statement. This keyword introduces the list of matches to be evaluated.
':' expected.
(STP0022)
A colon in a CASE list, separating the possible values from the assignment statement is missing.

Correct statement syntax:

CASE f OF
   1: a:=3;
   2..5: a:=4;
',' expected.
(STP0023)
A comma, separating the passed parameters within a function/FB call is missing.
'.' expected
(STP0028)
A dot is missing which separates the THIS keyword from the method name in an internal method call.

Correct statement syntax:
MyVar := THIS.Method1();
'(' expected
(STP0029)
A left parentheses is missing in an internal method call.

Correct statement syntax:
MyVar := THIS.Method1();

Further Info
For information on the correct ST syntax refer to the topic "ST code objects".