Skip to content

Commit 0a3887d

Browse files
committed
C++: Remove {,m} quantifier form
1 parent da931e4 commit 0a3887d

5 files changed

Lines changed: 2 additions & 11 deletions

File tree

‎cpp/ql/lib/semmle/code/cpp/regex/internal/ParseRegExp.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ abstract class RegExp extends StringLiteral {
670670
lower = inner and
671671
upper = lower
672672
or
673-
match = text.regexpFind("\\{[0-9]*,[0-9]*\\}", _, start) and
673+
match = text.regexpFind("\\{[0-9]+,[0-9]*\\}", _, start) and
674674
exists(int commaIndex |
675675
commaIndex = inner.indexOf(",") and
676676
lower = inner.prefix(commaIndex) and

‎cpp/ql/test/library-tests/regex/locations.expected‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
| regexp.cpp:18:19:18:21 | abc | regexp.cpp | 18 | 19 | 18 | 21 |
22
| regexp.cpp:21:20:21:26 | a*b+c?d | regexp.cpp | 21 | 20 | 21 | 26 |
33
| regexp.cpp:22:20:22:25 | a{4,8} | regexp.cpp | 22 | 20 | 22 | 25 |
4-
| regexp.cpp:23:20:23:24 | a{,8} | regexp.cpp | 23 | 20 | 23 | 24 |
54
| regexp.cpp:24:20:24:24 | a{3,} | regexp.cpp | 24 | 20 | 24 | 24 |
65
| regexp.cpp:25:20:25:23 | a{7} | regexp.cpp | 25 | 20 | 25 | 23 |
76
| regexp.cpp:28:19:28:25 | foo\|bar | regexp.cpp | 28 | 19 | 28 | 25 |

‎cpp/ql/test/library-tests/regex/parse.expected‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ regexp.cpp:
2929
# 22| [RegExpRange] a{4,8}
3030
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
3131

32-
# 23| [RegExpConstant, RegExpNormalChar] a
33-
34-
# 23| [RegExpRange] a{,8}
35-
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
36-
3732
# 24| [RegExpConstant, RegExpNormalChar] a
3833

3934
# 24| [InfiniteRepetitionQuantifier, RegExpRange] a{3,}

‎cpp/ql/test/library-tests/regex/regexp.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ std::regex r_abc("abc");
2020
// Repetition
2121
std::regex r_rep1("a*b+c?d");
2222
std::regex r_rep2("a{4,8}");
23-
std::regex r_rep3("a{,8}");
23+
2424
std::regex r_rep4("a{3,}");
2525
std::regex r_rep5("a{7}");
2626

‎cpp/ql/test/library-tests/regex/regexp.expected‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ term
1515
| regexp.cpp:21:26:21:26 | d | RegExpConstant,RegExpNormalChar |
1616
| regexp.cpp:22:20:22:20 | a | RegExpConstant,RegExpNormalChar |
1717
| regexp.cpp:22:20:22:25 | a{4,8} | RegExpRange |
18-
| regexp.cpp:23:20:23:20 | a | RegExpConstant,RegExpNormalChar |
19-
| regexp.cpp:23:20:23:24 | a{,8} | RegExpRange |
2018
| regexp.cpp:24:20:24:20 | a | RegExpConstant,RegExpNormalChar |
2119
| regexp.cpp:24:20:24:24 | a{3,} | InfiniteRepetitionQuantifier,RegExpRange |
2220
| regexp.cpp:25:20:25:20 | a | RegExpConstant,RegExpNormalChar |
@@ -207,7 +205,6 @@ regExpNormalCharValue
207205
| regexp.cpp:21:24:21:24 | c | c |
208206
| regexp.cpp:21:26:21:26 | d | d |
209207
| regexp.cpp:22:20:22:20 | a | a |
210-
| regexp.cpp:23:20:23:20 | a | a |
211208
| regexp.cpp:24:20:24:20 | a | a |
212209
| regexp.cpp:25:20:25:20 | a | a |
213210
| regexp.cpp:28:19:28:21 | foo | foo |

0 commit comments

Comments
 (0)