m-ender / retina

A regex-based programming language.
MIT License
231 stars 10 forks source link

Add more character classes to Transliterate mode #27

Closed m-ender closed 8 years ago

m-ender commented 9 years ago

Transliterate mode currently only supports d and w. More classes might be useful, e.g.

Maybe also things like the Base-64 alphabet. I'm taking suggestions in the comments of this issue.

m-ender commented 9 years ago

It might be useful to have a character class which inserts the other set. Maybe even one which reverses the other set. This would make it much shorter to rotate nontrivial character sets:

T`!"$%^&*()_`_!"$%^&*()

would be become

T`!"$%^&*()_`_i

(If i inserts the other set.)

And likewise, these two would be equivalent:

T`!"$%^&*()_`"$%^&*()_!
T`!i`"$%^&*()_!

Using i in both of them would obviously be an error.

m-ender commented 8 years ago

As suggested on PPCG it might be good to have a character which reverses the following class. If r was that character,

rd

would expand to

9876543210
m-ender commented 8 years ago

I've added hex digits, letters and printable ASCII classes in 154dfafce47a91a4e4511178a42dc4c2f8e8127c. Vowels and consonants will have to wait until I have evidence that they are commonly useful as character classes. i and r as defined above are still planned.

m-ender commented 8 years ago

Another suggestion for a class was [:punct:] which would be all of printable ASCII except alphanumerics and spaces.

m-ender commented 8 years ago

After rewriting how T-mode is parsed, I've added the reversal suggestion in 9ba6d0527b60171c1276cff8a7c09ba113259245. However, I used R instead of r, because r can't be escaped.

All that's left now is the class referencing the other set.

m-ender commented 8 years ago

And now (as of 1cd093ad1957d64f570a7f7a06c409aa61fa2441)we also have o which inserts the other set the first time it is used (afterwards it's a literal o). If o is used in both sets, they both become literal os because recursive insertion doesn't make much sense. That closes this issue. If vowels, consonants, punctuation etc turn out to be useful after all, they'll have to go into new issues.