Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetLengthOfFirstExtendedGraphemeCluster< T >()

static int System.Text.Unicode.TextSegmentationUtility.GetLengthOfFirstExtendedGraphemeCluster< T > ( ReadOnlySpan< T > input,
DecodeFirstRune< T > decoder )
inlinestaticprivate

Definition at line 43 of file TextSegmentationUtility.cs.

44 {
45 Processor<T> processor = new Processor<T>(input, decoder);
46 processor.MoveNext();
47 while (processor.CurrentType == GraphemeClusterBreakType.Prepend)
48 {
49 processor.MoveNext();
50 }
51 if (processor.CurrentCodeUnitOffset <= 0 || (processor.CurrentType != GraphemeClusterBreakType.Control && processor.CurrentType != GraphemeClusterBreakType.CR && processor.CurrentType != GraphemeClusterBreakType.LF))
52 {
53 GraphemeClusterBreakType currentType = processor.CurrentType;
54 processor.MoveNext();
55 switch (currentType)
56 {
58 if (processor.CurrentType == GraphemeClusterBreakType.LF)
59 {
60 processor.MoveNext();
61 }
62 break;
64 while (processor.CurrentType == GraphemeClusterBreakType.L)
65 {
66 processor.MoveNext();
67 }
68 if (processor.CurrentType == GraphemeClusterBreakType.V)
69 {
70 processor.MoveNext();
71 }
72 else
73 {
74 if (processor.CurrentType != GraphemeClusterBreakType.LV)
75 {
76 if (processor.CurrentType == GraphemeClusterBreakType.LVT)
77 {
78 processor.MoveNext();
79 goto case GraphemeClusterBreakType.T;
80 }
81 goto default;
82 }
83 processor.MoveNext();
84 }
85 goto case GraphemeClusterBreakType.V;
88 while (processor.CurrentType == GraphemeClusterBreakType.V)
89 {
90 processor.MoveNext();
91 }
92 if (processor.CurrentType == GraphemeClusterBreakType.T)
93 {
94 processor.MoveNext();
95 goto case GraphemeClusterBreakType.T;
96 }
97 goto default;
100 while (processor.CurrentType == GraphemeClusterBreakType.T)
101 {
102 processor.MoveNext();
103 }
104 goto default;
105 case GraphemeClusterBreakType.Extended_Pictograph:
106 while (true)
107 {
108 if (processor.CurrentType == GraphemeClusterBreakType.Extend)
109 {
110 processor.MoveNext();
111 continue;
112 }
113 if (processor.CurrentType != GraphemeClusterBreakType.ZWJ)
114 {
115 break;
116 }
117 processor.MoveNext();
118 if (processor.CurrentType != GraphemeClusterBreakType.Extended_Pictograph)
119 {
120 break;
121 }
122 processor.MoveNext();
123 }
124 goto default;
125 case GraphemeClusterBreakType.Regional_Indicator:
126 if (processor.CurrentType == GraphemeClusterBreakType.Regional_Indicator)
127 {
128 processor.MoveNext();
129 }
130 goto default;
131 default:
132 while (processor.CurrentType == GraphemeClusterBreakType.Extend || processor.CurrentType == GraphemeClusterBreakType.ZWJ || processor.CurrentType == GraphemeClusterBreakType.SpacingMark)
133 {
134 processor.MoveNext();
135 }
136 break;
138 case GraphemeClusterBreakType.Control:
139 break;
140 }
141 }
142 return processor.CurrentCodeUnitOffset;
143 }

References System.Text.Unicode.TextSegmentationUtility.Processor< T >.CurrentCodeUnitOffset, System.Text.Unicode.TextSegmentationUtility.Processor< T >.CurrentType, System.input, and System.Text.Unicode.TextSegmentationUtility.Processor< T >.MoveNext().