Semicolon (';') expected
Velox reports Semicolon (';') expected when the current statement, declaration or routine boundary must be terminated before the next token. The error is usually reported at that next token, so inspect the preceding construct first.
Example
procedure ScriptEvent(var Value: Variant);
var
TextValue: String;
begin
TextValue := 'first' // Error reported when the next statement is read
Value := TextValue;
end;
Separate the statements:
TextValue := 'first';
Value := TextValue;
Compiler contexts
The modified PascalScript compiler uses this diagnostic across several grammar families, including:
- adjacent statements in a block;
- variable, constant, type, class, interface and routine declarations;
- procedure/function headers and a procedure body's final
end;; usesentries and unit sections when unit syntax is enabled;- external routine declarations; and
- some record, class-member and attribute declaration boundaries.
Because one message covers all these contexts, the row and column alone do not identify which semicolon is missing.
Important else and end rules
The current statement parser does not require a separator when the next token is else or end. In an if..then..else, do not insert a semicolon immediately before else; it terminates the then statement and changes the grammar. A final statement before end can omit its semicolon, although consistent use often improves editing safety.
An inner procedure or function declaration is different: its completed body is a declaration and therefore ends with end;.
Correction procedure
- Inspect the complete statement or declaration immediately before the reported token.
- Balance its parentheses and brackets first; an unclosed expression can consume the expected separator.
- Add
;only at the real statement/declaration boundary. - Check for
else: remove a separator placed between thethenbranch and itselse. - Recompile from the earliest punctuation error because later semicolon messages can be secondary.
Edge cases and quirks
- A malformed property/member expression can sometimes fall through to this diagnostic instead of a more specific member error.
- An
externaldeclaration requires a semicolon both before theexternaldirective and after its string argument in this parser. - After that second semicolon, an unavailable external-procedure resolver also produces
Semicolon expectedeven though the punctuation is already correct. The standard Windows Velox engine installs its DLL resolver, so this misleading branch normally indicates a non-standard host or platform/configuration problem rather than a missing semicolon. - The compiler permits scripts without an outer
begin..end.wrapper, but each declared routine still follows its own semicolon rules. - This is compile-time parsing only; no earlier statement from the same script has executed.
Related reference
END expected- a block terminator is missing rather than its separator.Closing parenthesis expected- an expression remains open before the apparent boundary.'THEN' expected- the conditional header is incomplete.