Skip to content

Commit 90bb383

Browse files
committed
fix(lua): simplify regexes
Matching on leading invisible characters is essentially useless.
1 parent 31c4bc4 commit 90bb383

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

source/DataStructures/Lua/Accessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class Accessor : DataStructure
88
{
99
public override Regex GetRegex()
1010
{
11-
return new Regex(@"\s*AccessorFunc\s*\((\w|,|\s)+\)");
11+
return new Regex(@"AccessorFunc\s*\((\w|,|\s)+\)");
1212
}
1313

1414
public override bool CheckMatch(string line)

source/DataStructures/Lua/CreateConVar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CreateConVar : DataStructure
1515

1616
public override Regex GetRegex()
1717
{
18-
return new Regex(@"\s*CreateConVar\s*\(.*\)");
18+
return new Regex(@"CreateConVar\s*\(.*\)");
1919
}
2020

2121
public override bool CheckMatch(string line)

source/DataStructures/Lua/Function.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Function : DataStructure
1919
public override Regex GetRegex()
2020
{
2121
// RegEx matches "@function opt.name(param, opt)" or "local function opt:name()"
22-
return new Regex(@"(^\s*(local\s+)?\s*|@)function\s*\w+((\.|\:)\w+)*\s*\((\w+\s*(,\s*\w+\s*)*)?\)");
22+
return new Regex(@"((local\s+)?|@)function\s*\w+((\.|\:)\w+)?\s*\((\s*\w+\s*(,\s*\w+\s*)*)?\)");
2323
}
2424

2525
public override bool CheckMatch(string line)

source/DataStructures/Lua/Hook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Hook : DataStructure
2727

2828
public override Regex GetRegex()
2929
{
30-
return new Regex(@"\s*hook\.(Run|Call)\s*\(.*\)"); // RegEx matches "hook.Run(" or "hook.Call("
30+
return new Regex(@"hook\.(Run|Call)\s*\(.*\)"); // RegEx matches "hook.Run(" or "hook.Call("
3131
}
3232

3333
public override bool CheckMatch(string line)

0 commit comments

Comments
 (0)