Skip to content

Commit 5cce52e

Browse files
committed
C++: Implement POSIX equivalence classes
1 parent 96c9214 commit 5cce52e

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎cpp/ql/lib/semmle/code/cpp/regex/RegexTreeView.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private newtype TRegExpParent =
5050
TRegExpBackRef(RegExp re, int start, int end) { re.backreference(start, end) } or
5151
/** A named character property */
5252
TRegExpNamedCharacterProperty(RegExp re, int start, int end) {
53-
re.namedCharacterProperty(start, end, [":", "."], _)
53+
re.namedCharacterProperty(start, end, _, _)
5454
}
5555

5656
/** An implementation that satisfies the RegexTreeView signature. */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,14 @@ regexp.cpp:
426426
# 79| [RegExpConstant, RegExpNormalChar] f
427427

428428
# 82| [RegExpCharacterClass] [[=a=]]
429+
#-----| 0 -> [RegExpNamedCharacterProperty] [=a=]
430+
431+
# 82| [RegExpNamedCharacterProperty] [=a=]
429432

430433
# 83| [RegExpCharacterClass] [A-F[=b=]a-f]
431434
#-----| 0 -> [RegExpCharacterRange] A-F
435+
#-----| 1 -> [RegExpNamedCharacterProperty] [=b=]
436+
#-----| 2 -> [RegExpCharacterRange] a-f
432437

433438
# 83| [RegExpConstant, RegExpNormalChar] A
434439

@@ -438,6 +443,8 @@ regexp.cpp:
438443

439444
# 83| [RegExpConstant, RegExpNormalChar] F
440445

446+
# 83| [RegExpNamedCharacterProperty] [=b=]
447+
441448
# 83| [RegExpConstant, RegExpNormalChar] a
442449

443450
# 83| [RegExpCharacterRange] a-f

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ term
159159
| regexp.cpp:79:36:79:38 | a-f | RegExpCharacterRange |
160160
| regexp.cpp:79:38:79:38 | f | RegExpConstant,RegExpNormalChar |
161161
| regexp.cpp:82:28:82:34 | [[=a=]] | RegExpCharacterClass |
162+
| regexp.cpp:82:29:82:33 | [=a=] | RegExpNamedCharacterProperty |
162163
| regexp.cpp:83:28:83:40 | [A-F[=b=]a-f] | RegExpCharacterClass |
163164
| regexp.cpp:83:29:83:29 | A | RegExpConstant,RegExpNormalChar |
164165
| regexp.cpp:83:29:83:31 | A-F | RegExpCharacterRange |
165166
| regexp.cpp:83:31:83:31 | F | RegExpConstant,RegExpNormalChar |
167+
| regexp.cpp:83:32:83:36 | [=b=] | RegExpNamedCharacterProperty |
166168
| regexp.cpp:83:37:83:37 | a | RegExpConstant,RegExpNormalChar |
167169
| regexp.cpp:83:37:83:39 | a-f | RegExpCharacterRange |
168170
| regexp.cpp:83:39:83:39 | f | RegExpConstant,RegExpNormalChar |

0 commit comments

Comments
 (0)