Skip to content

Commit

Permalink
bugfix: ignore subsystems in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Achille44 committed Jan 8, 2023
1 parent 8006d8f commit 98502d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions FreeSpace2TranslationTools/Services/Regexp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public static class Regexp
private static readonly Regex _Xstr = new("XSTR\\s*\\(\\s*(\".*?\")\\s*,\\s*(-?\\d+)\\s*\\)", RegexOptions.Singleline | RegexOptions.Compiled);
public static Regex Xstr { get => _Xstr; }

// don't select entries in comment...
private static readonly Regex _NoAltNames = new(@"([^;]\$Name:[ \t]*(.*?)\r\n(?:[ \t]*\+nocreate[ \t]*\r\n)?)(((?!\$Alt Name|\+nocreate).)*?\r\n)", RegexOptions.Singleline | RegexOptions.Compiled);
// don't select entries in comment... but take into account comments between $Name and +nocreate
private static readonly Regex _NoAltNames = new(@"([^;]\$Name:[ \t]*(.*?)\r\n(?:;.*?\r\n)?(?:[ \t]*\+nocreate[ \t]*\r\n)?)(((?!\$Alt Name|\+nocreate).)*?\r\n)", RegexOptions.Singleline | RegexOptions.Compiled);
public static Regex NoAltNames { get => _NoAltNames; }

private static readonly Regex _AlternateTypes = new(@"#Alternate Types:.*?#end\r\n\r\n", RegexOptions.Singleline | RegexOptions.Compiled);
Expand Down Expand Up @@ -163,7 +163,7 @@ public static class Regexp
private static readonly Regex _ShipNames = new(@"\$Name:(.*)$", RegexOptions.Compiled | RegexOptions.Multiline);
public static Regex ShipNames { get => _ShipNames; }

private static readonly Regex _Subsystems = new(@"(\$Subsystem:[ \t]*([^\r\n]*?),[^\r\n]*?\r?\n)(.*?)(?=\$Subsystem:|$)", RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _Subsystems = new(@"(?<!;)(\$Subsystem:[ \t]*([^\r\n]*?),[^\r\n]*?\r?\n)(.*?)(?=\$Subsystem:|$)", RegexOptions.Compiled | RegexOptions.Singleline);
public static Regex Subsystems { get => _Subsystems; }

private static readonly Regex _TechDescriptions = new(@"(\+Tech Description:[ \t]*)(.*?)\r\n", RegexOptions.Compiled);
Expand Down

0 comments on commit 98502d9

Please sign in to comment.