Added unicode support
Replaced strings with rune-slices, which capture unicode codepoints more accurately.
This commit is contained in:
2
main.go
2
main.go
@@ -406,7 +406,7 @@ func main() {
|
||||
startState := thompson(re_postfix)
|
||||
// Read every string from stdin until we encounter an error. If the error isn't EOF, panic.'
|
||||
for test_str, err = reader.ReadString('\n'); err == nil; test_str, err = reader.ReadString('\n') {
|
||||
matchIndices := findAllMatches(startState, test_str)
|
||||
matchIndices := findAllMatches(startState, []rune(test_str))
|
||||
// Decompose the array of matchIndex structs into a flat unique array of ints - if matchIndex is {4,7}, flat array will contain 4,5,6
|
||||
// This should make checking O(1) instead of O(n)
|
||||
indicesToPrint := new_uniq_arr[int]()
|
||||
|
Reference in New Issue
Block a user