Skip to content

Commit f4c93dc

Browse files
committed
Give precedence to the litdigit rules
So they are evaluated before the digit rules. No idea why that would be so.
1 parent 8c3f3db commit f4c93dc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/translator.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,23 @@ impl TranslationTable {
202202
.filter(|r| r.rule.is_direction(direction))
203203
.collect();
204204

205+
// FIXME: For some unknown reason the litdigit rule seems to have precedence over the digit
206+
// rule. Since they both want to define digits in the same character_definitions slot we
207+
// need to make sure litdigits rules are handled before digit rules
208+
for rule in rules.iter().filter(|r| matches!(r.rule, Rule::Litdigit { .. })) {
209+
match &rule.rule {
210+
Rule::Litdigit {
211+
character, dots, ..
212+
} => {
213+
let translation =
214+
Translation::new(character.to_string(), dots_to_unicode(dots), 1);
215+
character_definitions.insert(*character, translation);
216+
character_attributes.insert(Attribute::Digit, *character);
217+
}
218+
_ => (),
219+
}
220+
}
221+
205222
// The compilation is done in two passes: The first pass simply collects all character
206223
// definitions and character attributes, so that they are then known in a second pass, e.g.
207224
// for implicit braille definitions or for the `base` opcode

0 commit comments

Comments
 (0)