dictation-toolbox / Caster

Dragonfly-Based Voice Programming and Accessibility Toolkit
https://dictation-toolbox.github.io/Caster/
Other
340 stars 121 forks source link

Issue 770 #904

Closed synkarius closed 3 years ago

synkarius commented 3 years ago

fix words.txt transformer bug

Description

The words.txt transformer had some logic built into it which was intended to protect the user from accidentally altering required extras. That logic prevented users from doing any replacements with extras in them. This change fixes that while still protecting users against altering required extras.

How Has This Been Tested

Unit tests are included. I also tested it manually.

Types of changes

Checklist

Maintainer/Reviewer Checklist

LexiconCode commented 3 years ago

Tested with the following commands. Everything functions as expected.

peek [<big>] format -> [<big>] my test
spark [<nnavi500>] [(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]] -> ghost [<nnavi500>] [(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]]
(tell | tau) <semi> -> my you <semi>
(tell | tau) <semi> -> my you
Illegal spec modification: cannot alter required extras. Cannot modify semi in "(tell | tau) <semi>".

My only improvement here would be to make sure the extra stands out in the error message. Cannot modify <semi> in "(tell | tau) <semi>".

May not be worth it's time to distinguish between in the error messages removing an extra and modifying an extra that's required.

@synkarius Let me know when you're ready and it can be merged.

synkarius commented 3 years ago

@LexiconCode I fixed those error messages as you suggested. It's ready to go.