Char error
Velox reports Char error when the script lexer reads a # character-code literal that has no valid decimal or hexadecimal digits. This is more specific than a general text or encoding problem.
Accepted lexical forms
The current lexer recognises a decimal character code after # and a hexadecimal code after #$:
#65 // Decimal character code
#$41 // Hexadecimal character code
A quoted value such as 'A' is tokenised as a string literal, not through this character-code path.
Example
These tokens are malformed:
Value := #; // No decimal digits
Value := #$; // No hexadecimal digits
Value := #12A; // A letter follows the decimal form
Use a quoted string or a complete numeric code:
Value := 'A';
Value := #65;
Value := #$41;
How Velox detects it
The modified PascalScript lexer scans digits following #. In the hexadecimal form, at least one 0-9, A-F or a-f digit must follow #$. In the decimal form, at least one decimal digit is required and an immediately following letter or underscore makes the token invalid. The lexer raises iCharError; the compiler converts that to ecCharError and marks the parser as having failed.
An unterminated quoted literal follows the separate string-error path. If the visible source contains quotes rather than #, inspect the exact diagnostic before applying this page.
Common causes
- Leaving a bare
#or#$while editing a literal. - Using a hexadecimal letter without the
$marker, such as#A. - Appending an identifier directly to a decimal code without an operator or delimiter.
- Copying a character-escape convention from another language, such as
\x41or\u0041. - Assuming the diagnostic validates whether a numeric code is meaningful for every downstream encoding. It validates the token form; later conversions still follow the target string/type rules.
Correction procedure
- Inspect the token beginning with
#at or immediately before the reported position. - Supply decimal digits, or use
#$followed by hexadecimal digits. - Add an operator or separator before any following identifier.
- Prefer a quoted string when the intended value is ordinary readable text.
- Recompile before investigating later parser messages, because this is a lexer-level failure.
Related reference
String error— malformed or unterminated quoted text.String— text operators and runtime representation.Syntax error— invalid tokens that do not use the character-specific path.
External references
Both upstream pages describe # character-code syntax. Their character widths, accepted ranges and later string conversions do not override the Velox lexer rules documented above.