P4103

Code

P4103

Message

Trailing comma in a call’s argument list requires choosing a dialect or –allow-trailing-call-comma flag

This error occurs when a call’s argument list has a comma before the closing parenthesis without the --allow-trailing-call-comma compiler flag.

The IEC 61131-3 standard grammar (Annex B) separates arguments with commas and has none after the last one. A trailing comma is an extension.

Example

The following code will generate error P4103:

PROGRAM main
VAR
    drive : FB_Drive;
END_VAR
    drive(Enable := TRUE, );
END_PROGRAM

To fix this error, either remove the comma:

PROGRAM main
VAR
    drive : FB_Drive;
END_VAR
    drive(Enable := TRUE);
END_PROGRAM

Or enable the extension:

Pass the --allow-trailing-call-comma flag to enable it, or select a dialect that includes it. See Enabling Dialects and Features for the dialects and flags reference.

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.