diff --git a/app/src/processing/app/syntax/SketchTokenMaker.java b/app/src/processing/app/syntax/SketchTokenMaker.java index 92f105bc5..14a1d936f 100644 --- a/app/src/processing/app/syntax/SketchTokenMaker.java +++ b/app/src/processing/app/syntax/SketchTokenMaker.java @@ -32,8 +32,6 @@ package processing.app.syntax; import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker; -import java.util.Arrays; - /** * Controls the syntax highlighting of {@link SketchTextArea} based on the {@link PdeKeywords} * @@ -51,6 +49,11 @@ public class SketchTokenMaker extends CPlusPlusTokenMaker { @Override public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) { + if (start > end) { + super.addToken(array, start, end, tokenType, startOffset, hyperlink); + return; + } + // This assumes all of your extra tokens would normally be scanned as IDENTIFIER. int newType = pdeKeywords.getTokenType(array, start, end); if (newType > -1) {