From 2a4d607d96ae77c90f14af9006215301d799e11f Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 9 May 2020 19:53:47 +0100 Subject: [PATCH] Remove support for escape characters from glob patterns I thought it'd be nice to ensure we could represent any character in the patterns. However, this isn't required (as the client only uses alphabetical class, method and field names). Furthermore, the period character is already unusable in class names due to the MemberRef string parsing. Signed-off-by: Graham --- asm/src/main/java/dev/openrs2/asm/filter/Glob.kt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/asm/src/main/java/dev/openrs2/asm/filter/Glob.kt b/asm/src/main/java/dev/openrs2/asm/filter/Glob.kt index 076f3fcefe..3001347494 100644 --- a/asm/src/main/java/dev/openrs2/asm/filter/Glob.kt +++ b/asm/src/main/java/dev/openrs2/asm/filter/Glob.kt @@ -12,11 +12,8 @@ object Glob { private fun compile(pattern: String, className: Boolean): Regex { val regex = StringBuilder() var star = false - var escape = false for (ch in pattern) { - check(!star || !escape) - if (star) { star = false @@ -26,9 +23,6 @@ object Glob { } regex.append("[^/]*") - } else if (escape) { - regex.append(Regex.escape(ch.toString())) - continue } when (ch) { @@ -37,7 +31,6 @@ object Glob { } else { regex.append(".*") } - '\\' -> escape = true else -> regex.append(Regex.escape(ch.toString())) } } @@ -46,10 +39,6 @@ object Glob { regex.append(".*") } - require(!escape) { - "Unterminated escape sequence" - } - return Regex(regex.toString()) } }