Removed exclamation mark in inverted metacharacters - had the opposite effect becasue of the way deleteFunc works

master
Aadhavan Srinivasan 2 months ago
parent 1a7fd12569
commit 7b815343f4

@ -109,19 +109,19 @@ func shuntingYard(re string) []postfixNode {
outQueue = append(outQueue, newPostfixNode(whitespaceChars...))
case 'S': // Non-whitespace - I am doing this in a fancy way, generating all dot characters, then removing whitespace characters from it
outQueue = append(outQueue, newPostfixNode(slices.DeleteFunc(dotChars(), func(r rune) bool {
return !slices.Contains(whitespaceChars, r)
return slices.Contains(whitespaceChars, r)
})...))
case 'd': // Digits
outQueue = append(outQueue, newPostfixNode(digitChars...))
case 'D': // Non-digits - same fancy way as 'S'
outQueue = append(outQueue, newPostfixNode(slices.DeleteFunc(dotChars(), func(r rune) bool {
return !slices.Contains(digitChars, r)
return slices.Contains(digitChars, r)
})...))
case 'w': // word character
outQueue = append(outQueue, newPostfixNode(wordChars...))
case 'W': // Non-word character - same fancy way as 'S' and 'D'
outQueue = append(outQueue, newPostfixNode(slices.DeleteFunc(dotChars(), func(r rune) bool {
return !slices.Contains(wordChars, r)
return slices.Contains(wordChars, r)
})...))
default: // None of the above - append it as a regular character
outQueue = append(outQueue, newPostfixCharNode(re_postfix[i]))

Loading…
Cancel
Save