Problem
Summary
STruC++ cannot parse an IEC 61131-3 structured initial value — the
( field := value, field := value, ... ) aggregate-initializer syntax used to
give a STRUCT-typed variable a default value in its declaration. The parser
reaches the first field := inside the parentheses, expects a closing ), and
aborts.
Environment
- STruC++ version: 0.6.2 (
strucpp.exe, win64)
Impact
Compilation fails during parsing
Reproduction
Steps to reproduce
udt.st:
TYPE
inner : STRUCT
a : INT;
b : INT;
END_STRUCT;
outer : STRUCT
p : inner;
q : INT;
END_STRUCT;
END_TYPE
PROGRAM PLC_PRG
VAR
s : outer := ( p := ( a := 1, b := 2 ), q := 3 );
END_VAR
s.q := s.q + 1;
END_PROGRAM
strucpp udt.st -o udt.cpp --no-default-libs
Actual result
Compilation fails during parsing:
Compilation failed:
udt.st:14:22: error: Expected `RParen`, found `:=`.
14 | s : outer := ( p := ( a := 1, b := 2 ), q := 3 );
| ^
Code Locations
No response
Fix
No response
Acceptance
STruC++ can parse an IEC 61131-3 structured initial value — the
( field := value, field := value, ... ) aggregate-initializer syntax used to
give a STRUCT-typed variable a default value in its declaration.
Problem
Summary
STruC++ cannot parse an IEC 61131-3 structured initial value — the
( field := value, field := value, ... )aggregate-initializer syntax used togive a
STRUCT-typed variable a default value in its declaration. The parserreaches the first
field :=inside the parentheses, expects a closing), andaborts.
Environment
strucpp.exe, win64)Impact
Compilation fails during parsing
Reproduction
Steps to reproduce
udt.st:Actual result
Compilation fails during parsing:
Code Locations
No response
Fix
No response
Acceptance
STruC++ can parse an IEC 61131-3 structured initial value — the
( field := value, field := value, ... )aggregate-initializer syntax used togive a
STRUCT-typed variable a default value in its declaration.