mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Regex: highlight string escapes as string escapes not regular characters (IDEA-234581)
GitOrigin-RevId: be0d3f842d0bbe4a838cdb3dfdbfa539a0ecdf88
This commit is contained in:
committed by
intellij-monorepo-bot
parent
da1124a439
commit
a2d5c27c59
@@ -44,7 +44,7 @@ public class RegExpHighlighter extends SyntaxHighlighterBase {
|
||||
static final TextAttributesKey BRACES = createTextAttributesKey("REGEXP.BRACES", DefaultLanguageHighlighterColors.BRACES);
|
||||
static final TextAttributesKey BRACKETS = createTextAttributesKey("REGEXP.BRACKETS", DefaultLanguageHighlighterColors.BRACKETS);
|
||||
static final TextAttributesKey COMMA = createTextAttributesKey("REGEXP.COMMA", DefaultLanguageHighlighterColors.COMMA);
|
||||
static final TextAttributesKey ESC_CHARACTER = createTextAttributesKey("REGEXP.ESC_CHARACTER", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
|
||||
public static final TextAttributesKey ESC_CHARACTER = createTextAttributesKey("REGEXP.ESC_CHARACTER", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
|
||||
static final TextAttributesKey CHAR_CLASS = createTextAttributesKey("REGEXP.CHAR_CLASS", DefaultLanguageHighlighterColors.MARKUP_ENTITY);
|
||||
static final TextAttributesKey QUOTE_CHARACTER = createTextAttributesKey("REGEXP.QUOTE_CHARACTER", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
|
||||
static final TextAttributesKey COMMENT = createTextAttributesKey("REGEXP.COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
||||
|
||||
@@ -157,8 +157,16 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot
|
||||
public void visitRegExpChar(final RegExpChar ch) {
|
||||
final PsiElement child = ch.getFirstChild();
|
||||
final IElementType type = child.getNode().getElementType();
|
||||
if (type == StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN) {
|
||||
myHolder.newAnnotation(HighlightSeverity.ERROR, "Illegal/unsupported escape sequence").create();
|
||||
if (type == RegExpTT.CHARACTER) {
|
||||
if (ch.getTextLength() > 1) {
|
||||
myHolder.newSilentAnnotation(HighlightInfoType.SYMBOL_TYPE_SEVERITY)
|
||||
.range(ch)
|
||||
.textAttributes(RegExpHighlighter.ESC_CHARACTER)
|
||||
.create();
|
||||
}
|
||||
}
|
||||
else if (type == StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN) {
|
||||
myHolder.newAnnotation(HighlightSeverity.ERROR, RegExpBundle.message("error.illegal.unsupported.escape.sequence")).create();
|
||||
return;
|
||||
}
|
||||
else if (type == RegExpTT.BAD_HEX_VALUE) {
|
||||
|
||||
Reference in New Issue
Block a user