C++: Verify [\b] is backspace inside character classes

This commit is contained in:
copilot-swe-agent[bot]
2026-07-23 10:25:48 +00:00
committed by GitHub
parent 85d46d5bf8
commit 53ea488741
3 changed files with 9 additions and 0 deletions

View File

@@ -128,6 +128,8 @@
#-----| [RegExpConstant, RegExpNormalChar] A-F]
#-----| [RegExpConstant, RegExpEscape] \b
#-----| [RegExpConstant, RegExpNormalChar] |
#-----| [RegExpConstant, RegExpNormalChar] -
@@ -378,6 +380,9 @@
#-----| 0 -> [RegExpConstant, RegExpNormalChar] [
#-----| 1 -> [RegExpCharacterRange] a-f
#-----| [RegExpCharacterClass] [\b]
#-----| 0 -> [RegExpConstant, RegExpEscape] \b
#-----| [RegExpCharacterClass] [|]
#-----| 0 -> [RegExpConstant, RegExpNormalChar] |

View File

@@ -37,6 +37,7 @@ std::regex r_cc7("[]]"); // MRI gives a warning, but accepts this as matching
std::regex r_cc8("[^]]"); // MRI gives a warning, but accepts this as matching anything except ']'
std::regex r_cc9("[^-]");
std::regex r_cc10("[|]");
std::regex r_cc11("[\\b]");
// Nested character classes (BAD - not parsed correctly)
std::regex r_nested("[[a-f]A-F]");

View File

@@ -67,6 +67,7 @@ term
| file://:0:0:0:0 | [[a-f] | RegExpCharacterClass |
| file://:0:0:0:0 | [[a-f]A-F] | RegExpSequence |
| file://:0:0:0:0 | [\\0] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\b] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\cZ] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w] | RegExpCharacterClass |
| file://:0:0:0:0 | [\\w]+ | RegExpPlus |
@@ -87,6 +88,7 @@ term
| file://:0:0:0:0 | \\[ | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\[\\][123] | RegExpSequence |
| file://:0:0:0:0 | \\] | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\b | RegExpConstant,RegExpEscape |
| file://:0:0:0:0 | \\b | RegExpSpecialChar |
| file://:0:0:0:0 | \\b!a\\B | RegExpSequence |
| file://:0:0:0:0 | \\cA | RegExpConstant,RegExpEscape |
@@ -216,6 +218,7 @@ regExpNormalCharValue
| file://:0:0:0:0 | \\W | W |
| file://:0:0:0:0 | \\[ | [ |
| file://:0:0:0:0 | \\] | ] |
| file://:0:0:0:0 | \\b | b |
| file://:0:0:0:0 | \\cA | cA |
| file://:0:0:0:0 | \\cZ | cZ |
| file://:0:0:0:0 | \\d | d |