Attention

These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.

P0031

Code

P0031

Message

Unmatched character sequence in source text

The compiler encountered an unexpected token while parsing the source text.

This error occurs when the parser encounters text that is not valid IEC 61131-3 syntax.

Example

The following code will generate error P0031:

TYPE
    CUSTOM_STRUCT : STRUCT&   (* Error: Invalid character '&' *)
        NAME: BOOL;
    END_STRUCT;
END_TYPE

The parser encountered the & character in an unexpected position where it expected valid identifier characters.

To fix this error, remove the invalid character and use valid IEC 61131-3 syntax:

TYPE
    CUSTOM_STRUCT : STRUCT   (* Correct: No invalid characters *)
        NAME: BOOL;
    END_STRUCT;
END_TYPE