Skip to content

Commit 9ab84a1

Browse files
Update regex to only detect section starts in eds file when they are the start of the line eg ^[ not [ this allows names to use the [ character freely, fixes #50
Also if eds contains no comments section, don't try to parse it but just init a empty one
1 parent 742f096 commit 9ab84a1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎libEDSsharp/eds.cs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ public void parseline(string linex)
10621062

10631063
//extract sections
10641064
{
1065-
string pat = @"\[([a-z0-9]+)\]";
1065+
string pat = @"^\[([a-z0-9]+)\]";
10661066

10671067
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
10681068
Match m = r.Match(line);
@@ -1075,7 +1075,7 @@ public void parseline(string linex)
10751075

10761076
//extract keyvalues
10771077
{
1078-
string pat = @"([a-z0-9_]+)=(.*)";
1078+
string pat = @"^([a-z0-9_]+)=(.*)";
10791079

10801080
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
10811081
Match m = r.Match(line);
@@ -1203,7 +1203,10 @@ public void loadfile(string filename)
12031203
md = new MandatoryObjects(eds["MandatoryObjects"]);
12041204
oo = new OptionalObjects(eds["OptionalObjects"]);
12051205
mo = new ManufacturerObjects(eds["ManufacturerObjects"]);
1206-
c = new Comments(eds["Comments"]);
1206+
c = new Comments();
1207+
1208+
if (eds.ContainsKey("Comments"))
1209+
c.parse(eds["Comments"]);
12071210

12081211
updatePDOcount();
12091212
}

0 commit comments

Comments
 (0)