String error
Velox reports String error when its lexer starts a single-quoted string and reaches a carriage return, line feed or end of source before a closing apostrophe. String literals cannot span physical source lines.
Example
procedure ScriptEvent(var Value: Variant);
begin
Value := 'Unclosed text; // Error: String error
end;
Close the literal on the same line:
Value := 'Closed text';
Represent an apostrophe by doubling it:
Value := 'Cameron''s mapping';
How Velox detects it
The modified PascalScript lexer scans from the opening ' until it finds an unpaired closing '. Two adjacent apostrophes inside the token are treated as one embedded apostrophe and scanning continues. If the scan instead reaches #13, #10 or the terminating null character, it returns a string token and raises parser error kind iStringError; the compiler converts that to ecStringError.
Because the malformed text is still tokenised as a string for recovery, later diagnostics can be secondary consequences of the missing delimiter.
Correction procedure
- Start at the reported line and find the unmatched opening apostrophe.
- Add its closing apostrophe before the physical line ending.
- Double any apostrophe that belongs inside the text.
- Use
+and explicit line-break character values when constructing multi-line text; do not place a literal newline inside one quoted token. - Recompile and reassess later errors only after this lexer error is gone.
Edge cases and quirks
- A backslash does not escape an apostrophe in Velox Pascal syntax.
- An empty string is
''and is valid. - Two separate quoted strings divided by whitespace are not implicit concatenation in this compiler; they reach the separate
Syntax errorpath. - The lexer operates on source characters before runtime encoding or Variant conversion. This error says nothing about the eventual string's code page or destination encoding.
Related reference
Syntax error- adjacent complete quoted-string tokens without an operator.Char error- malformed#numeric character-code syntax.String Expected- a grammar position requires a string token but receives another valid token.