@@ -173,7 +173,7 @@ extension DSLTree {
173173 /// newlines unless single line mode is enabled.
174174 case dot
175175
176- case assertion( _AST . AssertionKind )
176+ case assertion( Assertion )
177177 case backreference( _AST . Reference )
178178 case symbolicReference( ReferenceID )
179179
@@ -183,6 +183,44 @@ extension DSLTree {
183183 }
184184}
185185
186+ extension DSLTree . Atom {
187+ @_spi ( RegexBuilder)
188+ public enum Assertion : Hashable {
189+ /// \A
190+ case startOfSubject
191+
192+ /// \Z
193+ case endOfSubjectBeforeNewline
194+
195+ /// \z
196+ case endOfSubject
197+
198+ /// \K
199+ case resetStartOfMatch
200+
201+ /// \G
202+ case firstMatchingPositionInSubject
203+
204+ /// \y
205+ case textSegment
206+
207+ /// \Y
208+ case notTextSegment
209+
210+ /// ^
211+ case caretAnchor
212+
213+ /// $
214+ case dollarAnchor
215+
216+ /// \b (from outside a custom character class)
217+ case wordBoundary
218+
219+ /// \B
220+ case notWordBoundary
221+ }
222+ }
223+
186224extension Unicode . GeneralCategory {
187225 var extendedGeneralCategory : Unicode . ExtendedGeneralCategory ? {
188226 switch self {
@@ -699,40 +737,6 @@ extension DSLTree {
699737 internal var ast : AST . AbsentFunction
700738 }
701739
702- @_spi ( RegexBuilder)
703- public struct AssertionKind {
704- internal var ast : AST . Atom . AssertionKind
705-
706- public static func startOfSubject( _ inverted: Bool = false ) -> Self {
707- . init( ast: . startOfSubject)
708- }
709- public static func endOfSubjectBeforeNewline( _ inverted: Bool = false ) -> Self {
710- . init( ast: . endOfSubjectBeforeNewline)
711- }
712- public static func endOfSubject( _ inverted: Bool = false ) -> Self {
713- . init( ast: . endOfSubject)
714- }
715- public static func firstMatchingPositionInSubject( _ inverted: Bool = false ) -> Self {
716- . init( ast: . firstMatchingPositionInSubject)
717- }
718- public static func textSegmentBoundary( _ inverted: Bool = false ) -> Self {
719- inverted
720- ? . init( ast: . notTextSegment)
721- : . init( ast: . textSegment)
722- }
723- public static func startOfLine( _ inverted: Bool = false ) -> Self {
724- . init( ast: . caretAnchor)
725- }
726- public static func endOfLine( _ inverted: Bool = false ) -> Self {
727- . init( ast: . dollarAnchor)
728- }
729- public static func wordBoundary( _ inverted: Bool = false ) -> Self {
730- inverted
731- ? . init( ast: . notWordBoundary)
732- : . init( ast: . wordBoundary)
733- }
734- }
735-
736740 @_spi ( RegexBuilder)
737741 public struct Reference {
738742 internal var ast : AST . Reference
0 commit comments