summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jose Colon Rodriguez2024-02-14 12:06:11 -0400
committerGravatar Jose Colon Rodriguez2024-02-14 12:06:11 -0400
commitfa27c2d9ef1c242634147d406094711389294274 (patch)
tree28ffbdbb3be8e51d7540d0e887546a105e0df85e /src
parentCode reorg; Added UCD (diff)
downloadzg-fa27c2d9ef1c242634147d406094711389294274.tar.gz
zg-fa27c2d9ef1c242634147d406094711389294274.tar.xz
zg-fa27c2d9ef1c242634147d406094711389294274.zip
Removed unreachables from Grapheme
Diffstat (limited to 'src')
-rw-r--r--src/Grapheme.zig20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Grapheme.zig b/src/Grapheme.zig
index 9f09255..01eff80 100644
--- a/src/Grapheme.zig
+++ b/src/Grapheme.zig
@@ -116,7 +116,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
116 if (self.buf[1].? == '\x0a') { 116 if (self.buf[1].? == '\x0a') {
117 // CRLF 117 // CRLF
118 try encode_and_append(self.buf[1].?, &all_bytes); 118 try encode_and_append(self.buf[1].?, &all_bytes);
119 _ = self.advance() catch unreachable; 119 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
120 } 120 }
121 121
122 return try all_bytes.toOwnedSlice(); 122 return try all_bytes.toOwnedSlice();
@@ -132,7 +132,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
132 while (self.buf[1]) |next_cp| { 132 while (self.buf[1]) |next_cp| {
133 if (next_cp >= 0x300 and isIgnorable(next_cp)) { 133 if (next_cp >= 0x300 and isIgnorable(next_cp)) {
134 try encode_and_append(next_cp, &all_bytes); 134 try encode_and_append(next_cp, &all_bytes);
135 _ = self.advance() catch unreachable; 135 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
136 } else { 136 } else {
137 break; 137 break;
138 } 138 }
@@ -151,11 +151,11 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
151 emoji.isExtendedPictographic(next_cp)) 151 emoji.isExtendedPictographic(next_cp))
152 { 152 {
153 try encode_and_append(next_cp, &all_bytes); 153 try encode_and_append(next_cp, &all_bytes);
154 _ = self.advance() catch unreachable; 154 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
155 after_zwj = false; 155 after_zwj = false;
156 } else if (next_cp >= 0x300 and isIgnorable(next_cp)) { 156 } else if (next_cp >= 0x300 and isIgnorable(next_cp)) {
157 try encode_and_append(next_cp, &all_bytes); 157 try encode_and_append(next_cp, &all_bytes);
158 _ = self.advance() catch unreachable; 158 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
159 if (next_cp == '\u{200d}') after_zwj = true; 159 if (next_cp == '\u{200d}') after_zwj = true;
160 } else { 160 } else {
161 break; 161 break;
@@ -176,7 +176,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
176 gbp.isLvt(next_cp))) 176 gbp.isLvt(next_cp)))
177 { 177 {
178 try encode_and_append(next_cp, &all_bytes); 178 try encode_and_append(next_cp, &all_bytes);
179 _ = self.advance() catch unreachable; 179 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
180 } 180 }
181 } else if (gbp.isLv(code) or gbp.isV(code)) { 181 } else if (gbp.isLv(code) or gbp.isV(code)) {
182 if (next_cp >= 0x1100 and 182 if (next_cp >= 0x1100 and
@@ -184,12 +184,12 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
184 gbp.isT(next_cp))) 184 gbp.isT(next_cp)))
185 { 185 {
186 try encode_and_append(next_cp, &all_bytes); 186 try encode_and_append(next_cp, &all_bytes);
187 _ = self.advance() catch unreachable; 187 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
188 } 188 }
189 } else if (gbp.isLvt(code) or gbp.isT(code)) { 189 } else if (gbp.isLvt(code) or gbp.isT(code)) {
190 if (next_cp >= 0x1100 and gbp.isT(next_cp)) { 190 if (next_cp >= 0x1100 and gbp.isT(next_cp)) {
191 try encode_and_append(next_cp, &all_bytes); 191 try encode_and_append(next_cp, &all_bytes);
192 _ = self.advance() catch unreachable; 192 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
193 } 193 }
194 } 194 }
195 } else if (0x600 <= code and code <= 0x11f02) { 195 } else if (0x600 <= code and code <= 0x11f02) {
@@ -200,7 +200,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
200 return try all_bytes.toOwnedSlice(); 200 return try all_bytes.toOwnedSlice();
201 } else { 201 } else {
202 try encode_and_append(next_cp, &all_bytes); 202 try encode_and_append(next_cp, &all_bytes);
203 _ = self.advance() catch unreachable; 203 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
204 } 204 }
205 } 205 }
206 } else if (0x1f1e6 <= code and code <= 0x1f1ff) { 206 } else if (0x1f1e6 <= code and code <= 0x1f1ff) {
@@ -209,7 +209,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
209 209
210 if (next_cp >= 0x1f1e6 and gbp.isRegionalIndicator(next_cp)) { 210 if (next_cp >= 0x1f1e6 and gbp.isRegionalIndicator(next_cp)) {
211 try encode_and_append(next_cp, &all_bytes); 211 try encode_and_append(next_cp, &all_bytes);
212 _ = self.advance() catch unreachable; 212 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
213 } 213 }
214 } 214 }
215 } 215 }
@@ -218,7 +218,7 @@ pub fn StreamingGraphemeIterator(comptime T: type) type {
218 while (self.buf[1]) |next_cp| { 218 while (self.buf[1]) |next_cp| {
219 if (next_cp >= 0x300 and isIgnorable(next_cp)) { 219 if (next_cp >= 0x300 and isIgnorable(next_cp)) {
220 try encode_and_append(next_cp, &all_bytes); 220 try encode_and_append(next_cp, &all_bytes);
221 _ = self.advance() catch unreachable; 221 _ = self.advance() catch @panic("GraphemeIterator.advance failed.");
222 } else { 222 } else {
223 break; 223 break;
224 } 224 }