@@ -60,13 +60,13 @@ extension AST {
6060 case namedCharacter( String )
6161
6262 /// .
63- case any
63+ case dot
6464
6565 /// ^
66- case startOfLine
66+ case caretAnchor
6767
6868 /// $
69- case endOfLine
69+ case dollarAnchor
7070
7171 // References
7272 case backreference( Reference )
@@ -104,9 +104,9 @@ extension AST.Atom {
104104 case . callout( let v) : return v
105105 case . backtrackingDirective( let v) : return v
106106 case . changeMatchingOptions( let v) : return v
107- case . any : return nil
108- case . startOfLine : return nil
109- case . endOfLine : return nil
107+ case . dot : return nil
108+ case . caretAnchor : return nil
109+ case . dollarAnchor : return nil
110110 case . invalid: return nil
111111 }
112112 }
@@ -511,67 +511,6 @@ extension AST.Atom.CharacterProperty {
511511 }
512512}
513513
514- extension AST . Atom {
515- /// Anchors and other built-in zero-width assertions.
516- public enum AssertionKind : String , Hashable {
517- /// \A
518- case startOfSubject = #"\A"#
519-
520- /// \Z
521- case endOfSubjectBeforeNewline = #"\Z"#
522-
523- /// \z
524- case endOfSubject = #"\z"#
525-
526- /// \K
527- case resetStartOfMatch = #"\K"#
528-
529- /// \G
530- case firstMatchingPositionInSubject = #"\G"#
531-
532- /// \y
533- case textSegment = #"\y"#
534-
535- /// \Y
536- case notTextSegment = #"\Y"#
537-
538- /// ^
539- case startOfLine = #"^"#
540-
541- /// $
542- case endOfLine = #"$"#
543-
544- /// \b (from outside a custom character class)
545- case wordBoundary = #"\b"#
546-
547- /// \B
548- case notWordBoundary = #"\B"#
549-
550- }
551-
552- public var assertionKind : AssertionKind ? {
553- switch kind {
554- case . startOfLine: return . startOfLine
555- case . endOfLine: return . endOfLine
556-
557- case . escaped( . wordBoundary) : return . wordBoundary
558- case . escaped( . notWordBoundary) : return . notWordBoundary
559- case . escaped( . startOfSubject) : return . startOfSubject
560- case . escaped( . endOfSubject) : return . endOfSubject
561- case . escaped( . textSegment) : return . textSegment
562- case . escaped( . notTextSegment) : return . notTextSegment
563- case . escaped( . endOfSubjectBeforeNewline) :
564- return . endOfSubjectBeforeNewline
565- case . escaped( . firstMatchingPositionInSubject) :
566- return . firstMatchingPositionInSubject
567-
568- case . escaped( . resetStartOfMatch) : return . resetStartOfMatch
569-
570- default : return nil
571- }
572- }
573- }
574-
575514extension AST . Atom {
576515 public enum Callout : Hashable {
577516 /// A PCRE callout written `(?C...)`
@@ -806,9 +745,9 @@ extension AST.Atom {
806745 // the AST? Or defer for the matching engine?
807746 return nil
808747
809- case . scalarSequence, . property, . any , . startOfLine , . endOfLine ,
810- . backreference , . subpattern , . callout , . backtrackingDirective ,
811- . changeMatchingOptions, . invalid:
748+ case . scalarSequence, . property, . dot , . caretAnchor ,
749+ . dollarAnchor , . backreference , . subpattern , . callout ,
750+ . backtrackingDirective , . changeMatchingOptions, . invalid:
812751 return nil
813752 }
814753 }
@@ -858,7 +797,7 @@ extension AST.Atom {
858797 case . keyboardMetaControl( let x) :
859798 return " \\ M- \\ C- \( x) "
860799
861- case . property, . escaped, . any , . startOfLine , . endOfLine ,
800+ case . property, . escaped, . dot , . caretAnchor , . dollarAnchor ,
862801 . backreference, . subpattern, . namedCharacter, . callout,
863802 . backtrackingDirective, . changeMatchingOptions, . invalid:
864803 return nil
@@ -874,7 +813,7 @@ extension AST.Atom {
874813 // TODO: Are callouts quantifiable?
875814 case . escaped( let esc) :
876815 return esc. isQuantifiable
877- case . startOfLine , . endOfLine :
816+ case . caretAnchor , . dollarAnchor :
878817 return false
879818 default :
880819 return true
0 commit comments