Skip to content

Conversation

@KANAjetzt
Copy link
Member

@KANAjetzt KANAjetzt commented Dec 22, 2024

  • Changed func\\s+%s[\\\\\\s]*\\( to \\bfunc\\b\\s+\\b%s\\b(?:.*\\n*)*?\\s*\\(
    • Comments and non top level funcs are ignored with is_top_level_func() and not handled by this regex
  • Moved the regex to the top with the other regexes
  • Added a description comment
    ## \\bfunc\\b\\s+		->	Match the word 'func' and one or more whitespace characters
    ## \\b%s\\b 			->	the function name
    ## (?:.*\\n*)*?\\s*\\( 	->	Match any character between zero and unlimited times, but be lazy
    ## 							and only do this until a '(' is found.

Tested with #476 and a smaller game via export plugin on 4.3.

closes #494

@KANAjetzt KANAjetzt added bug Something isn't working 4.x labels Dec 22, 2024
@KANAjetzt KANAjetzt added this to the 4.x - 7.0.0 milestone Dec 22, 2024
@KANAjetzt KANAjetzt requested a review from Qubus0 December 22, 2024 09:13
@KANAjetzt KANAjetzt self-assigned this Dec 22, 2024
@KANAjetzt KANAjetzt force-pushed the fix_match_func branch 2 times, most recently from b721387 to c1e7e92 Compare December 25, 2024 10:40
@Qubus0
Copy link
Collaborator

Qubus0 commented Jan 9, 2025

image

thought of another cursed but valid gdscript case

@Qubus0
Copy link
Collaborator

Qubus0 commented Jan 9, 2025

looks like we can also simplify (?:.*\n*)*? to just match everything except ( -> [^(]
\bfunc\b[^(]*?\btest\b[^(]*?\s*\( -> gds \\bfunc\\b[^(]*?\\btest\\b[^(]*?\\s*\\(

image

KANAjetzt and others added 8 commits January 9, 2025 14:30
moved the regex string to the top and added a description
and word boundary for the method name
It only handled one specific case, `#func`. Something like `# ` was still matched. To avoid giving a false impression, I removed it, and this case is now also handled by `is_top_level_func()`.
@KANAjetzt
Copy link
Member Author

"Vanilla" Source Code
image

"\\bfunc\\b\\s+\\b%s\\b(?:.*\\n*)*?\\s*\\("
image

\\bfunc\\b[^(]*?\\btest\\b[^(]*?\\s*\\(
image

@KANAjetzt KANAjetzt added this pull request to the merge queue Jan 24, 2025
Merged via the queue into GodotModding:4.x with commit 0e5dae7 Jan 24, 2025
1 check passed
@KANAjetzt KANAjetzt deleted the fix_match_func branch January 28, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants