Skip to content

Commit

Permalink
fix: 🐛 match space before (
Browse files Browse the repository at this point in the history
and word boundary for the method name
  • Loading branch information
KANAjetzt committed Dec 25, 2024
1 parent f76426b commit c1e7e92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addons/mod_loader/internal/mod_hook_preprocessor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const MOD_LOADER_HOOKS_START_STRING := \
"\n# ModLoader Hooks - The following code has been automatically added by the Godot Mod Loader."

## (?<!#) -> Ingore matches if 'func' is preceded by a '#'
## \bfunc\\s+ -> Match the word 'func' and one or more whitespace characters
## %s -> the function name
## (?:.*\\n*)*?\\( -> Match any character between zero and unlimited times, but be lazy
## \\bfunc\\s+ -> Match the word 'func' and one or more whitespace characters
## \\b%s -> the function name
## (?:.*\\n*)*?\\s*\\( -> Match any character between zero and unlimited times, but be lazy
## and only do this until a '(' is found.
const REGEX_MATCH_FUNC_WITH_WHITESPACE := "(?<!#)\\bfunc\\s+%s(?:.*\\n*)*?\\("
const REGEX_MATCH_FUNC_WITH_WHITESPACE := "(?<!#)\\bfunc\\s+\\b%s(?:.*\\n*)*?\\s*\\("

## finds function names used as setters and getters (excluding inline definitions)
## group 2 and 4 contain the xetter names
Expand Down

0 comments on commit c1e7e92

Please sign in to comment.