-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Allow janky empty fields within double tabs in keywords.txt files #7245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
*UNTESTED* - we need to fix the outliers, not the majority. I think this solution will fix the problem with the base keywords.txt file.
There is a trivial compile error, BTW using the "human" notation there is no way to write the equivalent of:
to make the word So, almost there, but not yet... |
Are you saying that this code doesn't fix the problem? Also, there is a way to write it so that a "human" can read/work with it:
It just means that the base keywords.txt file needs to be fixed and a small fix to the parser. |
Where can I find any documentation on the intended file format of the keywords.txt file? |
I really dislike things that use magic names and especially cutesy names. So using "NONE" seems like such a hack and once magic keywords start to creep in their use will start to expand. Going another route, perhaps it is time to consider a version flexible format that fixes that file format? |
There isn't an official document, the only real document is the code of the parser. The history of the AFAIR the keywords.txt file started as a simple:
then expanded to
then expanded again to
I guess to support new kind of tokens when we introduced RSyntaxTextArea but, again, I don't know why a second type of token has been added. This is how the format is now, that's all I know. |
totally agree with that, BTW the special case for otherwise we get an error like: @bhagman |
Wow, I had no idea about the other fields in the keywords file. I would recommend slowing down a bit and not going off and coding anything yet. A drawback with having a magic word/character for blank/null fields is that no matter what it is, Using whitespace as a separator solves the readability issues which I think is the biggest complaint right now, but using whitespace as a seperator precludes having null/blank fields. Given the many different ways the file has been parsed by different versions of the IDE, I can't figure out a way that offers the ability to provide a file that looks good and works on IDE versions 1.0 to the present. |
@cmaglie Which check? I've fixed the type conversion error. If you mean implementing the dash @bperrybap This fix doesn't implement anything new. It only fixes the currently problem with the base keywords. Currently, most libraries will work with the "human" parsing of the (FYI - another update to this fix forthcoming... I think we should check for double tabs instead of singles.) |
As of right now I have not seen a way to create a keywords file that looks good AND works on all IDEs 1.0 to 1.8.5
I would say that may not be a good idea. I don't believe that there is solution to the problem. |
@bhagman This is why checking for double tabs could be an issue. |
Regarding keywords.txt backwards IDE compatibility: Almost every 3rd party library follows this format: The Arduino IDE's base keywords.txt file will only ever be used by the version of the Arduino IDE it ships with. The I'm all for backwards IDE compatibility but the scope of the problem may not be very significant. The consequences of supporting a format to be used used only by a small number of libraries which will is not supported by the keywords highlighting scheme of 1.0.x IDE versions is mild. Of more concern to me is to continue supporting the commonly used format that previously worked. Further muddying the water is that with the current system some combinations of whitespace used as separator appears to work but isn't truly supported. For example, using multiple tabs as separator does result in keywords highlighting but keywords are all colored according to keywords.txt:
|
Is there any info about the new tokentype field? Even just a link to the relevant source code? |
|
Fix for #6693 (comment)
Bottom line: need to fix the outliers, not the majority -- the base keywords.txt file is the worst offender.
https://github.com/arduino/Arduino/blob/master/build/shared/lib/keywords.txt
(N.B. code is untested)