1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Keywords: added preprocessor directives. Fixes #3480

This commit is contained in:
Federico Fissore 2015-07-08 16:21:31 +02:00
parent 0ad73ebed3
commit 3cf1204833
4 changed files with 17 additions and 0 deletions

View File

@ -54,6 +54,7 @@ public class PdeKeywords {
KNOWN_TOKEN_TYPES.put("DATA_TYPE", TokenTypes.DATA_TYPE);
KNOWN_TOKEN_TYPES.put("LITERAL_BOOLEAN", TokenTypes.LITERAL_BOOLEAN);
KNOWN_TOKEN_TYPES.put("LITERAL_CHAR", TokenTypes.LITERAL_CHAR);
KNOWN_TOKEN_TYPES.put("PREPROCESSOR", TokenTypes.PREPROCESSOR);
}
// lookup table for the TokenMarker subclass, handles coloring
@ -112,6 +113,9 @@ public class PdeKeywords {
String pieces[] = PApplet.split(line, '\t');
String keyword = pieces[0].trim();
if (keyword.startsWith("\\#")) {
keyword = keyword.replace("\\#", "#");
}
if (pieces.length >= 2) {
keywordOldToken.put(keyword, pieces[1]);

View File

@ -125,6 +125,7 @@ public class SketchTextArea extends RSyntaxTextArea {
setSyntaxTheme(TokenTypes.LITERAL_BOOLEAN, "literal_boolean");
setSyntaxTheme(TokenTypes.LITERAL_CHAR, "literal_char");
setSyntaxTheme(TokenTypes.LITERAL_STRING_DOUBLE_QUOTE, "literal_string_double_quote");
setSyntaxTheme(TokenTypes.PREPROCESSOR, "preprocessor");
Style style = getSyntaxScheme().getStyle(TokenTypes.IDENTIFIER);
style.foreground = processing.app.Theme.getColor("editor.fgcolor");

View File

@ -248,3 +248,14 @@ export KEYWORD3 RESERVED_WORD
>> Bitshift
; SemiColon
-= DecrementCompound
\#include KEYWORD3 PREPROCESSOR
\#define KEYWORD3 PREPROCESSOR
\#elif KEYWORD3 PREPROCESSOR
\#else KEYWORD3 PREPROCESSOR
\#error KEYWORD3 PREPROCESSOR
\#if KEYWORD3 PREPROCESSOR
\#ifdef KEYWORD3 PREPROCESSOR
\#ifndef KEYWORD3 PREPROCESSOR
\#pragma KEYWORD3 PREPROCESSOR
\#warning KEYWORD3 PREPROCESSOR

View File

@ -100,6 +100,7 @@ editor.reserved_word_2.style = #00979C,plain
editor.literal_boolean.style = #00979C,plain
editor.literal_char.style = #00979C,plain
editor.literal_string_double_quote.style = #00979C,plain
editor.preprocessor.style = #5E6D03,plain
# http://www.arduino.cc/
editor.url.style = #0000ff,underlined