Commit 1: Remove \p{...}/\P{...} named-character-property handling

std::regex ECMAScript mode does not support \p{Name}; \p tokenizes as an
identity escape. Remove pStyleNamedCharacterProperty and its call sites;
namedCharacterProperty now covers only POSIX brackets ([:name:], [.x.],
[=x=]) and namedCharacterPropertyIsInverted keeps only the [[:^name:]]
case (fixing the offset from start+3 to start+2 for POSIX). Update
RegExpNamedCharacterProperty getName/isInverted docs to describe POSIX
brackets. Remove the four \p{...}/\P{...} corpus lines from test.cpp;
keep a plain [a-f\d]+ case for the class-with-escape shape.

Bundle: github/codeql-action codeql-bundle-v2.26.1 (CodeQL CLI 2.26.1).
This commit is contained in:
copilot-swe-agent[bot]
2026-07-21 12:16:37 +00:00
committed by GitHub
parent bfa65301f1
commit 448ae6af53
6 changed files with 196 additions and 266 deletions

View File

@@ -1192,13 +1192,13 @@ private module Impl implements RegexTreeViewSig {
override string getAPrimaryQlClass() { result = "RegExpNamedCharacterProperty" }
/**
* Gets the property name. For example, in `\p{Space}`, the result is
* `"Space"`.
* Gets the property name. For example, in `[[:digit:]]`, the result is
* `"digit"`.
*/
string getName() { result = re.getCharacterPropertyName(start, end) }
/**
* Holds if the property is inverted. For example, it holds for `\p{^Digit}`,
* Holds if the property is inverted. For example, it holds for `[[:^digit:]]`,
* which matches non-digits.
*/
predicate isInverted() { re.namedCharacterPropertyIsInverted(start, end) }

View File

@@ -282,9 +282,8 @@ class RegExp extends StringLiteral {
)
}
/** Matches named character properties such as `\p{Word}` and `[[:digit:]]` */
/** Matches named character properties such as `[[:digit:]]`, `[.a.]`, and `[=a=]`. */
predicate namedCharacterProperty(int start, int end, string name) {
this.pStyleNamedCharacterProperty(start, end, name) or
this.posixStyleNamedCharacterProperty(start, end, name) or
this.posixCollatingSymbol(start, end, name) or
this.posixEquivalenceClass(start, end, name)
@@ -367,52 +366,16 @@ class RegExp extends StringLiteral {
name = this.getText().substring(start + 2, end - 2)
}
/**
* Matches named character properties. For example:
* - `\p{Space}`
* - `\P{Digit}` upper-case P means inverted
* - `\p{^Word}` caret also means inverted
*
* These can occur both inside and outside of character classes.
*/
private predicate pStyleNamedCharacterProperty(int start, int end, string name) {
this.escapingChar(start) and
this.getChar(start + 1) in ["p", "P"] and
this.getChar(start + 2) = "{" and
this.getChar(end - 1) = "}" and
end > start and
not exists(int i | start + 2 < i and i < end - 1 | this.getChar(i) = "}") and
exists(int nameStart |
this.getChar(start + 3) = "^" and nameStart = start + 4
or
not this.getChar(start + 3) = "^" and nameStart = start + 3
|
name = this.getText().substring(nameStart, end - 1)
)
}
/**
* Holds if the named character property is inverted. Examples for which it holds:
* - `\P{Digit}` upper-case P means inverted
* - `\p{^Word}` caret also means inverted
* - `[[:^digit:]]`
*
* Examples for which it doesn't hold:
* - `\p{Word}`
* - `\P{^Space}` - upper-case P and caret cancel each other out
* - `[[:alnum:]]`
*/
predicate namedCharacterPropertyIsInverted(int start, int end) {
this.pStyleNamedCharacterProperty(start, end, _) and
exists(boolean upperP, boolean caret |
(if this.getChar(start + 1) = "P" then upperP = true else upperP = false) and
(if this.getChar(start + 3) = "^" then caret = true else caret = false)
|
upperP.booleanXor(caret) = true
)
or
this.posixStyleNamedCharacterProperty(start, end, _) and
this.getChar(start + 3) = "^"
this.getChar(start + 2) = "^"
}
/**
@@ -424,7 +387,6 @@ class RegExp extends StringLiteral {
this.escapingChar(start) and
not this.numberedBackreference(start, _, _) and
not this.namedBackreference(start, _, _) and
not this.pStyleNamedCharacterProperty(start, _, _) and
(
// hex char \xhh
this.getChar(start + 1) = "x" and end = start + 4
@@ -502,9 +464,6 @@ class RegExp extends StringLiteral {
) and
not exists(int x, int y | this.groupStart(x, y) and x <= start and y >= end) and
not exists(int x, int y | this.backreference(x, y) and x <= start and y >= end) and
not exists(int x, int y |
this.pStyleNamedCharacterProperty(x, y, _) and x <= start and y >= end
) and
not exists(int x, int y | this.multiples(x, y, _, _) and x <= start and y >= end)
}
@@ -831,8 +790,6 @@ class RegExp extends StringLiteral {
this.charSet(start, end)
or
this.backreference(start, end)
or
this.pStyleNamedCharacterProperty(start, end, _)
}
private predicate qualifier(int start, int end, boolean maybeEmpty, boolean mayRepeatForever) {

View File

@@ -1,40 +1,36 @@
| test.cpp:144:23:144:23 | a | 22 | 0 | 1 | 23 | 23 |
| test.cpp:144:23:144:24 | a+ | 22 | 0 | 2 | 23 | 24 |
| test.cpp:144:23:144:25 | a+b | 22 | 0 | 3 | 23 | 25 |
| test.cpp:144:25:144:25 | b | 22 | 2 | 3 | 25 | 25 |
| test.cpp:147:23:147:23 | a | 20 | 0 | 1 | 23 | 23 |
| test.cpp:147:23:147:24 | a+ | 20 | 0 | 2 | 23 | 24 |
| test.cpp:147:23:147:25 | a+b | 20 | 0 | 3 | 23 | 25 |
| test.cpp:147:25:147:25 | b | 20 | 2 | 3 | 25 | 25 |
| test.cpp:150:24:150:25 | \\s | 21 | 0 | 2 | 24 | 25 |
| test.cpp:150:24:150:26 | \\s+ | 21 | 0 | 3 | 24 | 26 |
| test.cpp:150:24:150:27 | \\s+$ | 21 | 0 | 4 | 24 | 27 |
| test.cpp:150:27:150:27 | $ | 21 | 3 | 4 | 27 | 27 |
| test.cpp:153:24:153:25 | \\( | 21 | 0 | 2 | 24 | 25 |
| test.cpp:153:24:153:37 | \\(([,\\w]+)+\\)$ | 21 | 0 | 14 | 24 | 37 |
| test.cpp:153:26:153:33 | ([,\\w]+) | 21 | 2 | 10 | 26 | 33 |
| test.cpp:153:26:153:34 | ([,\\w]+)+ | 21 | 2 | 11 | 26 | 34 |
| test.cpp:153:27:153:31 | [,\\w] | 21 | 3 | 8 | 27 | 31 |
| test.cpp:153:27:153:32 | [,\\w]+ | 21 | 3 | 9 | 27 | 32 |
| test.cpp:153:28:153:28 | , | 21 | 4 | 5 | 28 | 28 |
| test.cpp:153:29:153:30 | \\w | 21 | 5 | 7 | 29 | 30 |
| test.cpp:153:35:153:36 | \\) | 21 | 11 | 13 | 35 | 36 |
| test.cpp:153:37:153:37 | $ | 21 | 13 | 14 | 37 | 37 |
| test.cpp:156:25:156:25 | a | 21 | 0 | 1 | 25 | 25 |
| test.cpp:156:25:156:26 | a+ | 21 | 0 | 2 | 25 | 26 |
| test.cpp:156:25:156:27 | a+b | 21 | 0 | 3 | 25 | 27 |
| test.cpp:156:27:156:27 | b | 21 | 2 | 3 | 27 | 27 |
| test.cpp:159:24:159:24 | a | 22 | 0 | 1 | 24 | 24 |
| test.cpp:159:24:159:25 | a+ | 22 | 0 | 2 | 24 | 25 |
| test.cpp:159:24:159:26 | a+b | 22 | 0 | 3 | 24 | 26 |
| test.cpp:159:26:159:26 | b | 22 | 2 | 3 | 26 | 26 |
| test.cpp:162:30:162:30 | a | 26 | 0 | 1 | 30 | 30 |
| test.cpp:162:30:162:31 | a+ | 26 | 0 | 2 | 30 | 31 |
| test.cpp:162:30:162:32 | a+b | 26 | 0 | 3 | 30 | 32 |
| test.cpp:162:32:162:32 | b | 26 | 2 | 3 | 32 | 32 |
| test.cpp:166:22:166:23 | \\s | 21 | 0 | 2 | 22 | 23 |
| test.cpp:166:22:166:24 | \\s+ | 21 | 0 | 3 | 22 | 24 |
| test.cpp:169:22:169:22 | a | 21 | 0 | 1 | 22 | 22 |
| test.cpp:169:22:169:25 | a\\.b | 21 | 0 | 4 | 22 | 25 |
| test.cpp:169:23:169:24 | \\. | 21 | 1 | 3 | 23 | 24 |
| test.cpp:169:25:169:25 | b | 21 | 3 | 4 | 25 | 25 |
| test.cpp:144:23:144:23 | a | 20 | 0 | 1 | 23 | 23 |
| test.cpp:144:23:144:24 | a+ | 20 | 0 | 2 | 23 | 24 |
| test.cpp:144:23:144:25 | a+b | 20 | 0 | 3 | 23 | 25 |
| test.cpp:144:25:144:25 | b | 20 | 2 | 3 | 25 | 25 |
| test.cpp:147:24:147:25 | \\s | 21 | 0 | 2 | 24 | 25 |
| test.cpp:147:24:147:26 | \\s+ | 21 | 0 | 3 | 24 | 26 |
| test.cpp:147:24:147:27 | \\s+$ | 21 | 0 | 4 | 24 | 27 |
| test.cpp:147:27:147:27 | $ | 21 | 3 | 4 | 27 | 27 |
| test.cpp:150:24:150:25 | \\( | 21 | 0 | 2 | 24 | 25 |
| test.cpp:150:24:150:37 | \\(([,\\w]+)+\\)$ | 21 | 0 | 14 | 24 | 37 |
| test.cpp:150:26:150:33 | ([,\\w]+) | 21 | 2 | 10 | 26 | 33 |
| test.cpp:150:26:150:34 | ([,\\w]+)+ | 21 | 2 | 11 | 26 | 34 |
| test.cpp:150:27:150:31 | [,\\w] | 21 | 3 | 8 | 27 | 31 |
| test.cpp:150:27:150:32 | [,\\w]+ | 21 | 3 | 9 | 27 | 32 |
| test.cpp:150:28:150:28 | , | 21 | 4 | 5 | 28 | 28 |
| test.cpp:150:29:150:30 | \\w | 21 | 5 | 7 | 29 | 30 |
| test.cpp:150:35:150:36 | \\) | 21 | 11 | 13 | 35 | 36 |
| test.cpp:150:37:150:37 | $ | 21 | 13 | 14 | 37 | 37 |
| test.cpp:153:25:153:25 | a | 21 | 0 | 1 | 25 | 25 |
| test.cpp:153:25:153:26 | a+ | 21 | 0 | 2 | 25 | 26 |
| test.cpp:153:25:153:27 | a+b | 21 | 0 | 3 | 25 | 27 |
| test.cpp:153:27:153:27 | b | 21 | 2 | 3 | 27 | 27 |
| test.cpp:156:24:156:24 | a | 22 | 0 | 1 | 24 | 24 |
| test.cpp:156:24:156:25 | a+ | 22 | 0 | 2 | 24 | 25 |
| test.cpp:156:24:156:26 | a+b | 22 | 0 | 3 | 24 | 26 |
| test.cpp:156:26:156:26 | b | 22 | 2 | 3 | 26 | 26 |
| test.cpp:159:30:159:30 | a | 26 | 0 | 1 | 30 | 30 |
| test.cpp:159:30:159:31 | a+ | 26 | 0 | 2 | 30 | 31 |
| test.cpp:159:30:159:32 | a+b | 26 | 0 | 3 | 30 | 32 |
| test.cpp:159:32:159:32 | b | 26 | 2 | 3 | 32 | 32 |
| test.cpp:163:22:163:23 | \\s | 21 | 0 | 2 | 22 | 23 |
| test.cpp:163:22:163:24 | \\s+ | 21 | 0 | 3 | 22 | 24 |
| test.cpp:166:22:166:22 | a | 21 | 0 | 1 | 22 | 22 |
| test.cpp:166:22:166:25 | a\\.b | 21 | 0 | 4 | 22 | 25 |
| test.cpp:166:23:166:24 | \\. | 21 | 1 | 3 | 23 | 24 |
| test.cpp:166:25:166:25 | b | 21 | 3 | 4 | 25 | 25 |

View File

@@ -442,86 +442,82 @@ test.cpp:
# 113| [RegExpPlus] \k<qux>+
#-----| 0 -> [RegExpBackRef] \k<qux>
# 116| [RegExpNamedCharacterProperty] \p{Word}
# 116| [RegExpStar] \p{Word}*
#-----| 0 -> [RegExpNamedCharacterProperty] \p{Word}
# 117| [RegExpNamedCharacterProperty] \P{Digit}
# 117| [RegExpPlus] \P{Digit}+
#-----| 0 -> [RegExpNamedCharacterProperty] \P{Digit}
# 118| [RegExpNamedCharacterProperty] \p{^Alnum}
# 118| [RegExpRange] \p{^Alnum}{2,3}
#-----| 0 -> [RegExpNamedCharacterProperty] \p{^Alnum}
# 119| [RegExpCharacterClass] [a-f\p{Digit}]
# 116| [RegExpCharacterClass] [a-f\d]
#-----| 0 -> [RegExpCharacterRange] a-f
#-----| 1 -> [RegExpNamedCharacterProperty] \p{Digit}
#-----| 1 -> [RegExpCharacterClassEscape] \d
# 119| [RegExpPlus] [a-f\p{Digit}]+
#-----| 0 -> [RegExpCharacterClass] [a-f\p{Digit}]
# 116| [RegExpPlus] [a-f\d]+
#-----| 0 -> [RegExpCharacterClass] [a-f\d]
# 119| [RegExpConstant, RegExpNormalChar] a
# 116| [RegExpConstant, RegExpNormalChar] a
# 119| [RegExpCharacterRange] a-f
# 116| [RegExpCharacterRange] a-f
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpNormalChar] f
# 119| [RegExpConstant, RegExpNormalChar] f
# 116| [RegExpConstant, RegExpNormalChar] f
# 119| [RegExpNamedCharacterProperty] \p{Digit}
# 116| [RegExpCharacterClassEscape] \d
# 122| [RegExpCharacterClass] [[:alpha:]]
# 119| [RegExpCharacterClass] [[:alpha:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
# 122| [RegExpSequence] [[:alpha:]][[:digit:]]
# 119| [RegExpSequence] [[:alpha:]][[:digit:]]
#-----| 0 -> [RegExpCharacterClass] [[:alpha:]]
#-----| 1 -> [RegExpCharacterClass] [[:digit:]]
# 122| [RegExpNamedCharacterProperty] [:alpha:]
# 119| [RegExpNamedCharacterProperty] [:alpha:]
# 122| [RegExpCharacterClass] [[:digit:]]
# 119| [RegExpCharacterClass] [[:digit:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:digit:]
# 122| [RegExpNamedCharacterProperty] [:digit:]
# 119| [RegExpNamedCharacterProperty] [:digit:]
# 125| [RegExpCharacterClass] [[:alpha:][:digit:]]
# 122| [RegExpCharacterClass] [[:alpha:][:digit:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
#-----| 1 -> [RegExpNamedCharacterProperty] [:digit:]
# 125| [RegExpNamedCharacterProperty] [:alpha:]
# 122| [RegExpNamedCharacterProperty] [:alpha:]
# 125| [RegExpNamedCharacterProperty] [:digit:]
# 122| [RegExpNamedCharacterProperty] [:digit:]
# 128| [RegExpCharacterClass] [A-F[:digit:]a-f]
# 125| [RegExpCharacterClass] [A-F[:digit:]a-f]
#-----| 0 -> [RegExpCharacterRange] A-F
#-----| 1 -> [RegExpNamedCharacterProperty] [:digit:]
#-----| 2 -> [RegExpCharacterRange] a-f
# 128| [RegExpConstant, RegExpNormalChar] A
# 125| [RegExpConstant, RegExpNormalChar] A
# 128| [RegExpCharacterRange] A-F
# 125| [RegExpCharacterRange] A-F
#-----| 0 -> [RegExpConstant, RegExpNormalChar] A
#-----| 1 -> [RegExpConstant, RegExpNormalChar] F
# 128| [RegExpConstant, RegExpNormalChar] F
# 125| [RegExpConstant, RegExpNormalChar] F
# 128| [RegExpNamedCharacterProperty] [:digit:]
# 125| [RegExpNamedCharacterProperty] [:digit:]
# 128| [RegExpConstant, RegExpNormalChar] a
# 125| [RegExpConstant, RegExpNormalChar] a
# 128| [RegExpCharacterRange] a-f
# 125| [RegExpCharacterRange] a-f
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpNormalChar] f
# 128| [RegExpConstant, RegExpNormalChar] f
# 125| [RegExpConstant, RegExpNormalChar] f
# 131| [RegExpNamedCharacterProperty] [:digit:]
# 128| [RegExpNamedCharacterProperty] [:digit:]
# 136| [RegExpConstant, RegExpEscape] \u9879
# 133| [RegExpConstant, RegExpEscape] \u9879
# 141| [RegExpConstant, RegExpNormalChar] a
# 141| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 141| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 141| [RegExpConstant, RegExpNormalChar] b
# 144| [RegExpConstant, RegExpNormalChar] a
@@ -534,56 +530,56 @@ test.cpp:
# 144| [RegExpConstant, RegExpNormalChar] b
# 147| [RegExpConstant, RegExpNormalChar] a
# 147| [RegExpCharacterClassEscape] \s
# 147| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 147| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 147| [RegExpConstant, RegExpNormalChar] b
# 150| [RegExpCharacterClassEscape] \s
# 150| [RegExpPlus] \s+
# 147| [RegExpPlus] \s+
#-----| 0 -> [RegExpCharacterClassEscape] \s
# 150| [RegExpSequence] \s+$
# 147| [RegExpSequence] \s+$
#-----| 0 -> [RegExpPlus] \s+
#-----| 1 -> [RegExpDollar] $
# 150| [RegExpDollar] $
# 147| [RegExpDollar] $
# 153| [RegExpConstant, RegExpEscape] \(
# 150| [RegExpConstant, RegExpEscape] \(
# 153| [RegExpSequence] \(([,\w]+)+\)$
# 150| [RegExpSequence] \(([,\w]+)+\)$
#-----| 0 -> [RegExpConstant, RegExpEscape] \(
#-----| 1 -> [RegExpPlus] ([,\w]+)+
#-----| 2 -> [RegExpConstant, RegExpEscape] \)
#-----| 3 -> [RegExpDollar] $
# 153| [RegExpGroup] ([,\w]+)
# 150| [RegExpGroup] ([,\w]+)
#-----| 0 -> [RegExpPlus] [,\w]+
# 153| [RegExpPlus] ([,\w]+)+
# 150| [RegExpPlus] ([,\w]+)+
#-----| 0 -> [RegExpGroup] ([,\w]+)
# 153| [RegExpCharacterClass] [,\w]
# 150| [RegExpCharacterClass] [,\w]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] ,
#-----| 1 -> [RegExpCharacterClassEscape] \w
# 153| [RegExpPlus] [,\w]+
# 150| [RegExpPlus] [,\w]+
#-----| 0 -> [RegExpCharacterClass] [,\w]
# 153| [RegExpConstant, RegExpNormalChar] ,
# 150| [RegExpConstant, RegExpNormalChar] ,
# 153| [RegExpCharacterClassEscape] \w
# 150| [RegExpCharacterClassEscape] \w
# 153| [RegExpConstant, RegExpEscape] \)
# 150| [RegExpConstant, RegExpEscape] \)
# 153| [RegExpDollar] $
# 150| [RegExpDollar] $
# 153| [RegExpConstant, RegExpNormalChar] a
# 153| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 153| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 153| [RegExpConstant, RegExpNormalChar] b
# 156| [RegExpConstant, RegExpNormalChar] a
@@ -607,29 +603,18 @@ test.cpp:
# 159| [RegExpConstant, RegExpNormalChar] b
# 162| [RegExpConstant, RegExpNormalChar] a
# 163| [RegExpCharacterClassEscape] \s
# 162| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 162| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 162| [RegExpConstant, RegExpNormalChar] b
# 166| [RegExpCharacterClassEscape] \s
# 166| [RegExpPlus] \s+
# 163| [RegExpPlus] \s+
#-----| 0 -> [RegExpCharacterClassEscape] \s
# 169| [RegExpConstant, RegExpNormalChar] a
# 166| [RegExpConstant, RegExpNormalChar] a
# 169| [RegExpSequence] a\.b
# 166| [RegExpSequence] a\.b
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpEscape] \.
#-----| 2 -> [RegExpConstant, RegExpNormalChar] b
# 169| [RegExpConstant, RegExpEscape] \.
# 166| [RegExpConstant, RegExpEscape] \.
# 169| [RegExpConstant, RegExpNormalChar] b
# 166| [RegExpConstant, RegExpNormalChar] b

View File

@@ -8,7 +8,7 @@ groupNumber
| test.cpp:108:21:108:30 | (?<id>\\w+) | 1 |
| test.cpp:112:23:112:26 | (a+) | 1 |
| test.cpp:113:23:113:32 | (?<qux>q+) | 1 |
| test.cpp:153:26:153:33 | ([,\\w]+) | 1 |
| test.cpp:150:26:150:33 | ([,\\w]+) | 1 |
term
| test.cpp:33:21:33:23 | abc | RegExpConstant,RegExpNormalChar |
| test.cpp:36:22:36:22 | a | RegExpConstant,RegExpNormalChar |
@@ -172,76 +172,70 @@ term
| test.cpp:113:33:113:35 | \\s+ | RegExpPlus |
| test.cpp:113:36:113:42 | \\k<qux> | RegExpBackRef |
| test.cpp:113:36:113:43 | \\k<qux>+ | RegExpPlus |
| test.cpp:116:23:116:30 | \\p{Word} | RegExpNamedCharacterProperty |
| test.cpp:116:23:116:31 | \\p{Word}* | RegExpStar |
| test.cpp:117:23:117:31 | \\P{Digit} | RegExpNamedCharacterProperty |
| test.cpp:117:23:117:32 | \\P{Digit}+ | RegExpPlus |
| test.cpp:118:23:118:32 | \\p{^Alnum} | RegExpNamedCharacterProperty |
| test.cpp:118:23:118:37 | \\p{^Alnum}{2,3} | RegExpRange |
| test.cpp:119:23:119:36 | [a-f\\p{Digit}] | RegExpCharacterClass |
| test.cpp:119:23:119:37 | [a-f\\p{Digit}]+ | RegExpPlus |
| test.cpp:119:24:119:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:119:24:119:26 | a-f | RegExpCharacterRange |
| test.cpp:119:26:119:26 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:119:27:119:35 | \\p{Digit} | RegExpNamedCharacterProperty |
| test.cpp:122:24:122:34 | [[:alpha:]] | RegExpCharacterClass |
| test.cpp:122:24:122:45 | [[:alpha:]][[:digit:]] | RegExpSequence |
| test.cpp:116:23:116:29 | [a-f\\d] | RegExpCharacterClass |
| test.cpp:116:23:116:30 | [a-f\\d]+ | RegExpPlus |
| test.cpp:116:24:116:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:116:24:116:26 | a-f | RegExpCharacterRange |
| test.cpp:116:26:116:26 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:116:27:116:28 | \\d | RegExpCharacterClassEscape |
| test.cpp:119:24:119:34 | [[:alpha:]] | RegExpCharacterClass |
| test.cpp:119:24:119:45 | [[:alpha:]][[:digit:]] | RegExpSequence |
| test.cpp:119:25:119:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:119:35:119:45 | [[:digit:]] | RegExpCharacterClass |
| test.cpp:119:36:119:44 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:122:24:122:43 | [[:alpha:][:digit:]] | RegExpCharacterClass |
| test.cpp:122:25:122:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:122:35:122:45 | [[:digit:]] | RegExpCharacterClass |
| test.cpp:122:36:122:44 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:125:24:125:43 | [[:alpha:][:digit:]] | RegExpCharacterClass |
| test.cpp:125:25:125:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:125:34:125:42 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:128:24:128:40 | [A-F[:digit:]a-f] | RegExpCharacterClass |
| test.cpp:128:25:128:25 | A | RegExpConstant,RegExpNormalChar |
| test.cpp:128:25:128:27 | A-F | RegExpCharacterRange |
| test.cpp:128:27:128:27 | F | RegExpConstant,RegExpNormalChar |
| test.cpp:128:28:128:36 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:128:37:128:37 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:128:37:128:39 | a-f | RegExpCharacterRange |
| test.cpp:128:39:128:39 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:131:24:131:32 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:136:21:136:26 | \\u9879 | RegExpConstant,RegExpEscape |
| test.cpp:122:34:122:42 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:125:24:125:40 | [A-F[:digit:]a-f] | RegExpCharacterClass |
| test.cpp:125:25:125:25 | A | RegExpConstant,RegExpNormalChar |
| test.cpp:125:25:125:27 | A-F | RegExpCharacterRange |
| test.cpp:125:27:125:27 | F | RegExpConstant,RegExpNormalChar |
| test.cpp:125:28:125:36 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:125:37:125:37 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:125:37:125:39 | a-f | RegExpCharacterRange |
| test.cpp:125:39:125:39 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:128:24:128:32 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:133:21:133:26 | \\u9879 | RegExpConstant,RegExpEscape |
| test.cpp:141:23:141:23 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:141:23:141:24 | a+ | RegExpPlus |
| test.cpp:141:23:141:25 | a+b | RegExpSequence |
| test.cpp:141:25:141:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:144:23:144:23 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:144:23:144:24 | a+ | RegExpPlus |
| test.cpp:144:23:144:25 | a+b | RegExpSequence |
| test.cpp:144:25:144:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:147:23:147:23 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:147:23:147:24 | a+ | RegExpPlus |
| test.cpp:147:23:147:25 | a+b | RegExpSequence |
| test.cpp:147:25:147:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:150:24:150:25 | \\s | RegExpCharacterClassEscape |
| test.cpp:150:24:150:26 | \\s+ | RegExpPlus |
| test.cpp:150:24:150:27 | \\s+$ | RegExpSequence |
| test.cpp:150:27:150:27 | $ | RegExpDollar |
| test.cpp:153:24:153:25 | \\( | RegExpConstant,RegExpEscape |
| test.cpp:153:24:153:37 | \\(([,\\w]+)+\\)$ | RegExpSequence |
| test.cpp:153:26:153:33 | ([,\\w]+) | RegExpGroup |
| test.cpp:153:26:153:34 | ([,\\w]+)+ | RegExpPlus |
| test.cpp:153:27:153:31 | [,\\w] | RegExpCharacterClass |
| test.cpp:153:27:153:32 | [,\\w]+ | RegExpPlus |
| test.cpp:153:28:153:28 | , | RegExpConstant,RegExpNormalChar |
| test.cpp:153:29:153:30 | \\w | RegExpCharacterClassEscape |
| test.cpp:153:35:153:36 | \\) | RegExpConstant,RegExpEscape |
| test.cpp:153:37:153:37 | $ | RegExpDollar |
| test.cpp:156:25:156:25 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:156:25:156:26 | a+ | RegExpPlus |
| test.cpp:156:25:156:27 | a+b | RegExpSequence |
| test.cpp:156:27:156:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:159:24:159:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:159:24:159:25 | a+ | RegExpPlus |
| test.cpp:159:24:159:26 | a+b | RegExpSequence |
| test.cpp:159:26:159:26 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:162:30:162:30 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:162:30:162:31 | a+ | RegExpPlus |
| test.cpp:162:30:162:32 | a+b | RegExpSequence |
| test.cpp:162:32:162:32 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:166:22:166:23 | \\s | RegExpCharacterClassEscape |
| test.cpp:166:22:166:24 | \\s+ | RegExpPlus |
| test.cpp:169:22:169:22 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:169:22:169:25 | a\\.b | RegExpSequence |
| test.cpp:169:23:169:24 | \\. | RegExpConstant,RegExpEscape |
| test.cpp:169:25:169:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:147:24:147:25 | \\s | RegExpCharacterClassEscape |
| test.cpp:147:24:147:26 | \\s+ | RegExpPlus |
| test.cpp:147:24:147:27 | \\s+$ | RegExpSequence |
| test.cpp:147:27:147:27 | $ | RegExpDollar |
| test.cpp:150:24:150:25 | \\( | RegExpConstant,RegExpEscape |
| test.cpp:150:24:150:37 | \\(([,\\w]+)+\\)$ | RegExpSequence |
| test.cpp:150:26:150:33 | ([,\\w]+) | RegExpGroup |
| test.cpp:150:26:150:34 | ([,\\w]+)+ | RegExpPlus |
| test.cpp:150:27:150:31 | [,\\w] | RegExpCharacterClass |
| test.cpp:150:27:150:32 | [,\\w]+ | RegExpPlus |
| test.cpp:150:28:150:28 | , | RegExpConstant,RegExpNormalChar |
| test.cpp:150:29:150:30 | \\w | RegExpCharacterClassEscape |
| test.cpp:150:35:150:36 | \\) | RegExpConstant,RegExpEscape |
| test.cpp:150:37:150:37 | $ | RegExpDollar |
| test.cpp:153:25:153:25 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:153:25:153:26 | a+ | RegExpPlus |
| test.cpp:153:25:153:27 | a+b | RegExpSequence |
| test.cpp:153:27:153:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:156:24:156:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:156:24:156:25 | a+ | RegExpPlus |
| test.cpp:156:24:156:26 | a+b | RegExpSequence |
| test.cpp:156:26:156:26 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:159:30:159:30 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:159:30:159:31 | a+ | RegExpPlus |
| test.cpp:159:30:159:32 | a+b | RegExpSequence |
| test.cpp:159:32:159:32 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:163:22:163:23 | \\s | RegExpCharacterClassEscape |
| test.cpp:163:22:163:24 | \\s+ | RegExpPlus |
| test.cpp:166:22:166:22 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:166:22:166:25 | a\\.b | RegExpSequence |
| test.cpp:166:23:166:24 | \\. | RegExpConstant,RegExpEscape |
| test.cpp:166:25:166:25 | b | RegExpConstant,RegExpNormalChar |
regExpNormalCharValue
| test.cpp:33:21:33:23 | abc | abc |
| test.cpp:36:22:36:22 | a | a |
@@ -312,29 +306,30 @@ regExpNormalCharValue
| test.cpp:112:27:112:27 | b | b |
| test.cpp:113:30:113:30 | q | q |
| test.cpp:113:33:113:34 | \\s | s |
| test.cpp:119:24:119:24 | a | a |
| test.cpp:119:26:119:26 | f | f |
| test.cpp:128:25:128:25 | A | A |
| test.cpp:128:27:128:27 | F | F |
| test.cpp:128:37:128:37 | a | a |
| test.cpp:128:39:128:39 | f | f |
| test.cpp:136:21:136:26 | \\u9879 | \u9879 |
| test.cpp:116:24:116:24 | a | a |
| test.cpp:116:26:116:26 | f | f |
| test.cpp:116:27:116:28 | \\d | d |
| test.cpp:125:25:125:25 | A | A |
| test.cpp:125:27:125:27 | F | F |
| test.cpp:125:37:125:37 | a | a |
| test.cpp:125:39:125:39 | f | f |
| test.cpp:133:21:133:26 | \\u9879 | \u9879 |
| test.cpp:141:23:141:23 | a | a |
| test.cpp:141:25:141:25 | b | b |
| test.cpp:144:23:144:23 | a | a |
| test.cpp:144:25:144:25 | b | b |
| test.cpp:147:23:147:23 | a | a |
| test.cpp:147:25:147:25 | b | b |
| test.cpp:150:24:150:25 | \\s | s |
| test.cpp:153:24:153:25 | \\( | ( |
| test.cpp:153:28:153:28 | , | , |
| test.cpp:153:29:153:30 | \\w | w |
| test.cpp:153:35:153:36 | \\) | ) |
| test.cpp:156:25:156:25 | a | a |
| test.cpp:156:27:156:27 | b | b |
| test.cpp:159:24:159:24 | a | a |
| test.cpp:159:26:159:26 | b | b |
| test.cpp:162:30:162:30 | a | a |
| test.cpp:162:32:162:32 | b | b |
| test.cpp:166:22:166:23 | \\s | s |
| test.cpp:169:22:169:22 | a | a |
| test.cpp:169:23:169:24 | \\. | . |
| test.cpp:169:25:169:25 | b | b |
| test.cpp:147:24:147:25 | \\s | s |
| test.cpp:150:24:150:25 | \\( | ( |
| test.cpp:150:28:150:28 | , | , |
| test.cpp:150:29:150:30 | \\w | w |
| test.cpp:150:35:150:36 | \\) | ) |
| test.cpp:153:25:153:25 | a | a |
| test.cpp:153:27:153:27 | b | b |
| test.cpp:156:24:156:24 | a | a |
| test.cpp:156:26:156:26 | b | b |
| test.cpp:159:30:159:30 | a | a |
| test.cpp:159:32:159:32 | b | b |
| test.cpp:163:22:163:23 | \\s | s |
| test.cpp:166:22:166:22 | a | a |
| test.cpp:166:23:166:24 | \\. | . |
| test.cpp:166:25:166:25 | b | b |

View File

@@ -112,11 +112,8 @@ void test() {
std::regex r_bref1("(a+)b+\\1");
std::regex r_bref2("(?<qux>q+)\\s+\\k<qux>+");
// Named character properties using the p-style syntax
std::regex r_prop1("\\p{Word}*");
std::regex r_prop2("\\P{Digit}+");
std::regex r_prop3("\\p{^Alnum}{2,3}");
std::regex r_prop4("[a-f\\p{Digit}]+"); // Also valid inside character classes
// A character class combining a range with an escape class
std::regex r_prop1("[a-f\\d]+");
// Two separate character classes, each containing a single POSIX bracket expression
std::regex r_posix1("[[:alpha:]][[:digit:]]");