summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-07-21 16:20:00 +0800
committerJSDurand <mmemmew@gmail.com>2023-07-21 16:20:00 +0800
commit659c2195d2c224122cc8da813bec3af46084b61b (patch)
tree4d7fa4653ccf82521bbfadf0fab1fc914c24ab4d
parent1f010ad1aad8202828ab437ecaf1a635adda3c3f (diff)
regex: Merge the `types` array as well.
* nfa/src/default/regex.rs: Previously when merging regular expressoins, only the graphs are merged, but the `types` array stayed unchanged. This caused errors of indices being out of bounds.
-rw-r--r--nfa/src/default/regex.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/nfa/src/default/regex.rs b/nfa/src/default/regex.rs
index 9b5fab1..8185ca5 100644
--- a/nfa/src/default/regex.rs
+++ b/nfa/src/default/regex.rs
@@ -558,6 +558,8 @@ impl<T: GraphLabel> DefaultRegex<T> {
builder_mut.append(other.graph);
+ self.types.extend(other.types);
+
if let Some(root) = self.root {
// Deliberately ignore errors here.
let _ = builder_mut.add_edge(root, old_len, ());