Skip to content

Commit ad34ed8

Browse files
authored
chore: move UnicodeData structure (#75)
1 parent 27ae3fb commit ad34ed8

2 files changed

Lines changed: 62 additions & 62 deletions

File tree

UnicodeBasic/Types.lean

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,66 +1045,4 @@ def BidiClass.ofAbbrev! (abbr : Substring) : BidiClass :=
10451045
instance : Repr BidiClass where
10461046
reprPrec bc _ := s!"Unicode.BidiClass.{bc.toAbbrev}"
10471047

1048-
/-- Structure for data from `UnicodeData.txt` -/
1049-
structure UnicodeData where
1050-
/-- Code Value -/
1051-
code : UInt32
1052-
/-- Character Name -/
1053-
name : Substring
1054-
/-- General Category -/
1055-
gc : GC
1056-
/-- Bidirectional Class -/
1057-
bidi : BidiClass
1058-
/-- Canonical Combining Class -/
1059-
cc : Nat := 0
1060-
/-- Bidirectional Mirrored -/
1061-
bidiMirrored : Bool := false
1062-
/-- Character Decomposition Mapping -/
1063-
decomp : Option DecompositionMapping := none
1064-
/-- Numeric Value -/
1065-
numeric : Option NumericType := none
1066-
/-- Uppercase Mapping -/
1067-
uppercase : Option Char := none
1068-
/-- Lowercase Mapping -/
1069-
lowercase : Option Char := none
1070-
/-- Titlecase Mapping -/
1071-
titlecase : Option Char := none
1072-
deriving BEq, Repr
1073-
1074-
@[deprecated UnicodeData.code (since := "1.3.0")]
1075-
abbrev UnicodeData.codeValue := @UnicodeData.code
1076-
1077-
@[deprecated UnicodeData.name (since := "1.3.0")]
1078-
abbrev UnicodeData.characterName := @UnicodeData.name
1079-
1080-
set_option linter.deprecated false in
1081-
@[deprecated UnicodeData.gc (since := "1.3.0")]
1082-
def UnicodeData.generalCategory (d : UnicodeData) : GeneralCategory := .ofGC! d.gc
1083-
1084-
@[deprecated UnicodeData.bidi (since := "1.3.0")]
1085-
abbrev UnicodeData.bidiClass := @UnicodeData.bidi
1086-
1087-
@[deprecated UnicodeData.cc (since := "1.3.0")]
1088-
abbrev UnicodeData.canonicalCombiningClass := @UnicodeData.cc
1089-
1090-
@[deprecated UnicodeData.cc (since := "1.3.0")]
1091-
abbrev UnicodeData.decompositionMapping := @UnicodeData.decomp
1092-
1093-
@[deprecated UnicodeData.lowercase (since := "1.3.0")]
1094-
abbrev UnicodeData.lowercaseMapping := @UnicodeData.lowercase
1095-
1096-
@[deprecated UnicodeData.uppercase (since := "1.3.0")]
1097-
abbrev UnicodeData.uppercaseMapping := @UnicodeData.uppercase
1098-
1099-
@[deprecated UnicodeData.titlecase (since := "1.3.0")]
1100-
abbrev UnicodeData.titlecaseMapping := @UnicodeData.titlecase
1101-
1102-
instance : Inhabited UnicodeData where
1103-
default := {
1104-
code := 0
1105-
name := "<control-0000>"
1106-
bidi := .BN
1107-
gc := .Cc
1108-
}
1109-
11101048
end Unicode

UnicodeData/Basic.lean

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,68 @@ import UnicodeBasic.Types
99

1010
namespace Unicode
1111

12+
/-- Structure for data from `UnicodeData.txt` -/
13+
structure UnicodeData where
14+
/-- Code Value -/
15+
code : UInt32
16+
/-- Character Name -/
17+
name : Substring
18+
/-- General Category -/
19+
gc : GC
20+
/-- Bidirectional Class -/
21+
bidi : BidiClass
22+
/-- Canonical Combining Class -/
23+
cc : Nat := 0
24+
/-- Bidirectional Mirrored -/
25+
bidiMirrored : Bool := false
26+
/-- Character Decomposition Mapping -/
27+
decomp : Option DecompositionMapping := none
28+
/-- Numeric Value -/
29+
numeric : Option NumericType := none
30+
/-- Uppercase Mapping -/
31+
uppercase : Option Char := none
32+
/-- Lowercase Mapping -/
33+
lowercase : Option Char := none
34+
/-- Titlecase Mapping -/
35+
titlecase : Option Char := none
36+
deriving BEq, Repr
37+
38+
@[deprecated UnicodeData.code (since := "1.3.0")]
39+
abbrev UnicodeData.codeValue := @UnicodeData.code
40+
41+
@[deprecated UnicodeData.name (since := "1.3.0")]
42+
abbrev UnicodeData.characterName := @UnicodeData.name
43+
44+
set_option linter.deprecated false in
45+
@[deprecated UnicodeData.gc (since := "1.3.0")]
46+
def UnicodeData.generalCategory (d : UnicodeData) : GeneralCategory := .ofGC! d.gc
47+
48+
@[deprecated UnicodeData.bidi (since := "1.3.0")]
49+
abbrev UnicodeData.bidiClass := @UnicodeData.bidi
50+
51+
@[deprecated UnicodeData.cc (since := "1.3.0")]
52+
abbrev UnicodeData.canonicalCombiningClass := @UnicodeData.cc
53+
54+
@[deprecated UnicodeData.cc (since := "1.3.0")]
55+
abbrev UnicodeData.decompositionMapping := @UnicodeData.decomp
56+
57+
@[deprecated UnicodeData.lowercase (since := "1.3.0")]
58+
abbrev UnicodeData.lowercaseMapping := @UnicodeData.lowercase
59+
60+
@[deprecated UnicodeData.uppercase (since := "1.3.0")]
61+
abbrev UnicodeData.uppercaseMapping := @UnicodeData.uppercase
62+
63+
@[deprecated UnicodeData.titlecase (since := "1.3.0")]
64+
abbrev UnicodeData.titlecaseMapping := @UnicodeData.titlecase
65+
66+
instance : Inhabited UnicodeData where
67+
default := {
68+
code := 0
69+
name := "<control-0000>"
70+
bidi := .BN
71+
gc := .Cc
72+
}
73+
1274
/-- Make `UnicodeData` for noncharacter code point -/
1375
def UnicodeData.mkNoncharacter (code : UInt32) : UnicodeData where
1476
code := code

0 commit comments

Comments
 (0)