Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P0034¶
- Code
P0034
- Message
Element is not permitted at this compiler state
This error occurs when an element appears in a context where it is not permitted according to the current compiler state or parsing context.
Example¶
This error typically occurs when language elements are used in inappropriate contexts, such as:
Using statements outside of executable sections
Declaring variables in inappropriate sections
Using keywords in wrong contexts
TYPE
DataStruct : STRUCT
Field1 : BOOL;
SomeVariable := SomeVariable + 1; (* Error: Statement not allowed in struct *)
END_STRUCT;
END_TYPE
The assignment statement SomeVariable := SomeVariable + 1
is not permitted inside a structure declaration.
To fix this error, ensure elements are used in their appropriate contexts:
TYPE
DataStruct : STRUCT
Field1 : BOOL;
Field2 : INT; (* Correct: Only declarations in struct *)
END_STRUCT;
END_TYPE