Skip to content

Commit b721ea7

Browse files
committed
Dump the inverted bit of a custom character class
Make sure an inverted character class does not dump the same as a regular character class.
1 parent acd3d1c commit b721ea7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/_RegexParser/Regex/Printing/DumpAST.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ extension AST.CustomCharacterClass: _ASTNode {
309309
// comparisons of dumped output in tests.
310310
// TODO: We should eventually have some way of filtering out trivia for
311311
// tests, so that it can appear in regular dumps.
312-
return "customCharacterClass(\(strippingTriviaShallow.members))"
312+
return "customCharacterClass(inverted: \(isInverted), \(strippingTriviaShallow.members))"
313313
}
314314
}
315315

Tests/RegexTests/ParseTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,8 @@ extension RegexTests {
22102210

22112211
parseNotEqualTest(#"[abc]"#, #"[a b c]"#)
22122212

2213+
parseNotEqualTest("[abc]", "[^abc]")
2214+
22132215
parseNotEqualTest(#"\1"#, #"\10"#)
22142216

22152217
parseNotEqualTest("(?^:)", ("(?-:)"))

0 commit comments

Comments
 (0)