1

I wrote a function that takes characters and noticed that the Arduino Compiler treated some characters like system-reserved, and other like functions, and a few just like characters. Lowercase doesn't seem to be effected. I'm just wondering why. enter image description here

Gerben
11.3k3 gold badges22 silver badges34 bronze badges
asked Nov 18, 2016 at 18:55
5
  • 1
    What is your code supposed to mean? Commented Nov 18, 2016 at 19:07
  • 4
    Are you referring to the different colors of the letters? The syntax highlighter is made to highlight correct C code. Giving it invalid code will produce invalid highlighting. I wouldn't try to read too much into it. Commented Nov 18, 2016 at 19:10
  • Oh ok. I may have read into it too much Commented Nov 18, 2016 at 23:33
  • @EdgarBonet its a segment, you give it forward(a||b) and motor a or b moves forward, or reverse, or brakes, or halts all, etc. It also was working(need more testing) I was just curious about the syntax highlighting which I noticed while I was writing it. Commented Nov 18, 2016 at 23:38
  • Please copy and paste your code, not a picture of it. For help see Markdown help. You can format code by selecting the code and pressing Ctrl+K to have your browser do this for you. Commented Nov 19, 2016 at 6:42

2 Answers 2

2

The Arduino IDE does keyword coloration according to a very crude system. It simply scans for all the keywords.txt files included with:

  • Arduino IDE
  • Libraries bundled with the Arduino IDE
  • Libraries you have installed to the libraries subfolder of your sketchbook
  • Libraries bundled with the hardware package of the currently selected board - Hardware package of the currently selected board (recent IDE versions only)

There are several types of keyword identifiers that determine which color is used. The reason those letters are colored in your IDE is because some library you have installed just happens to have added them to its keywords.txt file. The Arduino IDE makes no attempt to determine whether you have included those libraries and so coloration doesn't necessarily mean they are "reserved". If you have not included the library that defines a specific keyword then the coloration of that keyword is meaningless.

For more information on keywords.txt see:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords

answered Jul 18, 2017 at 14:21
1

In WString.h is a define:

#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

In other words, the letter F is already a macro.

I don't know what your code:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

is supposed to do. I suppose you are just testing the syntax highlighting?

The syntax highlighting is designed to try to "help" you by colouring words in a pre-supplied file in a different way. It doesn't in any way affect how the compilation works. And, judging by what you posted, it can't always be relied upon. Personally, I ignore it.

answered Nov 19, 2016 at 6:45
1
  • I was just showing the letters that do syntax highlighting. Commented Nov 19, 2016 at 13:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.