@@ -114,32 +114,11 @@ where
114114 .Sk, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll,
115115 .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ll, .Ps, .Sm, .Po, .Sm, .Cc]
116116
117- set_option linter.deprecated false in
118- @ [deprecated Unicode.getGC (since := "1.2.0" )]
119- def getGeneralCategory (char : Char) : GeneralCategory :=
120- .ofGC! (getGC char)
121-
122117instance : Membership Char GC where
123118 mem cat char := getGC char ⊆ cat
124119
125120instance (char : Char) (cat : GC) : Decidable (char ∈ cat) := inferInstanceAs (Decidable (_ ⊆ _))
126121
127- set_option linter.deprecated false in
128- @ [deprecated "use `char ∈ category` instead" (since := "1.2.0" )]
129- def isInGeneralCategory (char : Char) (category : GeneralCategory) : Bool :=
130- match category, getGeneralCategory char with
131- | ⟨major, none⟩, ⟨charMajor, _⟩ => major == charMajor
132- | ⟨_, some .casedLetter⟩, ⟨_, some .lowercaseLetter⟩ => true
133- | ⟨_, some .casedLetter⟩, ⟨_, some .titlecaseLetter⟩ => true
134- | ⟨_, some .casedLetter⟩, ⟨_, some .uppercaseLetter⟩ => true
135- | ⟨_, some .casedLetter⟩, _ => false
136- | ⟨_, some .groupPunctuation⟩, ⟨_, some .openPunctuation⟩ => true
137- | ⟨_, some .groupPunctuation⟩, ⟨_, some .closePunctuation⟩ => true
138- | ⟨_, some .groupPunctuation⟩, _ => false
139- | ⟨_, some .quotePunctuation⟩, ⟨_, some .initialPunctuation⟩ => true
140- | ⟨_, some .quotePunctuation⟩, ⟨_, some .finalPunctuation⟩ => true
141- | ⟨_, some .quotePunctuation⟩, _ => false
142- | cat, charCat => cat == charCat
143122
144123namespace GeneralCategory
145124
@@ -150,341 +129,221 @@ namespace GeneralCategory
150129 Unicode Property: `General_Category=L` -/
151130abbrev isLetter (char : Char) : Bool := char ∈ Unicode.GC.L
152131
153- @ [deprecated "c ∈ Unicode.GC.L" (since := "1.2.0" )]
154- protected abbrev isL := isLetter
155-
156132/-- Check if lowercase letter character (`Ll`)
157133
158134 Unicode Property: `General_Category=Ll` -/
159135abbrev isLowercaseLetter (char : Char) : Bool := char ∈ Unicode.GC.Ll
160136
161- @ [deprecated "c ∈ Unicode.GC.Ll" (since := "1.2.0" )]
162- protected abbrev isLl := isLowercaseLetter
163-
164137/-- Check if titlecase letter character (`Lt`)
165138
166139 Unicode Property: `General_Category=Lt` -/
167140abbrev isTitlecaseLetter (char : Char) : Bool := char ∈ Unicode.GC.Lt
168141
169- @ [deprecated "c ∈ Unicode.GC.Lt" (since := "1.2.0" )]
170- protected abbrev isLt := isTitlecaseLetter
171-
172142/-- Check if uppercase letter character (`Lu`)
173143
174144 Unicode Property: `General_Category=Lu` -/
175145abbrev isUppercaseLetter (char : Char) : Bool := char ∈ Unicode.GC.Lu
176146
177- @ [deprecated "c ∈ Unicode.GC.Lu" (since := "1.2.0" )]
178- protected abbrev isLu := isUppercaseLetter
179-
180147/-- Check if cased letter character (`LC`)
181148
182149 This is a derived category (`L = Lu | Ll | Lt`).
183150
184151 Unicode Property: `General_Category=LC` -/
185152abbrev isCasedLetter (char : Char) : Bool := char ∈ Unicode.GC.LC
186153
187- @ [deprecated "c ∈ Unicode.GC.LC" (since := "1.2.0" )]
188- protected abbrev isLC := isCasedLetter
189-
190154/-- Check if modifier letter character (`Lm`)
191155
192156 Unicode Property: `General_Category=Lm`-/
193157abbrev isModifierLetter (char : Char) : Bool := char ∈ Unicode.GC.Lm
194158
195- @ [deprecated "c ∈ Unicode.GC.Lm" (since := "1.2.0" )]
196- protected abbrev isLm := isModifierLetter
197-
198159/-- Check if other letter character (`Lo`)
199160
200161 Unicode Property: `General_Category=Lo`-/
201162abbrev isOtherLetter (char : Char) : Bool := char ∈ Unicode.GC.Lo
202163
203- @ [deprecated "c ∈ Unicode.GC.Lo" (since := "1.2.0" )]
204- protected abbrev isLo := isOtherLetter
205-
206164/-- Check if mark character (`M`)
207165
208166 This is a derived category (`M = Mn | Mc | Me`).
209167
210168 Unicode Property: `General_Category=M` -/
211169abbrev isMark (char : Char) : Bool := char ∈ Unicode.GC.M
212170
213- @ [deprecated "c ∈ Unicode.GC.M" (since := "1.2.0" )]
214- protected abbrev isM := isMark
215-
216171/-- Check if nonspacing combining mark character (`Mn`)
217172
218173 Unicode Property: `General_Category=Mn` -/
219174abbrev isNonspacingMark (char : Char) : Bool := char ∈ Unicode.GC.Mn
220175
221- @ [deprecated "c ∈ Unicode.GC.Mn" (since := "1.2.0" )]
222- protected abbrev isMn := isNonspacingMark
223-
224176/-- Check if spacing combining mark character (`Mc`)
225177
226178 Unicode Property: `General_Category=Mc` -/
227179abbrev isSpacingMark (char : Char) : Bool := char ∈ Unicode.GC.Mc
228180
229- @ [deprecated "c ∈ Unicode.GC.Mc" (since := "1.2.0" )]
230- protected abbrev isMc := isSpacingMark
231-
232181/-- Check if enclosing combining mark character (`Me`)
233182
234183 Unicode Property: `General_Category=Me` -/
235184abbrev isEnclosingMark (char : Char) : Bool := char ∈ Unicode.GC.Me
236185
237- @ [deprecated "c ∈ Unicode.GC.Me" (since := "1.2.0" )]
238- protected abbrev isMe := isEnclosingMark
239-
240186/-- Check if number character (`N`)
241187
242188 This is a derived category (`N = Nd | Nl | No`).
243189
244190 Unicode Property: `General_Category=N` -/
245191abbrev isNumber (char : Char) : Bool := char ∈ Unicode.GC.N
246192
247- @ [deprecated "c ∈ Unicode.GC.N" (since := "1.2.0" )]
248- protected abbrev isN := isNumber
249-
250193/-- Check if decimal number character (`Nd`)
251194
252195 Unicode Property: `General_Category=Nd` -/
253196abbrev isDecimalNumber (char : Char) : Bool := char ∈ Unicode.GC.Nd
254197
255- @ [deprecated "c ∈ Unicode.GC.Nd" (since := "1.2.0" )]
256- protected abbrev isNd := isDecimalNumber
257-
258198/-- Check if letter number character (`Nl`)
259199
260200 Unicode Property: `General_Category=Nl` -/
261201abbrev isLetterNumber (char : Char) : Bool := char ∈ Unicode.GC.Nl
262202
263- @ [deprecated "c ∈ Unicode.GC.Nl" (since := "1.2.0" )]
264- protected abbrev isNl := isLetterNumber
265-
266203/-- Check if other number character (`No`)
267204
268205 Unicode Property: `General_Category=No` -/
269206abbrev isOtherNumber (char : Char) : Bool := char ∈ Unicode.GC.No
270207
271- @ [deprecated "c ∈ Unicode.GC.No" (since := "1.2.0" )]
272- protected abbrev isNo := isOtherNumber
273-
274208/-- Check if punctuation character (`P`)
275209
276210 This is a derived category (`P = Pc | Pd | Ps | Pe | Pi | Pf | Po`).
277211
278212 Unicode Property: `General_Category=P` -/
279213abbrev isPunctuation (char : Char) : Bool := char ∈ Unicode.GC.P
280214
281- @ [deprecated "c ∈ Unicode.GC.P" (since := "1.2.0" )]
282- protected abbrev isP := isPunctuation
283-
284215/-- Check if connector punctuation character (`Pc`)
285216
286217 Unicode Property: `General_Category=Pc` -/
287218abbrev isConnectorPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Pc
288219
289- @ [deprecated "c ∈ Unicode.GC.Pc" (since := "1.2.0" )]
290- protected abbrev isPc := isConnectorPunctuation
291-
292220/-- Check if dash punctuation character (`Pd`)
293221
294222 Unicode Property: `General_Category=Pd` -/
295223abbrev isDashPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Pd
296224
297- @ [deprecated "c ∈ Unicode.GC.Pd" (since := "1.2.0" )]
298- protected abbrev isPd := isDashPunctuation
299-
300225/-- Check if grouping punctuation character (`PG`)
301226
302227 This is a derived category (`PG = Ps | Pe`).
303228
304229 Unicode Property: `General_Category=PG` -/
305230abbrev isGroupPunctuation (char : Char) : Bool := char ∈ Unicode.GC.PG
306231
307- @ [deprecated "c ∈ Unicode.GC.PG" (since := "1.2.0" )]
308- protected abbrev isPG := isGroupPunctuation
309-
310232/-- Check if open punctuation character (`Ps`)
311233
312234 Unicode Property: `General_Category=Ps` -/
313235abbrev isOpenPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Ps
314236
315- @ [deprecated "c ∈ Unicode.GC.Ps" (since := "1.2.0" )]
316- protected abbrev isPs := isOpenPunctuation
317-
318237/-- Check if close punctuation character (`Pe`)
319238
320239 Unicode Property: `General_Category=Pe` -/
321240abbrev isClosePunctuation (char : Char) : Bool := char ∈ Unicode.GC.Pe
322241
323- @ [deprecated "c ∈ Unicode.GC.Pe" (since := "1.2.0" )]
324- protected abbrev isPe := isClosePunctuation
325-
326242/-- Check if quoting punctuation character (`PQ`)
327243
328244 This is a derived category (`PQ = Pi | Pf`).
329245
330246 Unicode Property: `General_Category=PQ` -/
331247abbrev isQuotePunctuation (char : Char) : Bool := char ∈ Unicode.GC.PQ
332248
333- @ [deprecated "c ∈ Unicode.GC.PQ" (since := "1.2.0" )]
334- protected abbrev isPQ := isQuotePunctuation
335-
336249/-- Check if initial punctuation character (`Pi`)
337250
338251 Unicode Property: `General_Category=Pi` -/
339252abbrev isInitialPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Pi
340253
341- @ [deprecated "c ∈ Unicode.GC.Pi" (since := "1.2.0" )]
342- protected abbrev isPi := isInitialPunctuation
343-
344254/-- Check if initial punctuation character (`Pf`)
345255
346256 Unicode Property: `General_Category=Pf` -/
347257abbrev isFinalPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Pf
348258
349- @ [deprecated "c ∈ Unicode.GC.Pf" (since := "1.2.0" )]
350- protected abbrev isPf := isFinalPunctuation
351-
352259/-- Check if other punctuation character (`Po`)
353260
354261 Unicode Property: `General_Category=Po` -/
355262abbrev isOtherPunctuation (char : Char) : Bool := char ∈ Unicode.GC.Po
356263
357- @ [deprecated "c ∈ Unicode.GC.Po" (since := "1.2.0" )]
358- protected abbrev isPo := isOtherPunctuation
359-
360264/-- Check if symbol character (`S`)
361265
362266 This is a derived category (`S = Sm | Sc | Sk | So`).
363267
364268 Unicode Property: `General_Category=S` -/
365269abbrev isSymbol (char : Char) : Bool := char ∈ Unicode.GC.S
366270
367- @ [deprecated "c ∈ Unicode.GC.S" (since := "1.2.0" )]
368- protected abbrev isS := isSymbol
369-
370271/-- Check if math symbol character (`Sm`)
371272
372273 Unicode Property: `General_Category=Sm` -/
373274abbrev isMathSymbol (char : Char) : Bool := char ∈ Unicode.GC.Sm
374275
375- @ [deprecated "c ∈ Unicode.GC.Sm" (since := "1.2.0" )]
376- protected abbrev isSm := isMathSymbol
377-
378276/-- Check if currency symbol character (`Sc`)
379277
380278 Unicode Property: `General_Category=Sc` -/
381279abbrev isCurrencySymbol (char : Char) : Bool := char ∈ Unicode.GC.Sc
382280
383- @ [deprecated "c ∈ Unicode.GC.Sc" (since := "1.2.0" )]
384- protected abbrev isSc := isCurrencySymbol
385-
386281/-- Check if modifier symbol character (`Sk`)
387282
388283 Unicode Property: `General_Category=Sk` -/
389284abbrev isModifierSymbol (char : Char) : Bool := char ∈ Unicode.GC.Sk
390285
391- @ [deprecated "c ∈ Unicode.GC.Sk" (since := "1.2.0" )]
392- protected abbrev isSk := isModifierSymbol
393-
394286/-- Check if other symbol character (`So`)
395287
396288 Unicode Property: `General_Category=So` -/
397289abbrev isOtherSymbol (char : Char) : Bool := char ∈ Unicode.GC.So
398290
399- @ [deprecated "c ∈ Unicode.GC.So" (since := "1.2.0" )]
400- protected abbrev isSo := isOtherSymbol
401-
402291/-- Check if separator character (`Z`)
403292
404293 This is a derived property (`Z = Zs | Zl | Zp`).
405294
406295 Unicode Property: `General_Category=Z` -/
407296abbrev isSeparator (char : Char) : Bool := char ∈ Unicode.GC.Z
408297
409- @ [deprecated "c ∈ Unicode.GC.Z" (since := "1.2.0" )]
410- protected abbrev isZ := isSeparator
411-
412298/-- Check if space separator character (`Zs`)
413299
414300 Unicode Property: `General_Category=Zs` -/
415301abbrev isSpaceSeparator (char : Char) : Bool := char ∈ Unicode.GC.Zs
416302
417- @ [deprecated "c ∈ Unicode.GC.Zs" (since := "1.2.0" )]
418- protected abbrev isZs := isSpaceSeparator
419-
420303/-- Check if line separator character (`Zl`)
421304
422305 Unicode Property: `General_Category=Zl` -/
423306abbrev isLineSeparator (char : Char) : Bool := char ∈ Unicode.GC.Zl
424307
425- @ [deprecated "c ∈ Unicode.GC.Zl" (since := "1.2.0" )]
426- protected abbrev isZl := isLineSeparator
427-
428308/-- Check if paragraph separator character (`Zp`)
429309
430310 Unicode Property: `General_Category=Zp` -/
431311abbrev isParagraphSeparator (char : Char) : Bool := char ∈ Unicode.GC.Zp
432312
433- @ [deprecated "c ∈ Unicode.GC.Zp" (since := "1.2.0" )]
434- protected abbrev isZp := isParagraphSeparator
435-
436313/-- Check if other character (`C`)
437314
438315 This is a derived category (`C = Cc | Cf | Cs | Co | Cn`).
439316
440317 Unicode Property: `General_Category=C` -/
441318abbrev isOther (char : Char) : Bool := char ∈ Unicode.GC.C
442319
443- @ [deprecated "c ∈ Unicode.GC.C" (since := "1.2.0" )]
444- protected abbrev isC := isOther
445-
446320/-- Check if control character (`Cc`)
447321
448322 Unicode Property: `General_Category=Cc` -/
449323abbrev isControl (char : Char) : Bool := char ∈ Unicode.GC.Cc
450324
451- @ [deprecated "c ∈ Unicode.GC.Cc" (since := "1.2.0" )]
452- protected abbrev isCc := isControl
453-
454325/-- Check if format character (`Cf`)
455326
456327 Unicode Property: `General_Category=Cf` -/
457328abbrev isFormat (char : Char) : Bool := char ∈ Unicode.GC.Cf
458329
459- @ [deprecated "c ∈ Unicode.GC.Cf" (since := "1.2.0" )]
460- protected abbrev isCf := isFormat
461-
462330/-- Check if surrogate character (`Cs`)
463331
464332 Does not actually occur since Lean does not regard surrogate code points as characters.
465333
466334 Unicode Property: `General_Category=Cs` -/
467335abbrev isSurrogate (char : Char) : Bool := char ∈ Unicode.GC.Cs
468336
469- @ [deprecated "c ∈ Unicode.GC.Cs" (since := "1.2.0" )]
470- protected abbrev isCs := isSurrogate
471-
472337/-- Check if private use character (`Co`)
473338
474339 Unicode Property: `General_Category=Co` -/
475340abbrev isPrivateUse (char : Char) : Bool := char ∈ Unicode.GC.Co
476341
477- @ [deprecated "c ∈ Unicode.GC.Co" (since := "1.2.0" )]
478- protected abbrev isCo := isPrivateUse
479-
480342/-- Check if unassigned character (`Cn`)
481343
482344 Unicode Property: `General_Category=Cn` -/
483345abbrev isUnassigned (char : Char) : Bool := char ∈ Unicode.GC.Cn
484346
485- @ [deprecated "c ∈ Unicode.GC.Cn" (since := "1.2.0" )]
486- protected abbrev isCn := isUnassigned
487-
488347end GeneralCategory
489348
490349/-!
0 commit comments