itsanjan / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

difference between KEYWORD1 and KEYWORD2 when parsing keywords.txt #546

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a library, and create keywords.txt
2. Create keywords of type KEYWORD1 and KEYWORD2
3. for keyword of type KEYWORD1, use more than one tab between the keyword and 
KEYWORD1
4. do the same (use more than one tab) for keywords of type KEYWORD2
5. Load the IDE, import the library, and test the highlighting functionality 
for your library
6. notice that KEYWORD2 keywords get highlighted, but KEYWORD1 keyword doesn't
7. modify keywords.txt so that the KEYWORD1 keyword only has a single tab, 
leave the KEYWORD2 keywords with multiple tabs
8. Restart IDE, and test highlighting, now KEYWORD1 keyword is highlighted

---
What is the expected output? What do you see instead?

Because KEYWORD2 keywords allow an arbitrary number of tabs (which is useful 
for making the file look clean), I would expect the same to apply to KEYWORD1 
keywords. The IDE doesn't agree. The rules between the two types of keywords 
are inconsistent.

---
What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

0021. 64-bit Ubuntu 10.04. Board not relevant, but Duemillanove.

---
Please provide any additional information below.

I think the issue is likely to lie in 
/app/src/processing/app/syntax/PdeKeywords.java, specifically the function 
getKeywords. This was the only code I could find dealing with parsing out tabs 
looking for the "KEYWORDx" token.

Unfortunately I'm not familiar with Java or the codebase, so I'm hoping this is 
an easy fix for someone. I've attached examples of a working and non-working 
keywords.txt to clarify my report.

Additionally, I'm wondering if there's a formal spec for keywords.txt posted 
somewhere.

I also appologize for having to use the word "keyword" so many times, but I 
couldn't think of a better way to express the bug. :P

Original issue reported on code.google.com by hyperfle...@gmail.com on 20 May 2011 at 10:15

Attachments:

GoogleCodeExporter commented 9 years ago
I modified the value's in 0 and 1. (From the Morse Class example)
Then it worked. (= I got grey and brown/orange)

But I think that's not the right solution

Original comment by derkvd...@gmail.com on 16 Feb 2012 at 5:36

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tried to add isDirectory and openNextFile keywords to the SD library 
keywords.txt file - as they were conspicuously missing???? - but it does not 
work.  Why weren't they in there to start with and why can't I add them myself?

Original comment by les.har...@gmail.com on 20 Nov 2012 at 10:05

GoogleCodeExporter commented 9 years ago
Are either of these comments related to the inconsistent handling of tabs 
between a keyword and KEYWORD(1|2) specifiers? I've been doing a lot more 
coding lately, and don't use the IDE anymore, but I may look into this when 
time permits.

Original comment by hyperfle...@gmail.com on 21 Nov 2012 at 2:19

GoogleCodeExporter commented 9 years ago
Les, please provide more details. I wouldn't be able to say why you can't 
without knowing EXACTLY what you've done.

Original comment by hyperfle...@gmail.com on 21 Nov 2012 at 2:20

GoogleCodeExporter commented 9 years ago
Sure.  I went into the package contents (under Mas OS X) and found the 
keywords.txt file, located in the SD library folder. I edited the file (as 
attached) and added isDirectory and openNextFile to the KEYWORD2 list.  
MethodName<tab>'KEYWORD2' I added them before the last entry to test if IT 
would still work - it did, but the two I added did not. The keywords.txt file 
is attached. This was under Arduino 1.5. I suspect it would still fail under 
1.0.1 also.

Original comment by les.har...@gmail.com on 21 Nov 2012 at 12:02

Attachments:

GoogleCodeExporter commented 9 years ago
Belay my last!  I was editing the keywords.txt file for Arduino 1.0.1, but was 
launching Arduino 1.5.  Please excuse my comments.

Original comment by les.har...@gmail.com on 21 Nov 2012 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by federico...@gmail.com on 8 Jul 2015 at 3:05