Skip to content

Commit

Permalink
Update maniascript regex to match multiple whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
araszka committed Aug 19, 2023
1 parent 4a1827f commit 7f84961
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 7f84961

Please sign in to comment.