Improved Loop patterns

This commit is contained in:
bigguy345 committed 2026-03-11 08:39:23 +02:00
1 parent 627b973175
commit a00dbf4b1a
1 file changed
+2 -2
@@ -12,9 +12,9 @@ import java.util.regex.Pattern;
class LoopVariableParser {
private static final Pattern ENHANCED_FOR = Pattern.compile(
"\\bfor\\s*\\(\\s*([A-Za-z_][\\w.<>,\\[\\] \\t]*?(?:\\[\\s*\\])*)\\s+(\\w+)\\s*:\\s*([^)]+)\\)");
"\\bfor\\s*\\(\\s*([A-Za-z_][\\w.<>,\\[\\] \\t\\n\\r]*?(?:\\[\\s*\\])*)\\s+(\\w+)\\s*:\\s*([^)]+)\\)");
private static final Pattern CLASSIC_FOR = Pattern.compile(
"\\bfor\\s*\\(\\s*([A-Za-z_][\\w.<>,\\[\\] \\t]*?(?:\\[\\s*\\])*)\\s+(\\w+)\\s*=");
"\\bfor\\s*\\(\\s*([A-Za-z_][\\w.<>,\\[\\] \\t\\n\\r]*?(?:\\[\\s*\\])*)\\s+(\\w+)\\s*=");
private static final Pattern FOR_IN = Pattern.compile(
"\\bfor\\s*\\(\\s*(?:var|let|const)\\s+(\\w+)\\s+in\\s+([^)]+)\\)");
private static final Pattern FOR_OF = Pattern.compile(