daisy / daisy/MathCAT

Suggestion: Small improvement to MathCAT's range handling in unicode files

Open
#590 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
114
Forks
85
Avg merge
1d 11h
Merged PRs (30d)
42

Description

When reading rule files, MathCAT supports ranges. For example
```
- "๐—ฎ-๐˜‡": # 0x1d5ee - 0x1d607
- test:
if: "not($IgnoreBold)"
then: [t: "bold"]
- spell: "translate('.', '๐—ฎ๐—ฏ๐—ฐ๐—ฑ๐—ฒ๐—ณ๐—ด๐—ต๐—ถ๐—ท๐—ธ๐—น๐—บ๐—ป๐—ผ๐—ฝ๐—พ๐—ฟ๐˜€๐˜๐˜‚๐˜ƒ๐˜„๐˜…๐˜†๐˜‡', 'abcdefghijklmnopqrstuvwxyz')"

```

This gets rewritten to 26 rules for each letter, with "." replaced by the letter. When there is a translate, an optimization is to avoid the translate so that you end up with something like
```
- "๐—ฎ": # 0x1d5ee - 0x1d607
- test:
if: "not($IgnoreBold)"
then: [t: "bold"]
- spell: "a"
```

However, in some cases such as in braille, we need to invoke the rule for "a". There is a hack in tts.rs that deals with the recursion and uses spell. Any change would need to make sure that still triggers after this change.

This is a minor optimization that probably doesn't result in a noticeable speedup. Still, it is kind of silly to call translate on a constant.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.