Created Wed, 25 Sep 2013 00:31:36 +0000 by schneidj
Wed, 25 Sep 2013 00:31:36 +0000
It has been my observation that the entries in keywords.txt are a bit messed up. For example, open MPIDE and enter the following:
const unsigned int z = 12;
If you do this, you will observe that double is colored differently from float and const is not colored at all. That makes no sense to me. To understand what the problem is, if you look in the keywords.txt file in the current release, you see this:
# KEYWORD1 specifies datatypes and C/C++ keywords
float KEYWORD1 Float
# these are datatypes, but we've also defined functions to cast to them
float KEYWORD2 float_
I'm not sure what this switch from KEYWORD1 to KEYWORD2 is trying to convey to the user (ultimately float is displayed with KEYWORD2 highlighting/color). But, there is no similar switch for double (it is just set to KEYWORD1 in keywords.txt and left that way) and there is no entry for const (or for lots of functions that are defined in the math library). Newbies are going to find that confusing (and I find it confusing too!).
So, my question is: Is there any objection to me trying to clean things up? Is there anything notable I should be aware of that went into the current version of keywords.txt? (I'll note that the current Arduino IDE doesn't suffer this problem, but their implementation is a little brain-dead in that all three keyword styles are colored the same way.)
Wed, 25 Sep 2013 09:54:31 +0000
Please do go ahead and clean it all up. And while you're at it, maybe come up with a set of rules for what should be what kind of token - something that library writers can adhere to so there is some kind of consistency.
The whole highlighting system in use (in both MPDE and Arduino) is flawed beyond measure, but it suffices for the time being (needless to say, UECIDE does it better :P ). Ideally it should only include the highlighting for the libraries you have actually included in you sketch (tricky), and some kind of context sensitivity would be nice, so if it's a method of a class it only highlights if it's being used with an instance of said class (even harder).