handle edge case when building dfa from a string, where an exception was raised when our search regex contains an alternation where the second alternation is a substring of the first alternation, and add a test for it to make sure that it passes
This commit is contained in:
@@ -729,13 +729,21 @@ struct
|
||||
in
|
||||
Vector.concat [dtran, el]
|
||||
end
|
||||
else
|
||||
else if dStateIdx < Vector.length dtran then
|
||||
let
|
||||
val el = Vector.sub (dtran, dStateIdx)
|
||||
val el = Set.insertOrReplace (char, toStateIdx, el)
|
||||
in
|
||||
Vector.update (dtran, dStateIdx, el)
|
||||
end
|
||||
else
|
||||
let
|
||||
val appendLength = dStateIdx - Vector.length dtran
|
||||
val appendVecs = Vector.tabulate (appendLength, fn _ => Set.LEAF)
|
||||
val dtran = Vector.concat [dtran, appendVecs]
|
||||
in
|
||||
insert (dStateIdx, char, toStateIdx, dtran)
|
||||
end
|
||||
end
|
||||
|
||||
fun convertChar
|
||||
|
||||
Reference in New Issue
Block a user