rukano / emacs-faust-mode

Faust major mode for editing faust code (.dsp files)
13 stars 7 forks source link

Fix up operator fontification #10

Closed agraef closed 6 years ago

agraef commented 6 years ago

As previously discussed in #9:

At present faust-regexp-faust-operator is just a character class. As a result, syntax highlighting of operators is rather sketchy and inconsistent right now, e.g., in <= only the < is fontified but not the =. The arithmetic ops +-* are in there but not / and %. Some BDA ops are completely missing, such as @ (even @rukano's original version already had that).

To fix this, faust-regexp-faust-operator should be generated from a proper list of all operator symbols, as they appear in the Faust Quick Reference. This isn't hard to do, but the question that needs some thought and discussion is whether we should include each and every operator in there, just the BDA ops, just the multi-character (BDA) ops, or maybe don't highlight the operators at all. I'm actually leaning towards the latter option, but I don't really care much about this as long as it's consistent (which it isn't right now).

Opinions?

agraef commented 6 years ago

Or just take the cheap way out, add '@/%^|&~=! and be done with it. This covers all of the operators composed of punctuation. Which leaves us with the xor operator. This sticks out like a sore thumb anyway, since it's the only Faust operator which is an identifier, so we might just as well add it to faust-keywords-functions. That's a quick (and dirty) fix, but I think that's exactly what I'm going to do now.