mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
If a token is of some COMMENT_* type, don't use keywords. Fixes #3532
This commit is contained in:
parent
9c850c36e1
commit
94d1829b87
@ -30,8 +30,12 @@
|
||||
|
||||
package processing.app.syntax;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.TokenTypes;
|
||||
import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Controls the syntax highlighting of {@link SketchTextArea} based on the {@link PdeKeywords}
|
||||
*
|
||||
@ -41,6 +45,8 @@ import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker;
|
||||
*/
|
||||
public class SketchTokenMaker extends CPlusPlusTokenMaker {
|
||||
|
||||
private static final List<Integer> COMMENT_TOKEN_TYPES = Arrays.asList(TokenTypes.COMMENT_DOCUMENTATION, TokenTypes.COMMENT_EOL, TokenTypes.COMMENT_KEYWORD, TokenTypes.COMMENT_MARKUP, TokenTypes.COMMENT_MULTILINE);
|
||||
|
||||
private final PdeKeywords pdeKeywords;
|
||||
|
||||
public SketchTokenMaker(PdeKeywords pdeKeywords) {
|
||||
@ -54,6 +60,11 @@ public class SketchTokenMaker extends CPlusPlusTokenMaker {
|
||||
return;
|
||||
}
|
||||
|
||||
if (COMMENT_TOKEN_TYPES.contains(tokenType)) {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user