diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHost.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHost.java index c0b38a07eee6..4bec8b86a659 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHost.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHost.java @@ -106,6 +106,10 @@ public interface RegExpLanguageHost { return EMPTY_COMPLETION_ITEMS_ARRAY; } + default boolean supportsPropertySyntax(@NotNull PsiElement context) { + return true; + } + enum Lookbehind { /** Lookbehind not supported. */ NOT_SUPPORTED, diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java index 51c7d74eeb84..7780346c1856 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpLanguageHosts.java @@ -94,6 +94,11 @@ public final class RegExpLanguageHosts extends ClassExtension CAPABILITIES = EnumSet.of(RegExpCapability.OCTAL_NO_LEADING_ZERO, RegExpCapability.DANGLING_METACHARACTERS, RegExpCapability.ALLOW_EMPTY_CHARACTER_CLASS, + RegExpCapability.PROPERTY_VALUES, RegExpCapability.MAX_OCTAL_377); @Override diff --git a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java index a85c9588fb49..9f6f7c3a1dd3 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java @@ -219,6 +219,10 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot if (category == null) { return; } + if (!myLanguageHosts.supportsPropertySyntax(property)) { + myHolder.createErrorAnnotation(property, "Property escape sequences are not supported in this regex dialect"); + return; + } String propertyName = category.getText(); if(!myLanguageHosts.isValidCategory(category.getPsi(), propertyName)) { final Annotation a = myHolder.createErrorAnnotation(category, "Unknown character category");