Skip to content

Commit

Permalink
Merge pull request #38 from EvoEsports/regex-fix
Browse files Browse the repository at this point in the history
Update maniascript regex to match multiple whitespaces
  • Loading branch information
Braker authored Aug 19, 2023
2 parents 2bcc0f7 + 7f84961 commit 28840e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ManiaTemplates/Lib/MtTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ public class MtTransformer
private readonly Dictionary<string, string> _maniaScriptIncludes = new();
private readonly Dictionary<string, string> _maniaScriptConstants = new();
private readonly Dictionary<string, string> _maniaScriptStructs = new();
private readonly List<string> _maniaScriptGlobalVariables = new();
private int _loopDepth;

private static readonly Regex TemplateFeatureControlRegex = new(@"#>\s*<#\+");
private static readonly Regex TemplateInterpolationRegex = new(@"\{\{\s*(.+?)\s*\}\}");
private static readonly Regex JoinScriptBlocksRegex = new(@"(?s)-->.+?<!--");

private static readonly Regex ManiaScriptIncludeRegex = new(@"#Include ""(.+?)"" as ([_a-zA-Z]+)");
private static readonly Regex ManiaScriptConstantRegex = new(@"#Const ([a-zA-Z_]+) .+");
private static readonly Regex ManiaScriptStructRegex = new(@"(?s)#Struct ([_a-zA-Z]+)\s*\{.+?\}");
private static readonly Regex ManiaScriptIncludeRegex = new(@"#Include\s+""(.+?)""\s+as\s+([_a-zA-Z]+)");
private static readonly Regex ManiaScriptConstantRegex = new(@"#Const\s+([a-zA-Z_:]+)\s+.+");
private static readonly Regex ManiaScriptStructRegex = new(@"(?s)#Struct\s+([_a-zA-Z]+)\s*\{.+?\}");

private static readonly Regex ManiaScriptGlobalVariableRegex =
new(@"declare ([A-Z][a-zA-Z_\[\]]+) (\w[a-zA-Z0-9_]+);");
Expand Down

0 comments on commit 28840e6

Please sign in to comment.