Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/S7CommPlusDriver/S7CommPlusProtocolSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,10 @@ private void calcAccessSeqFor1DimArray(ref string symbol, PVartypeListElement va
/// <exception cref="Exception">Symbol syntax error</exception>
private void calcAccessSeqForMDimArray(ref string symbol, PVartypeListElement varType, VarInfo varInfo)
{
Regex re = new Regex(@"^\[( ?-?\d+ ?(, ?-?\d+ ?)+)\]");
// FbArray/StructMDim report IsMDim() even when only one dimension is declared, so a
// single index (for example "[1]" for Array[1..3] of FB) must be accepted here. The
// dimension count check below rejects a mismatching number of indices.
Regex re = new Regex(@"^\[( ?-?\d+ ?(, ?-?\d+ ?)*)\]");
Match m = re.Match(symbol);
if (!m.Success) throw new ArgumentException("Expected a multidimensional array index such as '[1,2]'.", nameof(symbol));
parseSymbolLevel(ref symbol); // remove index from symbol string
Expand Down
Loading