Go Down

Topic: Keyword highlighting (Read 53 times) previous topic - next topic

dougp

I was tinkering with memrchr() and noticed it is not represented by a theme color, like the way memchr() is.

Is this just an oversight?  Can it be made to display a theme color?

Code: [Select]

// Find a character by searching backwards through a string
// uses memrchr()

char data[] = "/set color #FF5480";
char* numStart;
unsigned long numFound;

void setup() {
  Serial.begin(115200);
  Serial.print("input characters - ");
  Serial.println(data);
  numStart = (char*)memrchr(data, '#', strlen(data)); // find number marker by searching backwards
  numStart += 1; // move past marker character to point to first hex character
  Serial.print("-------------------\nas text - ");
  Serial.println(numStart);
  numFound = strtoul(numStart, NULL, HEX);
  Serial.print("as number - ");
  Serial.println(numFound);
}

void loop() {
// empty
}
I don't trust atoms.  They make up everything.

No private consultations undertaken!

pert

The global keywords are defined in {Arduino IDE installation folder}/lib/keywords.txt

You can add it in your local installation, or if you want to try to get it done upstream, submit a pull request on GitHub:
https://github.com/arduino/Arduino/blob/master/build/shared/lib/keywords.txt

It probably would be best to do a comprehensive review of the keywords and propose to add all missing ones at once, rather than a PR for a single keyword. I had luck adding a bunch of missing math keywords a while back:
https://github.com/arduino/Arduino/commit/52706f56a5a985ad5f6064d98a27d6db7e0a33f8
so the developers aren't completely closed to the idea of adding more

dougp

You can add it in your local installation, or if you want to try to get it done upstream, submit a pull request on GitHub:
Thank you.  I lean toward the pull request because then I won't have to fiddle with the install every time there's an update.  Guess I'll have to learn how to use github.  Sigh.
I don't trust atoms.  They make up everything.

No private consultations undertaken!

Go Up