Skip to content

Commit 3bf7730

Browse files
committed
Move back to the Trie
The graph did work out for a very limited set of match expressions, but to handle them all you really need a NFA. So, admit to that and let word based opcodes be handled by the simple mechanism of a trie and only the complicated stuff by using a regexp engine
1 parent 6382c29 commit 3bf7730

File tree

2 files changed

+7
-565
lines changed

2 files changed

+7
-565
lines changed

src/translator.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use std::collections::{HashMap, HashSet};
22

3-
use graph::Graph;
3+
use trie::Trie;
44

55
use crate::parser::{AnchoredRule, Attribute, Braille, Direction, Rule, dots_to_unicode, fallback};
66

7-
use self::graph::Boundary;
7+
use self::trie::Boundary;
88

99
mod boundaries;
10-
mod graph;
1110
mod match_pattern;
1211
mod nfa;
1312
mod trie;
@@ -163,7 +162,7 @@ pub struct TranslationTable {
163162
undefined: Option<String>,
164163
character_definitions: CharacterDefinition,
165164
character_attributes: CharacterAttributes,
166-
translations: Graph,
165+
translations: Trie,
167166
direction: Direction,
168167
}
169168

@@ -175,7 +174,7 @@ impl TranslationTable {
175174
let mut undefined = None;
176175
let mut character_definitions = CharacterDefinition::new();
177176
let mut character_attributes = CharacterAttributes::new();
178-
let mut translations = Graph::new();
177+
let mut translations = Trie::new();
179178

180179
let rules: Vec<AnchoredRule> = rules
181180
.into_iter()
@@ -714,6 +713,7 @@ mod tests {
714713
assert_eq!(display_table.translate(&table.translate("a a")), "A A");
715714
}
716715

716+
#[ignore = "not yet implemented"]
717717
#[test]
718718
fn match_test() {
719719
let rules = vec![
@@ -730,6 +730,7 @@ mod tests {
730730
assert_eq!(table.translate("afoob"), "⠁⠉⠂");
731731
}
732732

733+
#[ignore = "not yet implemented"]
733734
#[test]
734735
fn match_with_any_test() {
735736
let rules = vec![
@@ -747,6 +748,7 @@ mod tests {
747748
assert_eq!(table.translate("ffoob"), "⠄⠉⠂");
748749
}
749750

751+
#[ignore = "not yet implemented"]
750752
#[test]
751753
fn match_with_set_test() {
752754
let rules = vec![

0 commit comments

Comments
 (0)