Commit 6: Add POSIX-bracket extension tests (pre-fix, capturing incorrect tokenization)

Add new test cases to test.cpp exercising POSIX bracket expressions inside
character classes as supported by std::regex ECMAScript mode:
- Single POSIX classes: [[:alpha:]], [[:digit:]], [[:space:]], [[:upper:]],
  [[:lower:]], [[:alnum:]], [[:print:]], [[:punct:]]
- Negated outer bracket: [^[:space:]]
- Mixed: regular char + POSIX class [a[:space:]]
- POSIX collating symbol [[.a.]]
- POSIX equivalence class [[=a=]]
- Mixed POSIX + range [[:alpha:]0-9]

The existing r_posix1-r_posix4 cases remain untouched. New cases use distinct
names (r_posix_alpha, r_posix_digit, etc.) to avoid redeclaration.

Generated .expected via codeql test run --learn (CodeQL 2.26.1); all 2 tests
pass. The expected output captures the CURRENT (pre-fix) tokenization — commit 7
will change these rows when correct POSIX nesting is implemented.
This commit is contained in:
copilot-swe-agent[bot]
2026-07-21 10:17:14 +00:00
committed by GitHub
parent 67ff5896a8
commit 9fd7e949c8
3 changed files with 414 additions and 226 deletions

View File

