regexp: lookbehind error highlighting for python

This commit is contained in:
Bas Leijdekkers
2017-01-17 17:02:20 +01:00
parent 96fdd517c5
commit e9836a6c8f
3 changed files with 17 additions and 1 deletions

View File

@@ -463,6 +463,11 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt
return false;
}
@Override
public Lookbehind supportsLookbehind(@NotNull RegExpGroup lookbehindGroup) {
return Lookbehind.FIXED_LENGTH_ALTERNATION;
}
@Override
public Long getQuantifierValue(@NotNull RegExpNumber number) {
try {

View File

@@ -0,0 +1,7 @@
import re
re.compile(r"(?<!a|b)");
re.compile(r"(?<!<error descr="Alternation alternatives needs to have the same length inside lookbehind">a|bc</error>)");
re.compile(r"(?<!a{3}})");
re.compile(r"(?<!a<weak_warning descr="Fixed repetition range">{3,3}</weak_warning>})");
re.compile(r"(?<!a<error descr="Unequal min and max in counted quantifier not allowed inside lookbehind">{3,4}</error>})");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,10 @@ import java.util.List;
*/
public class PyRegexpTest extends PyTestCase {
public void testLookbehind() {
doTestHighlighting();
}
public void testCountedQuantifier() {
doTestHighlighting();
}