From 992c5a9300ca605ae447b019b1e210ccc46b7333 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 20 Nov 2024 00:24:43 -0500 Subject: [PATCH] Replaced isAlphaNum() with isNormalChar(), which returns true if the character isn't special (also returns true for unicode characters, which the previous function didn't --- misc.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc.go b/misc.go index 20443a7..5028a80 100644 --- a/misc.go +++ b/misc.go @@ -2,7 +2,6 @@ package main import ( "slices" - "unicode" ) var whitespaceChars = []rune{' ', '\t', '\n'} @@ -33,8 +32,10 @@ func isWordBoundary(str []rune, idx int) bool { return wbounded } -func isAlphaNum(c rune) bool { - return unicode.IsLetter(c) || unicode.IsNumber(c) +func isNormalChar(c rune) bool { + specialChars := []rune(`?*\^${}()+|[].~`) + specialChars = append(specialChars, LBRACKET, RBRACKET) + return !slices.Contains(specialChars, c) } func assert(cond bool) {