previously, dtran was a {states: int list, transitions: set} record, but because the states are the exact same as the information in dstates (at same position too), we changed dtran to contain only the transitions
This commit is contained in:
@@ -395,7 +395,7 @@ struct
|
|||||||
SOME (pos, #transitions record)
|
SOME (pos, #transitions record)
|
||||||
end
|
end
|
||||||
|
|
||||||
type dtran = {states: int list, transitions: int list Set.set}
|
type dtran = int list Set.set
|
||||||
|
|
||||||
fun convertChar
|
fun convertChar
|
||||||
(char, regex, dstates, dtran: dtran vector, curStates, curStatesIdx) =
|
(char, regex, dstates, dtran: dtran vector, curStates, curStatesIdx) =
|
||||||
@@ -427,21 +427,17 @@ struct
|
|||||||
* so we append to dtran instead *)
|
* so we append to dtran instead *)
|
||||||
let
|
let
|
||||||
val transitions = Set.insertOrReplace (char, u, Set.LEAF)
|
val transitions = Set.insertOrReplace (char, u, Set.LEAF)
|
||||||
val record =
|
|
||||||
{states = curStates, transitions = transitions}
|
|
||||||
in
|
in
|
||||||
Vector.concat [dtran, Vector.fromList [record]]
|
Vector.concat [dtran, Vector.fromList [transitions]]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* corresponding state idx does exist in dtran, so we update it *)
|
(* corresponding state idx does exist in dtran, so we update it *)
|
||||||
let
|
let
|
||||||
val {states, transitions} =
|
val transitions = Vector.sub (dtran, curStatesIdx)
|
||||||
Vector.sub (dtran, curStatesIdx)
|
|
||||||
val transitions =
|
val transitions =
|
||||||
Set.insertOrReplace (char, u, transitions)
|
Set.insertOrReplace (char, u, transitions)
|
||||||
val record = {states = states, transitions = transitions}
|
|
||||||
in
|
in
|
||||||
Vector.update (dtran, curStatesIdx, record)
|
Vector.update (dtran, curStatesIdx, transitions)
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
convertChar
|
convertChar
|
||||||
|
|||||||
Reference in New Issue
Block a user