Comma (',') expected
Velox reports this error when a supported comma-separated list contains another item but the parser cannot find the , that must separate it from the preceding item. The current compiler emits this diagnostic for routine or indexed-property arguments, label declaration names and host-registered attribute arguments.
Example
procedure ScriptEvent(var Value: Variant);
begin
Value := Copy('ABCDE' 2, 3); // Error: Comma (',') expected
end;
Separate each argument:
Value := Copy('ABCDE', 2, 3);
Label declarations use a comma between names:
procedure ScriptEvent(var Value: Variant);
label
StartLabel EndLabel; // Error: Comma (',') expected
begin
StartLabel:
Value := 'start';
EndLabel:
Value := 'end';
end;
Separate the names and define both declared labels:
procedure ScriptEvent(var Value: Variant);
label
StartLabel, EndLabel;
begin
StartLabel:
Value := 'start';
EndLabel:
Value := 'end';
end;
Ordinary variable declarations can also contain comma-separated names, but their parser commonly reports Colon (':') expected rather than this diagnostic when the comma is omitted.
How Velox detects it
The modified PascalScript compiler has three ecCommaExpected emission families:
- actual routine-call or indexed-property arguments parsed by
ReadParameters; - multiple names in a
labeldeclaration; and - values in an attribute argument list, if the host has registered that attribute type.
The current Velox host does not register attribute types, so the third family is not normally reachable in standard scripts. Formal parameter declarations, ordinary variable-name groups and array/set syntax use other parser checks and may report a different expected token.
The reported row and column identify the token found instead of the comma. If the preceding expression is malformed, that token may be well after the actual mistake. For example, an unclosed nested call can make a valid comma belong to the wrong nesting level.
Correction procedure
- Identify whether the location belongs to a call/property argument list or a
labeldeclaration. - Check that the preceding item is complete, including its nested parentheses or brackets.
- Insert a comma between peer items at the same nesting level.
- Do not use a comma where a formal parameter group requires a semicolon, or where a declaration requires a colon.
- Recompile after fixing the earliest list error.
Common causes
- Omitting a separator between function arguments.
- Using whitespace as a separator between label names.
- Confusing the comma between call arguments with the semicolon used between formal parameter groups.
- Missing a closing parenthesis or bracket in the previous item.
- Leaving an incomplete expression before the next list value.
Related reference
Closing parenthesis expected— balancing a call or expression before interpreting its commas.Colon (':') expected— the likely diagnostic for a malformed ordinary declaration name list.Semicolon (';') expected— statement and formal parameter-group separation.