Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7f959bf
C++: Copy Ruby regex library and tests verbatim
Copilot Jul 21, 2026
4096725
C++: Make regex library compile
jketema Jul 21, 2026
cc4f5bd
C++: Make regex test work
jketema Jul 21, 2026
d5d73f6
C++: Add location tests for all literal prefixes
Copilot Jul 23, 2026
322c1c0
C++: Add `RawStringLiteral` class
jketema Jul 23, 2026
fd929e2
C++: Fix regex starting location
jketema Jul 23, 2026
eb53e56
C++: Remove Ruby-only \A/\Z/\z/\G anchors from regex grammar
Copilot Jul 23, 2026
6e71f00
C++: Remove Ruby-only \h and \H character class escapes
Copilot Jul 23, 2026
a471af9
C++: Remove Ruby-style \p and \P named character properties
jketema Jul 23, 2026
c3fd966
C++: Remove Ruby-style (?#...) comment groups
Copilot Jul 23, 2026
b2d0766
C++: Remove single-quote named capture groups
Copilot Jul 23, 2026
985a2ba
C++: Remove named capture groups
Copilot Jul 23, 2026
bb96e90
C++: Remove named backreferences
Copilot Jul 23, 2026
da931e4
C++: Remove lookbehind assertions
Copilot Jul 23, 2026
0a3887d
C++: Remove {,m} quantifier form
jketema Jul 24, 2026
64a9a75
C++: Remove inverted named character properties
jketema Aug 7, 2026
24251de
C++: Add control-escape tests (pre-fix)
Copilot Jul 23, 2026
8d45199
C++: Implement \cX control escapes
Copilot Jul 23, 2026
87cdedd
C++: Add NUL-escape tests (pre-fix)
Copilot Jul 23, 2026
81783e6
C++: Implement \0 NUL escape
Copilot Jul 23, 2026
03625be
C++: Add POSIX collating-symbol tests (pre-fix)
Copilot Jul 23, 2026
32e3a11
C++: Fix typo
jketema Aug 7, 2026
57f5d03
C++: Implement POSIX collating symbols
jketema Aug 7, 2026
96c9214
C++: Add POSIX equivalence-class tests (pre-fix)
Copilot Jul 23, 2026
5cce52e
C++: Implement POSIX equivalence classes
jketema Aug 7, 2026
b1e7fb7
C++: Replace non-standard \u{...} test with \uhhhh
Copilot Jul 23, 2026
f7797ed
C++: Add coverage for lazy quantifiers and \f/\v escapes
Copilot Jul 23, 2026
009ae43
C++: Verify [\b] is backspace inside character classes
Copilot Jul 23, 2026
66c191a
C++: Add change note for std::regex ECMAScript parser alignment
Copilot Jul 23, 2026
b2fc6a1
C++: Drop unneeded `\U` from `isUnicode`
jketema Aug 7, 2026
aa14162
C++: add hex escape test
jketema Aug 7, 2026
ff038a2
C++: Handle `\0` in `RegExpEscape`
jketema Aug 7, 2026
40feb22
C++: Handle `\cX` in `RegExpEscape` and slightly tweak test
jketema Aug 7, 2026
e6cfe17
C++: Handle `\xhh` in `RegExpEscape`
jketema Aug 7, 2026
b30d9d6
C++: Fix change note category
jketema Aug 7, 2026
aca8aa9
C++: Fix off-by-one in `\cX` handling
jketema Aug 7, 2026
e95ae40
C++: Fix QL-for-QL errors
jketema Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: feature
---
* Added a C++ regular-expression parser for the ECMAScript grammar used by `std::regex`.
1 change: 1 addition & 0 deletions cpp/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
codeql/mad: ${workspace}
codeql/quantum: ${workspace}
codeql/rangeanalysis: ${workspace}
codeql/regex: ${workspace}
codeql/ssa: ${workspace}
codeql/typeflow: ${workspace}
codeql/tutorial: ${workspace}
Expand Down
13 changes: 13 additions & 0 deletions cpp/ql/lib/semmle/code/cpp/exprs/Literal.qll
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ class StringLiteral extends TextLiteral {
override string getAPrimaryQlClass() { result = "StringLiteral" }
}

/**
* A C++ raw string literal. For example:
* ```
* const char *s1 = R"(abcdef)";
* const wchar_t *s2 = LR"x(123456)x";
* ```
*/
class RawStringLiteral extends StringLiteral {
RawStringLiteral() { this.getValueText().regexpMatch("[^\"]*R\".*\\(.*") }

override string getAPrimaryQlClass() { result = "RawStringLiteral" }
}

/**
* An octal literal. For example:
* ```
Expand Down
Loading
Loading