@@ -192,256 +192,363 @@ test.cpp:
# 57| [RegExpConstant, RegExpNormalChar] A-F]
# 60| [RegExpDot] .
# 63| [RegExpCharacterClass] [[:alpha:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
# 60| [RegExpStar] .*
# 63| [RegExpNamedCharacterProperty] [:alpha:]
# 64| [RegExpCharacterClass] [[:digit:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:digit:]
# 64| [RegExpNamedCharacterProperty] [:digit:]
# 65| [RegExpCharacterClass] [[:space:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:space:]
# 65| [RegExpNamedCharacterProperty] [:space:]
# 66| [RegExpCharacterClass] [[:upper:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:upper:]
# 66| [RegExpNamedCharacterProperty] [:upper:]
# 67| [RegExpCharacterClass] [[:lower:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:lower:]
# 67| [RegExpNamedCharacterProperty] [:lower:]
# 68| [RegExpCharacterClass] [[:alnum:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alnum:]
# 68| [RegExpNamedCharacterProperty] [:alnum:]
# 69| [RegExpCharacterClass] [[:print:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:print:]
# 69| [RegExpNamedCharacterProperty] [:print:]
# 70| [RegExpCharacterClass] [[:punct:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:punct:]
# 70| [RegExpNamedCharacterProperty] [:punct:]
# 73| [RegExpCharacterClass] [^[:space:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:space:]
# 73| [RegExpNamedCharacterProperty] [:space:]
# 76| [RegExpCharacterClass] [a[:space:]]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpNamedCharacterProperty] [:space:]
# 76| [RegExpConstant, RegExpNormalChar] a
# 76| [RegExpNamedCharacterProperty] [:space:]
# 79| [RegExpCharacterClass] [[.a.]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] [
#-----| 1 -> [RegExpConstant, RegExpNormalChar] .
#-----| 2 -> [RegExpConstant, RegExpNormalChar] a
#-----| 3 -> [RegExpConstant, RegExpNormalChar] .
# 79| [RegExpSequence] [[.a.]]
#-----| 0 -> [RegExpCharacterClass] [[.a.]
#-----| 1 -> [RegExpConstant, RegExpNormalChar] ]
# 79| [RegExpConstant, RegExpNormalChar] [
# 79| [RegExpConstant, RegExpNormalChar] .
# 79| [RegExpConstant, RegExpNormalChar] a
# 79| [RegExpConstant, RegExpNormalChar] .
# 79| [RegExpConstant, RegExpNormalChar] ]
# 82| [RegExpCharacterClass] [[=a=]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] [
#-----| 1 -> [RegExpConstant, RegExpNormalChar] =
#-----| 2 -> [RegExpConstant, RegExpNormalChar] a
#-----| 3 -> [RegExpConstant, RegExpNormalChar] =
# 82| [RegExpSequence] [[=a=]]
#-----| 0 -> [RegExpCharacterClass] [[=a=]
#-----| 1 -> [RegExpConstant, RegExpNormalChar] ]
# 82| [RegExpConstant, RegExpNormalChar] [
# 82| [RegExpConstant, RegExpNormalChar] =
# 82| [RegExpConstant, RegExpNormalChar] a
# 82| [RegExpConstant, RegExpNormalChar] =
# 82| [RegExpConstant, RegExpNormalChar] ]
# 85| [RegExpCharacterClass] [[:alpha:]0-9]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
#-----| 1 -> [RegExpCharacterRange] 0-9
# 85| [RegExpNamedCharacterProperty] [:alpha:]
# 85| [RegExpConstant, RegExpNormalChar] 0
# 85| [RegExpCharacterRange] 0-9
#-----| 0 -> [RegExpConstant, RegExpNormalChar] 0
#-----| 1 -> [RegExpConstant, RegExpNormalChar] 9
# 85| [RegExpConstant, RegExpNormalChar] 9
# 88| [RegExpDot] .
# 88| [RegExpStar] .*
#-----| 0 -> [RegExpDot] .
# 61| [RegExpCharacterClassEscape] \w
# 89| [RegExpCharacterClassEscape] \w
# 61| [RegExpPlus] \w+
# 89| [RegExpPlus] \w+
#-----| 0 -> [RegExpCharacterClassEscape] \w
# 61| [RegExpSequence] \w+\W
# 89| [RegExpSequence] \w+\W
#-----| 0 -> [RegExpPlus] \w+
#-----| 1 -> [RegExpCharacterClassEscape] \W
# 61| [RegExpCharacterClassEscape] \W
# 89| [RegExpCharacterClassEscape] \W
# 62| [RegExpCharacterClassEscape] \s
# 90| [RegExpCharacterClassEscape] \s
# 62| [RegExpSequence] \s\S
# 90| [RegExpSequence] \s\S
#-----| 0 -> [RegExpCharacterClassEscape] \s
#-----| 1 -> [RegExpCharacterClassEscape] \S
# 62| [RegExpCharacterClassEscape] \S
# 90| [RegExpCharacterClassEscape] \S
# 63| [RegExpCharacterClassEscape] \d
# 91| [RegExpCharacterClassEscape] \d
# 63| [RegExpSequence] \d\D
# 91| [RegExpSequence] \d\D
#-----| 0 -> [RegExpCharacterClassEscape] \d
#-----| 1 -> [RegExpCharacterClassEscape] \D
# 63| [RegExpCharacterClassEscape] \D
# 91| [RegExpCharacterClassEscape] \D
# 65| [RegExpConstant, RegExpEscape] \n
# 93| [RegExpConstant, RegExpEscape] \n
# 65| [RegExpSequence] \n\r\t
# 93| [RegExpSequence] \n\r\t
#-----| 0 -> [RegExpConstant, RegExpEscape] \n
#-----| 1 -> [RegExpConstant, RegExpEscape] \r
#-----| 2 -> [RegExpConstant, RegExpEscape] \t
# 65| [RegExpConstant, RegExpEscape] \r
# 93| [RegExpConstant, RegExpEscape] \r
# 65| [RegExpConstant, RegExpEscape] \t
# 93| [RegExpConstant, RegExpEscape] \t
# 69| [RegExpSpecialChar] \b
# 97| [RegExpSpecialChar] \b
# 69| [RegExpSequence] \b!a\B
# 97| [RegExpSequence] \b!a\B
#-----| 0 -> [RegExpSpecialChar] \b
#-----| 1 -> [RegExpConstant, RegExpNormalChar] !a
#-----| 2 -> [RegExpNonWordBoundary] \B
# 69| [RegExpConstant, RegExpNormalChar] !a
# 97| [RegExpConstant, RegExpNormalChar] !a
# 69| [RegExpNonWordBoundary] \B
# 97| [RegExpNonWordBoundary] \B
# 72| [RegExpGroup] (foo)
# 100| [RegExpGroup] (foo)
#-----| 0 -> [RegExpConstant, RegExpNormalChar] foo
# 72| [RegExpStar] (foo)*
# 100| [RegExpStar] (foo)*
#-----| 0 -> [RegExpGroup] (foo)
# 72| [RegExpSequence] (foo)*bar
# 100| [RegExpSequence] (foo)*bar
#-----| 0 -> [RegExpStar] (foo)*
#-----| 1 -> [RegExpConstant, RegExpNormalChar] bar
# 72| [RegExpConstant, RegExpNormalChar] foo
# 100| [RegExpConstant, RegExpNormalChar] foo
# 72| [RegExpConstant, RegExpNormalChar] bar
# 100| [RegExpConstant, RegExpNormalChar] bar
# 73| [RegExpConstant, RegExpNormalChar] fo
# 101| [RegExpConstant, RegExpNormalChar] fo
# 73| [RegExpSequence] fo(o|b)ar
# 101| [RegExpSequence] fo(o|b)ar
#-----| 0 -> [RegExpConstant, RegExpNormalChar] fo
#-----| 1 -> [RegExpGroup] (o|b)
#-----| 2 -> [RegExpConstant, RegExpNormalChar] ar
# 73| [RegExpGroup] (o|b)
# 101| [RegExpGroup] (o|b)
#-----| 0 -> [RegExpAlt] o|b
# 73| [RegExpConstant, RegExpNormalChar] o
# 101| [RegExpConstant, RegExpNormalChar] o
# 73| [RegExpAlt] o|b
# 101| [RegExpAlt] o|b
#-----| 0 -> [RegExpConstant, RegExpNormalChar] o
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 73| [RegExpConstant, RegExpNormalChar] b
# 101| [RegExpConstant, RegExpNormalChar] b
# 73| [RegExpConstant, RegExpNormalChar] ar
# 101| [RegExpConstant, RegExpNormalChar] ar
# 74| [RegExpGroup] (a|b|cd)
# 102| [RegExpGroup] (a|b|cd)
#-----| 0 -> [RegExpAlt] a|b|cd
# 74| [RegExpSequence] (a|b|cd)e
# 102| [RegExpSequence] (a|b|cd)e
#-----| 0 -> [RegExpGroup] (a|b|cd)
#-----| 1 -> [RegExpConstant, RegExpNormalChar] e
# 74| [RegExpConstant, RegExpNormalChar] a
# 102| [RegExpConstant, RegExpNormalChar] a
# 74| [RegExpAlt] a|b|cd
# 102| [RegExpAlt] a|b|cd
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
#-----| 2 -> [RegExpConstant, RegExpNormalChar] cd
# 74| [RegExpConstant, RegExpNormalChar] b
# 102| [RegExpConstant, RegExpNormalChar] b
# 74| [RegExpConstant, RegExpNormalChar] cd
# 102| [RegExpConstant, RegExpNormalChar] cd
# 74| [RegExpConstant, RegExpNormalChar] e
# 102| [RegExpConstant, RegExpNormalChar] e
# 75| [RegExpGroup] (?::+)
# 103| [RegExpGroup] (?::+)
#-----| 0 -> [RegExpPlus] :+
# 75| [RegExpSequence] (?::+)\w
# 103| [RegExpSequence] (?::+)\w
#-----| 0 -> [RegExpGroup] (?::+)
#-----| 1 -> [RegExpCharacterClassEscape] \w
# 75| [RegExpConstant, RegExpNormalChar] :
# 103| [RegExpConstant, RegExpNormalChar] :
# 75| [RegExpPlus] :+
# 103| [RegExpPlus] :+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] :
# 75| [RegExpCharacterClassEscape] \w
# 103| [RegExpCharacterClassEscape] \w
# 78| [RegExpGroup] (?<id>\w+)
# 106| [RegExpGroup] (?<id>\w+)
#-----| 0 -> [RegExpPlus] \w+
# 78| [RegExpCharacterClassEscape] \w
# 106| [RegExpCharacterClassEscape] \w
# 78| [RegExpPlus] \w+
# 106| [RegExpPlus] \w+
#-----| 0 -> [RegExpCharacterClassEscape] \w
# 82| [RegExpGroup] (a+)
# 110| [RegExpGroup] (a+)
#-----| 0 -> [RegExpPlus] a+
# 82| [RegExpSequence] (a+)b+\1
# 110| [RegExpSequence] (a+)b+\1
#-----| 0 -> [RegExpGroup] (a+)
#-----| 1 -> [RegExpPlus] b+
#-----| 2 -> [RegExpBackRef] \1
# 82| [RegExpConstant, RegExpNormalChar] a
# 110| [RegExpConstant, RegExpNormalChar] a
# 82| [RegExpPlus] a+
# 110| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 82| [RegExpConstant, RegExpNormalChar] b
# 110| [RegExpConstant, RegExpNormalChar] b
# 82| [RegExpPlus] b+
# 110| [RegExpPlus] b+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] b
# 82| [RegExpBackRef] \1
# 110| [RegExpBackRef] \1
# 83| [RegExpGroup] (?<qux>q+)
# 111| [RegExpGroup] (?<qux>q+)
#-----| 0 -> [RegExpPlus] q+
# 83| [RegExpSequence] (?<qux>q+)\s+\k<qux>+
# 111| [RegExpSequence] (?<qux>q+)\s+\k<qux>+
#-----| 0 -> [RegExpGroup] (?<qux>q+)
#-----| 1 -> [RegExpPlus] \s+
#-----| 2 -> [RegExpPlus] \k<qux>+
# 83| [RegExpConstant, RegExpNormalChar] q
# 111| [RegExpConstant, RegExpNormalChar] q
# 83| [RegExpPlus] q+
# 111| [RegExpPlus] q+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] q
# 83| [RegExpCharacterClassEscape] \s
# 111| [RegExpCharacterClassEscape] \s
# 83| [RegExpPlus] \s+
# 111| [RegExpPlus] \s+
#-----| 0 -> [RegExpCharacterClassEscape] \s
# 83| [RegExpBackRef] \k<qux>
# 111| [RegExpBackRef] \k<qux>
# 83| [RegExpPlus] \k<qux>+
# 111| [RegExpPlus] \k<qux>+
#-----| 0 -> [RegExpBackRef] \k<qux>
# 86| [RegExpNamedCharacterProperty] \p{Word}
# 114| [RegExpNamedCharacterProperty] \p{Word}
# 86| [RegExpStar] \p{Word}*
# 114| [RegExpStar] \p{Word}*
#-----| 0 -> [RegExpNamedCharacterProperty] \p{Word}
# 87| [RegExpNamedCharacterProperty] \P{Digit}
# 115| [RegExpNamedCharacterProperty] \P{Digit}
# 87| [RegExpPlus] \P{Digit}+
# 115| [RegExpPlus] \P{Digit}+
#-----| 0 -> [RegExpNamedCharacterProperty] \P{Digit}
# 88| [RegExpNamedCharacterProperty] \p{^Alnum}
# 116| [RegExpNamedCharacterProperty] \p{^Alnum}
# 88| [RegExpRange] \p{^Alnum}{2,3}
# 116| [RegExpRange] \p{^Alnum}{2,3}
#-----| 0 -> [RegExpNamedCharacterProperty] \p{^Alnum}
# 89| [RegExpCharacterClass] [a-f\p{Digit}]
# 117| [RegExpCharacterClass] [a-f\p{Digit}]
#-----| 0 -> [RegExpCharacterRange] a-f
#-----| 1 -> [RegExpNamedCharacterProperty] \p{Digit}
# 89| [RegExpPlus] [a-f\p{Digit}]+
# 117| [RegExpPlus] [a-f\p{Digit}]+
#-----| 0 -> [RegExpCharacterClass] [a-f\p{Digit}]
# 89| [RegExpConstant, RegExpNormalChar] a
# 117| [RegExpConstant, RegExpNormalChar] a
# 89| [RegExpCharacterRange] a-f
# 117| [RegExpCharacterRange] a-f
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpNormalChar] f
# 89| [RegExpConstant, RegExpNormalChar] f
# 117| [RegExpConstant, RegExpNormalChar] f
# 89| [RegExpNamedCharacterProperty] \p{Digit}
# 117| [RegExpNamedCharacterProperty] \p{Digit}
# 92| [RegExpCharacterClass] [[:alpha:]]
# 120| [RegExpCharacterClass] [[:alpha:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
# 92| [RegExpSequence] [[:alpha:]][[:digit:]]
# 120| [RegExpSequence] [[:alpha:]][[:digit:]]
#-----| 0 -> [RegExpCharacterClass] [[:alpha:]]
#-----| 1 -> [RegExpCharacterClass] [[:digit:]]
# 92| [RegExpNamedCharacterProperty] [:alpha:]
# 120| [RegExpNamedCharacterProperty] [:alpha:]
# 92| [RegExpCharacterClass] [[:digit:]]
# 120| [RegExpCharacterClass] [[:digit:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:digit:]
# 92| [RegExpNamedCharacterProperty] [:digit:]
# 120| [RegExpNamedCharacterProperty] [:digit:]
# 95| [RegExpCharacterClass] [[:alpha:][:digit:]]
# 123| [RegExpCharacterClass] [[:alpha:][:digit:]]
#-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:]
#-----| 1 -> [RegExpNamedCharacterProperty] [:digit:]
# 95| [RegExpNamedCharacterProperty] [:alpha:]
# 123| [RegExpNamedCharacterProperty] [:alpha:]
# 95| [RegExpNamedCharacterProperty] [:digit:]
# 123| [RegExpNamedCharacterProperty] [:digit:]
# 98| [RegExpCharacterClass] [A-F[:digit:]a-f]
# 126| [RegExpCharacterClass] [A-F[:digit:]a-f]
#-----| 0 -> [RegExpCharacterRange] A-F
#-----| 1 -> [RegExpNamedCharacterProperty] [:digit:]
#-----| 2 -> [RegExpCharacterRange] a-f
# 98| [RegExpConstant, RegExpNormalChar] A
# 126| [RegExpConstant, RegExpNormalChar] A
# 98| [RegExpCharacterRange] A-F
# 126| [RegExpCharacterRange] A-F
#-----| 0 -> [RegExpConstant, RegExpNormalChar] A
#-----| 1 -> [RegExpConstant, RegExpNormalChar] F
# 98| [RegExpConstant, RegExpNormalChar] F
# 126| [RegExpConstant, RegExpNormalChar] F
# 98| [RegExpNamedCharacterProperty] [:digit:]
# 126| [RegExpNamedCharacterProperty] [:digit:]
# 98| [RegExpConstant, RegExpNormalChar] a
# 126| [RegExpConstant, RegExpNormalChar] a
# 98| [RegExpCharacterRange] a-f
# 126| [RegExpCharacterRange] a-f
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
#-----| 1 -> [RegExpConstant, RegExpNormalChar] f
# 98| [RegExpConstant, RegExpNormalChar] f
# 126| [RegExpConstant, RegExpNormalChar] f
# 101| [RegExpNamedCharacterProperty] [:digit:]
# 129| [RegExpNamedCharacterProperty] [:digit:]
# 106| [RegExpConstant, RegExpEscape] \u{987
# 134| [RegExpConstant, RegExpEscape] \u{987

