File tree Expand file tree Collapse file tree 7 files changed +6
-30
lines changed
Sources/_StringProcessing Expand file tree Collapse file tree 7 files changed +6
-30
lines changed Original file line number Diff line number Diff line change @@ -702,9 +702,6 @@ fileprivate extension Compiler.ByteCodeGen {
702
702
case . characterClass( let cc) :
703
703
// Custom character class that consumes a single grapheme
704
704
let model = cc. asRuntimeModel ( options)
705
- guard model. consumesSingleGrapheme else {
706
- return false
707
- }
708
705
builder. buildQuantify (
709
706
model: model,
710
707
kind,
Original file line number Diff line number Diff line change @@ -193,8 +193,6 @@ extension String {
193
193
switch ( isScalarSemantics, cc) {
194
194
case ( _, . anyGrapheme) :
195
195
next = index ( after: currentPosition)
196
- case ( _, . anyScalar) :
197
- next = unicodeScalars. index ( after: currentPosition)
198
196
case ( true , _) :
199
197
next = unicodeScalars. index ( after: currentPosition)
200
198
case ( false , _) :
@@ -204,12 +202,6 @@ extension String {
204
202
switch cc {
205
203
case . any, . anyGrapheme:
206
204
matched = true
207
- case . anyScalar:
208
- if isScalarSemantics {
209
- matched = true
210
- } else {
211
- matched = isOnGraphemeClusterBoundary ( next)
212
- }
213
205
case . digit:
214
206
if isScalarSemantics {
215
207
matched = scalar. properties. numericType != nil && asciiCheck
Original file line number Diff line number Diff line change @@ -760,8 +760,6 @@ extension DSLTree.Atom.CharacterClass {
760
760
switch self {
761
761
case . anyGrapheme:
762
762
return " .anyGraphemeCluster "
763
- case . anyUnicodeScalar:
764
- return " .anyUnicodeScalar "
765
763
case . digit:
766
764
return " .digit "
767
765
case . notDigit:
@@ -786,6 +784,8 @@ extension DSLTree.Atom.CharacterClass {
786
784
return " .whitespace "
787
785
case . notWhitespace:
788
786
return " .whitespace.inverted "
787
+ case . anyUnicodeScalar:
788
+ fatalError ( " Unsupported " )
789
789
}
790
790
}
791
791
}
Original file line number Diff line number Diff line change @@ -183,7 +183,6 @@ extension AST.Atom.EscapedBuiltin {
183
183
case . wordCharacter: return . word
184
184
case . notWordCharacter: return . notWord
185
185
case . graphemeCluster: return . anyGrapheme
186
- case . trueAnychar: return . anyUnicodeScalar
187
186
default : return nil
188
187
}
189
188
}
Original file line number Diff line number Diff line change @@ -260,7 +260,6 @@ extension DSLTree.Atom.CharacterClass {
260
260
public var inverted : DSLTree . Atom . CharacterClass ? {
261
261
switch self {
262
262
case . anyGrapheme: return nil
263
- case . anyUnicodeScalar: return nil
264
263
case . digit: return . notDigit
265
264
case . notDigit: return . digit
266
265
case . word: return . notWord
@@ -273,6 +272,8 @@ extension DSLTree.Atom.CharacterClass {
273
272
case . notVerticalWhitespace: return . verticalWhitespace
274
273
case . whitespace: return . notWhitespace
275
274
case . notWhitespace: return . whitespace
275
+ case . anyUnicodeScalar:
276
+ fatalError ( " Unsupported " )
276
277
}
277
278
}
278
279
}
Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ extension String {
134
134
135
135
// TODO: bitvectors
136
136
switch cc {
137
- case . any, . anyGrapheme, . anyScalar:
138
- // TODO: should any scalar not consume CR-LF in scalar semantic mode?
137
+ case . any, . anyGrapheme:
139
138
return ( next, true )
140
139
141
140
case . digit:
Original file line number Diff line number Diff line change @@ -45,8 +45,6 @@ struct _CharacterClassModel: Hashable {
45
45
case any = 0
46
46
/// Any grapheme cluster
47
47
case anyGrapheme
48
- /// Any Unicode scalar
49
- case anyScalar
50
48
/// Character.isDigit
51
49
case digit
52
50
/// Horizontal whitespace: `[:blank:]`, i.e
@@ -90,15 +88,6 @@ struct _CharacterClassModel: Hashable {
90
88
}
91
89
}
92
90
93
- extension _CharacterClassModel {
94
- var consumesSingleGrapheme : Bool {
95
- switch self . cc {
96
- case . anyScalar: return false
97
- default : return true
98
- }
99
- }
100
- }
101
-
102
91
extension _CharacterClassModel . Representation {
103
92
/// Returns true if this CharacterClass should be matched by strict ascii under the given options
104
93
func isStrictAscii( options: MatchingOptions ) -> Bool {
@@ -119,7 +108,6 @@ extension _CharacterClassModel.Representation: CustomStringConvertible {
119
108
switch self {
120
109
case . any: return " <any> "
121
110
case . anyGrapheme: return " <any grapheme> "
122
- case . anyScalar: return " <any scalar> "
123
111
case . digit: return " <digit> "
124
112
case . horizontalWhitespace: return " <horizontal whitespace> "
125
113
case . newlineSequence: return " <newline sequence> "
@@ -185,7 +173,7 @@ extension DSLTree.Atom.CharacterClass {
185
173
case . anyGrapheme:
186
174
cc = . anyGrapheme
187
175
case . anyUnicodeScalar:
188
- cc = . anyScalar
176
+ fatalError ( " Unsupported " )
189
177
}
190
178
return _CharacterClassModel ( cc: cc, options: options, isInverted: inverted)
191
179
}
You can’t perform that action at this time.
0 commit comments