Suggestion: Small improvement to MathCAT's range handling in unicode files
- 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.