Syntax error
Syntax error is the compiler's broad fallback when the current token sequence matches no supported Velox PascalScript grammar and no more specific expected-token diagnostic applies. Fix the earliest error in the output; this message often reflects a parser that has already lost the intended structure.
Exact string-token example
Two complete quoted strings are not implicitly concatenated:
procedure ScriptEvent(var Value: Variant);
begin
Value := 'Velox' ' scripting'; // Error: Syntax error
end;
Use the string operator or one literal:
Value := 'Velox' + ' scripting';
Current emission families
The modified compiler emits ecSyntaxError from these principal paths:
- the string reader encounters one string token immediately after another;
- the runtime-expression factor reader receives a token that cannot start a value, identifier, supported unary construct or parenthesised expression;
- the constant-expression factor reader receives an unsupported starting token; and
- the lexer reports its generic
iSyntaxErrorparser-error kind.
More specific lexer failures are mapped separately: unterminated comments become Comment error, unterminated strings become String error, and malformed # character codes become Char error.
Diagnostic procedure
- Fix any earlier diagnostic before this one.
- Inspect the token at the reported row and the complete expression or declaration immediately before it.
- Check missing operators, assignment tokens, delimiters and reserved keywords.
- Compare the construct with a working Velox Scripting Guide example, not with an arbitrary modern Delphi feature.
- Reduce a copy to the smallest failing expression when the grammar remains unclear.
Edge cases and quirks
- Velox embeds a modified PascalScript compiler, not the current full Delphi language. Valid Delphi syntax can still be unsupported here.
- The compiler may report the token where parsing became impossible, not where the original omission occurred.
'Don''t'is one valid string token containing an apostrophe;'Don' 't'is two tokens and reaches the adjacent-string syntax error.- A generic syntax error has no runtime side effect because compilation does not complete.
Related reference
String error- a string token is unclosed rather than adjacent.Identifier expected- the grammar knows specifically that a name is required.Internal error- an implementation failure, not an ordinary unsupported token sequence.Scripting- supported language scope and compilation pipeline.