Skip to content

Commit 7f15e40

Browse files
committed
Add some fixme comments
1 parent 2ae65f2 commit 7f15e40

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/translator/nfa.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ impl NFA {
156156

157157
/// Combine two NFAs into the concatenation of both
158158
fn add_concatenation(&mut self, r1: &Fragment, r2: &Fragment) -> Fragment {
159+
// FIXME: instead of adding an epsilon transition between the
160+
// end node of r1 and the start node of r2 we should *merge* the
161+
// two nodes as outlined in the dragon book. But for that we
162+
// need a way to find all transitions going of a certain node.
163+
// This doesn't feel very easy with the current data structure
159164
self.add_epsilon(r1.end, r2.start);
160165
Fragment {
161166
start: r1.start,
@@ -394,9 +399,11 @@ impl NFA {
394399
}
395400

396401
pub fn find_translations(&self, input: &str) -> Vec<Translation> {
397-
let mut translations =self.find_translations_from_state(self.start, input, 0, 0);
402+
let mut translations = self.find_translations_from_state(self.start, input, 0, 0);
398403
translations.sort_by(|a, b| b.weight.cmp(&a.weight));
399-
translations.dedup();
404+
// FIXME: It feels a bit smelly to have to dedup the list of translations. Maybe
405+
// there is something wrong how we traverse the NFA or even how we build it?
406+
translations.dedup();
400407
translations
401408
}
402409
}

0 commit comments

Comments
 (0)