View File

@@ -1,13 +1,13 @@
groupName
| test.cpp:78:21:78:30 | (?<id>\\w+) | id |
| test.cpp:83:23:83:32 | (?<qux>q+) | qux |
| test.cpp:106:21:106:30 | (?<id>\\w+) | id |
| test.cpp:111:23:111:32 | (?<qux>q+) | qux |
groupNumber
| test.cpp:72:22:72:26 | (foo) | 1 |
| test.cpp:73:24:73:28 | (o\|b) | 1 |
| test.cpp:74:22:74:29 | (a\|b\|cd) | 1 |
| test.cpp:78:21:78:30 | (?<id>\\w+) | 1 |
| test.cpp:82:23:82:26 | (a+) | 1 |
| test.cpp:83:23:83:32 | (?<qux>q+) | 1 |
| test.cpp:100:22:100:26 | (foo) | 1 |
| test.cpp:101:24:101:28 | (o\|b) | 1 |
| test.cpp:102:22:102:29 | (a\|b\|cd) | 1 |
| test.cpp:106:21:106:30 | (?<id>\\w+) | 1 |
| test.cpp:110:23:110:26 | (a+) | 1 |
| test.cpp:111:23:111:32 | (?<qux>q+) | 1 |
term
| test.cpp:31:21:31:23 | abc | RegExpConstant,RegExpNormalChar |
| test.cpp:34:22:34:22 | a | RegExpConstant,RegExpNormalChar |
@@ -79,98 +79,138 @@ term
| test.cpp:57:26:57:28 | a-f | RegExpCharacterRange |
| test.cpp:57:28:57:28 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:57:30:57:33 | A-F] | RegExpConstant,RegExpNormalChar |
| test.cpp:60:23:60:23 | . | RegExpDot |
| test.cpp:60:23:60:24 | .* | RegExpStar |
| test.cpp:61:23:61:24 | \\w | RegExpCharacterClassEscape |
| test.cpp:61:23:61:25 | \\w+ | RegExpPlus |
| test.cpp:61:23:61:27 | \\w+\\W | RegExpSequence |
| test.cpp:61:26:61:27 | \\W | RegExpCharacterClassEscape |
| test.cpp:62:23:62:24 | \\s | RegExpCharacterClassEscape |
| test.cpp:62:23:62:26 | \\s\\S | RegExpSequence |
| test.cpp:62:25:62:26 | \\S | RegExpCharacterClassEscape |
| test.cpp:63:23:63:24 | \\d | RegExpCharacterClassEscape |
| test.cpp:63:23:63:26 | \\d\\D | RegExpSequence |
| test.cpp:63:25:63:26 | \\D | RegExpCharacterClassEscape |
| test.cpp:65:23:65:24 | \\n | RegExpConstant,RegExpEscape |
| test.cpp:65:23:65:28 | \\n\\r\\t | RegExpSequence |
| test.cpp:65:25:65:26 | \\r | RegExpConstant,RegExpEscape |
| test.cpp:65:27:65:28 | \\t | RegExpConstant,RegExpEscape |
| test.cpp:69:22:69:23 | \\b | RegExpSpecialChar |
| test.cpp:69:22:69:27 | \\b!a\\B | RegExpSequence |
| test.cpp:69:24:69:25 | !a | RegExpConstant,RegExpNormalChar |
| test.cpp:69:26:69:27 | \\B | RegExpNonWordBoundary |
| test.cpp:72:22:72:26 | (foo) | RegExpGroup |
| test.cpp:72:22:72:27 | (foo)* | RegExpStar |
| test.cpp:72:22:72:30 | (foo)*bar | RegExpSequence |
| test.cpp:72:23:72:25 | foo | RegExpConstant,RegExpNormalChar |
| test.cpp:72:28:72:30 | bar | RegExpConstant,RegExpNormalChar |
| test.cpp:73:22:73:23 | fo | RegExpConstant,RegExpNormalChar |
| test.cpp:73:22:73:30 | fo(o\|b)ar | RegExpSequence |
| test.cpp:73:24:73:28 | (o\|b) | RegExpGroup |
| test.cpp:73:25:73:25 | o | RegExpConstant,RegExpNormalChar |
| test.cpp:73:25:73:27 | o\|b | RegExpAlt |
| test.cpp:73:27:73:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:73:29:73:30 | ar | RegExpConstant,RegExpNormalChar |
| test.cpp:74:22:74:29 | (a\|b\|cd) | RegExpGroup |
| test.cpp:74:22:74:30 | (a\|b\|cd)e | RegExpSequence |
| test.cpp:74:23:74:23 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:74:23:74:28 | a\|b\|cd | RegExpAlt |
| test.cpp:74:25:74:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:74:27:74:28 | cd | RegExpConstant,RegExpNormalChar |
| test.cpp:74:30:74:30 | e | RegExpConstant,RegExpNormalChar |
| test.cpp:75:22:75:27 | (?::+) | RegExpGroup |
| test.cpp:75:22:75:29 | (?::+)\\w | RegExpSequence |
| test.cpp:75:25:75:25 | : | RegExpConstant,RegExpNormalChar |
| test.cpp:75:25:75:26 | :+ | RegExpPlus |
| test.cpp:75:28:75:29 | \\w | RegExpCharacterClassEscape |
| test.cpp:78:21:78:30 | (?<id>\\w+) | RegExpGroup |
| test.cpp:78:27:78:28 | \\w | RegExpCharacterClassEscape |
| test.cpp:78:27:78:29 | \\w+ | RegExpPlus |
| test.cpp:82:23:82:26 | (a+) | RegExpGroup |
| test.cpp:82:23:82:30 | (a+)b+\\1 | RegExpSequence |
| test.cpp:82:24:82:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:82:24:82:25 | a+ | RegExpPlus |
| test.cpp:82:27:82:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:82:27:82:28 | b+ | RegExpPlus |
| test.cpp:82:29:82:30 | \\1 | RegExpBackRef |
| test.cpp:83:23:83:32 | (?<qux>q+) | RegExpGroup |
| test.cpp:83:23:83:43 | (?<qux>q+)\\s+\\k<qux>+ | RegExpSequence |
| test.cpp:83:30:83:30 | q | RegExpConstant,RegExpNormalChar |
| test.cpp:83:30:83:31 | q+ | RegExpPlus |
| test.cpp:83:33:83:34 | \\s | RegExpCharacterClassEscape |
| test.cpp:83:33:83:35 | \\s+ | RegExpPlus |
| test.cpp:83:36:83:42 | \\k<qux> | RegExpBackRef |
| test.cpp:83:36:83:43 | \\k<qux>+ | RegExpPlus |
| test.cpp:86:23:86:30 | \\p{Word} | RegExpNamedCharacterProperty |
| test.cpp:86:23:86:31 | \\p{Word}* | RegExpStar |
| test.cpp:87:23:87:31 | \\P{Digit} | RegExpNamedCharacterProperty |
| test.cpp:87:23:87:32 | \\P{Digit}+ | RegExpPlus |
| test.cpp:88:23:88:32 | \\p{^Alnum} | RegExpNamedCharacterProperty |
| test.cpp:88:23:88:37 | \\p{^Alnum}{2,3} | RegExpRange |
| test.cpp:89:23:89:36 | [a-f\\p{Digit}] | RegExpCharacterClass |
| test.cpp:89:23:89:37 | [a-f\\p{Digit}]+ | RegExpPlus |
| test.cpp:89:24:89:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:89:24:89:26 | a-f | RegExpCharacterRange |
| test.cpp:89:26:89:26 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:89:27:89:35 | \\p{Digit} | RegExpNamedCharacterProperty |
| test.cpp:92:24:92:34 | [[:alpha:]] | RegExpCharacterClass |
| test.cpp:92:24:92:45 | [[:alpha:]][[:digit:]] | RegExpSequence |
| test.cpp:92:25:92:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:92:35:92:45 | [[:digit:]] | RegExpCharacterClass |
| test.cpp:92:36:92:44 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:95:24:95:43 | [[:alpha:][:digit:]] | RegExpCharacterClass |
| test.cpp:95:25:95:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:95:34:95:42 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:98:24:98:40 | [A-F[:digit:]a-f] | RegExpCharacterClass |
| test.cpp:98:25:98:25 | A | RegExpConstant,RegExpNormalChar |
| test.cpp:98:25:98:27 | A-F | RegExpCharacterRange |
| test.cpp:98:27:98:27 | F | RegExpConstant,RegExpNormalChar |
| test.cpp:98:28:98:36 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:98:37:98:37 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:98:37:98:39 | a-f | RegExpCharacterRange |
| test.cpp:98:39:98:39 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:101:24:101:32 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:106:21:106:26 | \\u{987 | RegExpConstant,RegExpEscape |
| test.cpp:63:29:63:39 | [[:alpha:]] | RegExpCharacterClass |
| test.cpp:63:30:63:38 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:64:29:64:39 | [[:digit:]] | RegExpCharacterClass |
| test.cpp:64:30:64:38 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:65:29:65:39 | [[:space:]] | RegExpCharacterClass |
| test.cpp:65:30:65:38 | [:space:] | RegExpNamedCharacterProperty |
| test.cpp:66:29:66:39 | [[:upper:]] | RegExpCharacterClass |
| test.cpp:66:30:66:38 | [:upper:] | RegExpNamedCharacterProperty |
| test.cpp:67:29:67:39 | [[:lower:]] | RegExpCharacterClass |
| test.cpp:67:30:67:38 | [:lower:] | RegExpNamedCharacterProperty |
| test.cpp:68:29:68:39 | [[:alnum:]] | RegExpCharacterClass |
| test.cpp:68:30:68:38 | [:alnum:] | RegExpNamedCharacterProperty |
| test.cpp:69:29:69:39 | [[:print:]] | RegExpCharacterClass |
| test.cpp:69:30:69:38 | [:print:] | RegExpNamedCharacterProperty |
| test.cpp:70:29:70:39 | [[:punct:]] | RegExpCharacterClass |
| test.cpp:70:30:70:38 | [:punct:] | RegExpNamedCharacterProperty |
| test.cpp:73:27:73:38 | [^[:space:]] | RegExpCharacterClass |
| test.cpp:73:29:73:37 | [:space:] | RegExpNamedCharacterProperty |
| test.cpp:76:29:76:40 | [a[:space:]] | RegExpCharacterClass |
| test.cpp:76:30:76:30 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:76:31:76:39 | [:space:] | RegExpNamedCharacterProperty |
| test.cpp:79:28:79:33 | [[.a.] | RegExpCharacterClass |
| test.cpp:79:28:79:34 | [[.a.]] | RegExpSequence |
| test.cpp:79:29:79:29 | [ | RegExpConstant,RegExpNormalChar |
| test.cpp:79:30:79:30 | . | RegExpConstant,RegExpNormalChar |
| test.cpp:79:31:79:31 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:79:32:79:32 | . | RegExpConstant,RegExpNormalChar |
| test.cpp:79:34:79:34 | ] | RegExpConstant,RegExpNormalChar |
| test.cpp:82:29:82:34 | [[=a=] | RegExpCharacterClass |
| test.cpp:82:29:82:35 | [[=a=]] | RegExpSequence |
| test.cpp:82:30:82:30 | [ | RegExpConstant,RegExpNormalChar |
| test.cpp:82:31:82:31 | = | RegExpConstant,RegExpNormalChar |
| test.cpp:82:32:82:32 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:82:33:82:33 | = | RegExpConstant,RegExpNormalChar |
| test.cpp:82:35:82:35 | ] | RegExpConstant,RegExpNormalChar |
| test.cpp:85:29:85:42 | [[:alpha:]0-9] | RegExpCharacterClass |
| test.cpp:85:30:85:38 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:85:39:85:39 | 0 | RegExpConstant,RegExpNormalChar |
| test.cpp:85:39:85:41 | 0-9 | RegExpCharacterRange |
| test.cpp:85:41:85:41 | 9 | RegExpConstant,RegExpNormalChar |
| test.cpp:88:23:88:23 | . | RegExpDot |
| test.cpp:88:23:88:24 | .* | RegExpStar |
| test.cpp:89:23:89:24 | \\w | RegExpCharacterClassEscape |
| test.cpp:89:23:89:25 | \\w+ | RegExpPlus |
| test.cpp:89:23:89:27 | \\w+\\W | RegExpSequence |
| test.cpp:89:26:89:27 | \\W | RegExpCharacterClassEscape |
| test.cpp:90:23:90:24 | \\s | RegExpCharacterClassEscape |
| test.cpp:90:23:90:26 | \\s\\S | RegExpSequence |
| test.cpp:90:25:90:26 | \\S | RegExpCharacterClassEscape |
| test.cpp:91:23:91:24 | \\d | RegExpCharacterClassEscape |
| test.cpp:91:23:91:26 | \\d\\D | RegExpSequence |
| test.cpp:91:25:91:26 | \\D | RegExpCharacterClassEscape |
| test.cpp:93:23:93:24 | \\n | RegExpConstant,RegExpEscape |
| test.cpp:93:23:93:28 | \\n\\r\\t | RegExpSequence |
| test.cpp:93:25:93:26 | \\r | RegExpConstant,RegExpEscape |
| test.cpp:93:27:93:28 | \\t | RegExpConstant,RegExpEscape |
| test.cpp:97:22:97:23 | \\b | RegExpSpecialChar |
| test.cpp:97:22:97:27 | \\b!a\\B | RegExpSequence |
| test.cpp:97:24:97:25 | !a | RegExpConstant,RegExpNormalChar |
| test.cpp:97:26:97:27 | \\B | RegExpNonWordBoundary |
| test.cpp:100:22:100:26 | (foo) | RegExpGroup |
| test.cpp:100:22:100:27 | (foo)* | RegExpStar |
| test.cpp:100:22:100:30 | (foo)*bar | RegExpSequence |
| test.cpp:100:23:100:25 | foo | RegExpConstant,RegExpNormalChar |
| test.cpp:100:28:100:30 | bar | RegExpConstant,RegExpNormalChar |
| test.cpp:101:22:101:23 | fo | RegExpConstant,RegExpNormalChar |
| test.cpp:101:22:101:30 | fo(o\|b)ar | RegExpSequence |
| test.cpp:101:24:101:28 | (o\|b) | RegExpGroup |
| test.cpp:101:25:101:25 | o | RegExpConstant,RegExpNormalChar |
| test.cpp:101:25:101:27 | o\|b | RegExpAlt |
| test.cpp:101:27:101:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:101:29:101:30 | ar | RegExpConstant,RegExpNormalChar |
| test.cpp:102:22:102:29 | (a\|b\|cd) | RegExpGroup |
| test.cpp:102:22:102:30 | (a\|b\|cd)e | RegExpSequence |
| test.cpp:102:23:102:23 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:102:23:102:28 | a\|b\|cd | RegExpAlt |
| test.cpp:102:25:102:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:102:27:102:28 | cd | RegExpConstant,RegExpNormalChar |
| test.cpp:102:30:102:30 | e | RegExpConstant,RegExpNormalChar |
| test.cpp:103:22:103:27 | (?::+) | RegExpGroup |
| test.cpp:103:22:103:29 | (?::+)\\w | RegExpSequence |
| test.cpp:103:25:103:25 | : | RegExpConstant,RegExpNormalChar |
| test.cpp:103:25:103:26 | :+ | RegExpPlus |
| test.cpp:103:28:103:29 | \\w | RegExpCharacterClassEscape |
| test.cpp:106:21:106:30 | (?<id>\\w+) | RegExpGroup |
| test.cpp:106:27:106:28 | \\w | RegExpCharacterClassEscape |
| test.cpp:106:27:106:29 | \\w+ | RegExpPlus |
| test.cpp:110:23:110:26 | (a+) | RegExpGroup |
| test.cpp:110:23:110:30 | (a+)b+\\1 | RegExpSequence |
| test.cpp:110:24:110:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:110:24:110:25 | a+ | RegExpPlus |
| test.cpp:110:27:110:27 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:110:27:110:28 | b+ | RegExpPlus |
| test.cpp:110:29:110:30 | \\1 | RegExpBackRef |
| test.cpp:111:23:111:32 | (?<qux>q+) | RegExpGroup |
| test.cpp:111:23:111:43 | (?<qux>q+)\\s+\\k<qux>+ | RegExpSequence |
| test.cpp:111:30:111:30 | q | RegExpConstant,RegExpNormalChar |
| test.cpp:111:30:111:31 | q+ | RegExpPlus |
| test.cpp:111:33:111:34 | \\s | RegExpCharacterClassEscape |
| test.cpp:111:33:111:35 | \\s+ | RegExpPlus |
| test.cpp:111:36:111:42 | \\k<qux> | RegExpBackRef |
| test.cpp:111:36:111:43 | \\k<qux>+ | RegExpPlus |
| test.cpp:114:23:114:30 | \\p{Word} | RegExpNamedCharacterProperty |
| test.cpp:114:23:114:31 | \\p{Word}* | RegExpStar |
| test.cpp:115:23:115:31 | \\P{Digit} | RegExpNamedCharacterProperty |
| test.cpp:115:23:115:32 | \\P{Digit}+ | RegExpPlus |
| test.cpp:116:23:116:32 | \\p{^Alnum} | RegExpNamedCharacterProperty |
| test.cpp:116:23:116:37 | \\p{^Alnum}{2,3} | RegExpRange |
| test.cpp:117:23:117:36 | [a-f\\p{Digit}] | RegExpCharacterClass |
| test.cpp:117:23:117:37 | [a-f\\p{Digit}]+ | RegExpPlus |
| test.cpp:117:24:117:24 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:117:24:117:26 | a-f | RegExpCharacterRange |
| test.cpp:117:26:117:26 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:117:27:117:35 | \\p{Digit} | RegExpNamedCharacterProperty |
| test.cpp:120:24:120:34 | [[:alpha:]] | RegExpCharacterClass |
| test.cpp:120:24:120:45 | [[:alpha:]][[:digit:]] | RegExpSequence |
| test.cpp:120:25:120:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:120:35:120:45 | [[:digit:]] | RegExpCharacterClass |
| test.cpp:120:36:120:44 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:123:24:123:43 | [[:alpha:][:digit:]] | RegExpCharacterClass |
| test.cpp:123:25:123:33 | [:alpha:] | RegExpNamedCharacterProperty |
| test.cpp:123:34:123:42 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:126:24:126:40 | [A-F[:digit:]a-f] | RegExpCharacterClass |
| test.cpp:126:25:126:25 | A | RegExpConstant,RegExpNormalChar |
| test.cpp:126:25:126:27 | A-F | RegExpCharacterRange |
| test.cpp:126:27:126:27 | F | RegExpConstant,RegExpNormalChar |
| test.cpp:126:28:126:36 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:126:37:126:37 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:126:37:126:39 | a-f | RegExpCharacterRange |
| test.cpp:126:39:126:39 | f | RegExpConstant,RegExpNormalChar |
| test.cpp:129:24:129:32 | [:digit:] | RegExpNamedCharacterProperty |
| test.cpp:134:21:134:26 | \\u{987 | RegExpConstant,RegExpEscape |
regExpNormalCharValue
| test.cpp:31:21:31:23 | abc | abc |
| test.cpp:34:22:34:22 | a | a |
@@ -211,37 +251,50 @@ regExpNormalCharValue
| test.cpp:57:26:57:26 | a | a |
| test.cpp:57:28:57:28 | f | f |
| test.cpp:57:30:57:33 | A-F] | A-F] |
| test.cpp:61:23:61:24 | \\w | w |
| test.cpp:61:26:61:27 | \\W | W |
| test.cpp:62:23:62:24 | \\s | s |
| test.cpp:62:25:62:26 | \\S | S |
| test.cpp:63:23:63:24 | \\d | d |
| test.cpp:63:25:63:26 | \\D | D |
| test.cpp:65:23:65:24 | \\n | \n |
| test.cpp:65:25:65:26 | \\r | \r |
| test.cpp:65:27:65:28 | \\t | \t |
| test.cpp:69:24:69:25 | !a | !a |
| test.cpp:72:23:72:25 | foo | foo |
| test.cpp:72:28:72:30 | bar | bar |
| test.cpp:73:22:73:23 | fo | fo |
| test.cpp:73:25:73:25 | o | o |
| test.cpp:73:27:73:27 | b | b |
| test.cpp:73:29:73:30 | ar | ar |
| test.cpp:74:23:74:23 | a | a |
| test.cpp:74:25:74:25 | b | b |
| test.cpp:74:27:74:28 | cd | cd |
| test.cpp:74:30:74:30 | e | e |
| test.cpp:75:25:75:25 | : | : |
| test.cpp:75:28:75:29 | \\w | w |
| test.cpp:78:27:78:28 | \\w | w |
| test.cpp:82:24:82:24 | a | a |
| test.cpp:82:27:82:27 | b | b |
| test.cpp:83:30:83:30 | q | q |
| test.cpp:83:33:83:34 | \\s | s |
| test.cpp:89:24:89:24 | a | a |
| test.cpp:89:26:89:26 | f | f |
| test.cpp:98:25:98:25 | A | A |
| test.cpp:98:27:98:27 | F | F |
| test.cpp:98:37:98:37 | a | a |
| test.cpp:98:39:98:39 | f | f |
| test.cpp:106:21:106:26 | \\u{987 | \u0987 |
| test.cpp:76:30:76:30 | a | a |
| test.cpp:79:29:79:29 | [ | [ |
| test.cpp:79:30:79:30 | . | . |
| test.cpp:79:31:79:31 | a | a |
| test.cpp:79:32:79:32 | . | . |
| test.cpp:79:34:79:34 | ] | ] |
| test.cpp:82:30:82:30 | [ | [ |
| test.cpp:82:31:82:31 | = | = |
| test.cpp:82:32:82:32 | a | a |
| test.cpp:82:33:82:33 | = | = |
| test.cpp:82:35:82:35 | ] | ] |
| test.cpp:85:39:85:39 | 0 | 0 |
| test.cpp:85:41:85:41 | 9 | 9 |
| test.cpp:89:23:89:24 | \\w | w |
| test.cpp:89:26:89:27 | \\W | W |
| test.cpp:90:23:90:24 | \\s | s |
| test.cpp:90:25:90:26 | \\S | S |
| test.cpp:91:23:91:24 | \\d | d |
| test.cpp:91:25:91:26 | \\D | D |
| test.cpp:93:23:93:24 | \\n | \n |
| test.cpp:93:25:93:26 | \\r | \r |
| test.cpp:93:27:93:28 | \\t | \t |
| test.cpp:97:24:97:25 | !a | !a |
| test.cpp:100:23:100:25 | foo | foo |
| test.cpp:100:28:100:30 | bar | bar |
| test.cpp:101:22:101:23 | fo | fo |
| test.cpp:101:25:101:25 | o | o |
| test.cpp:101:27:101:27 | b | b |
| test.cpp:101:29:101:30 | ar | ar |
| test.cpp:102:23:102:23 | a | a |
| test.cpp:102:25:102:25 | b | b |
| test.cpp:102:27:102:28 | cd | cd |
| test.cpp:102:30:102:30 | e | e |
| test.cpp:103:25:103:25 | : | : |
| test.cpp:103:28:103:29 | \\w | w |
| test.cpp:106:27:106:28 | \\w | w |
| test.cpp:110:24:110:24 | a | a |
| test.cpp:110:27:110:27 | b | b |
| test.cpp:111:30:111:30 | q | q |
| test.cpp:111:33:111:34 | \\s | s |
| test.cpp:117:24:117:24 | a | a |
| test.cpp:117:26:117:26 | f | f |
| test.cpp:126:25:126:25 | A | A |
| test.cpp:126:27:126:27 | F | F |
| test.cpp:126:37:126:37 | a | a |
| test.cpp:126:39:126:39 | f | f |
| test.cpp:134:21:134:26 | \\u{987 | \u0987 |

View File

@@ -56,6 +56,34 @@ void test() {
// Nested character classes (BAD - not parsed correctly)
std::regex r_nested("[[a-f]A-F]");
// POSIX bracket extensions (std::regex ECMAScript mode supports these inside [...])
// Note: commit 7 fixes tokenization for these cases; commit 6 captures pre-fix behavior.
// Single POSIX classes (single outer bracket around a single POSIX expression)
std::regex r_posix_alpha("[[:alpha:]]"); // naïve parser closes at inner ] of [:alpha:]
std::regex r_posix_digit("[[:digit:]]");
std::regex r_posix_space("[[:space:]]");
std::regex r_posix_upper("[[:upper:]]");
std::regex r_posix_lower("[[:lower:]]");
std::regex r_posix_alnum("[[:alnum:]]");
std::regex r_posix_print("[[:print:]]");
std::regex r_posix_punct("[[:punct:]]");
// POSIX class negated (outer bracket negated)
std::regex r_posix_neg("[^[:space:]]");
// Mixed: regular char + POSIX class inside outer bracket
std::regex r_posix_mixed("[a[:space:]]");
// POSIX collating symbol
std::regex r_posix_coll("[[.a.]]");
// POSIX equivalence class
std::regex r_posix_equiv("[[=a=]]");
// Mixed: POSIX class + range inside outer bracket (mis-tokenization-prone)
std::regex r_posix_range("[[:alpha:]0-9]");
// Meta-character classes
std::regex r_meta1(".*");
std::regex r_meta2("\\w+\\W");