Python regex: Fix handling of character sets where first character in set is '['.

This commit is contained in:
Mark Shannon
2019-06-26 10:55:47 +01:00
parent 927d72414b
commit 347e3f3bd0
8 changed files with 34 additions and 3 deletions

View File

@@ -68,7 +68,8 @@ abstract class RegexString extends Expr {
/** Whether there is a character class, between start (inclusive) and end (exclusive) */
predicate charSet(int start, int end) {
exists(int inner_start, int inner_end |
this.char_set_start(start, inner_start) |
this.char_set_start(start, inner_start) and
not this.char_set_start(_, start) |
end = inner_end + 1 and inner_end > inner_start and
this.nonEscapedCharAt(inner_end) = "]" and
not exists(int mid | this.nonEscapedCharAt(mid) = "]" |