@@ -60,13 +60,13 @@ extension AST {
60
60
case namedCharacter( String )
61
61
62
62
/// .
63
- case any
63
+ case dot
64
64
65
65
/// ^
66
- case startOfLine
66
+ case caretAnchor
67
67
68
68
/// $
69
- case endOfLine
69
+ case dollarAnchor
70
70
71
71
// References
72
72
case backreference( Reference )
@@ -104,9 +104,9 @@ extension AST.Atom {
104
104
case . callout( let v) : return v
105
105
case . backtrackingDirective( let v) : return v
106
106
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
110
110
case . invalid: return nil
111
111
}
112
112
}
@@ -511,67 +511,6 @@ extension AST.Atom.CharacterProperty {
511
511
}
512
512
}
513
513
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
-
575
514
extension AST . Atom {
576
515
public enum Callout : Hashable {
577
516
/// A PCRE callout written `(?C...)`
@@ -806,9 +745,9 @@ extension AST.Atom {
806
745
// the AST? Or defer for the matching engine?
807
746
return nil
808
747
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:
812
751
return nil
813
752
}
814
753
}
@@ -858,7 +797,7 @@ extension AST.Atom {
858
797
case . keyboardMetaControl( let x) :
859
798
return " \\ M- \\ C- \( x) "
860
799
861
- case . property, . escaped, . any , . startOfLine , . endOfLine ,
800
+ case . property, . escaped, . dot , . caretAnchor , . dollarAnchor ,
862
801
. backreference, . subpattern, . namedCharacter, . callout,
863
802
. backtrackingDirective, . changeMatchingOptions, . invalid:
864
803
return nil
@@ -874,7 +813,7 @@ extension AST.Atom {
874
813
// TODO: Are callouts quantifiable?
875
814
case . escaped( let esc) :
876
815
return esc. isQuantifiable
877
- case . startOfLine , . endOfLine :
816
+ case . caretAnchor , . dollarAnchor :
878
817
return false
879
818
default :
880
819
return true
0 commit comments