summaryrefslogtreecommitdiff
path: root/src/code_point.zig
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-07-08 12:12:20 -0400
committerGravatar Sam Atman2025-07-08 12:12:20 -0400
commite3082e64b3ab8a8aa0777d63be69eb8b6d50a654 (patch)
tree2607c185fd8053b84d60041fadc35c05a0225d34 /src/code_point.zig
parentAdd graphemeAtIndex + iterate before and after (diff)
downloadzg-e3082e64b3ab8a8aa0777d63be69eb8b6d50a654.tar.gz
zg-e3082e64b3ab8a8aa0777d63be69eb8b6d50a654.tar.xz
zg-e3082e64b3ab8a8aa0777d63be69eb8b6d50a654.zip
Add Words.zig example to README
Diffstat (limited to 'src/code_point.zig')
-rw-r--r--src/code_point.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/code_point.zig b/src/code_point.zig
index 16648af..7a638af 100644
--- a/src/code_point.zig
+++ b/src/code_point.zig
@@ -121,6 +121,9 @@ pub fn decodeAtCursor(bytes: []const u8, cursor: *uoffset) ?CodePoint {
121 } 121 }
122 if (st == RUNE_REJECT or cursor.* == bytes.len) { 122 if (st == RUNE_REJECT or cursor.* == bytes.len) {
123 @branchHint(.cold); 123 @branchHint(.cold);
124 // This, and the branch below, detect truncation, the
125 // only invalid state handled differently by the Maximal
126 // Subparts algorithm.
124 if (state_dfa[@intCast(u8dfa[byte])] == RUNE_REJECT) { 127 if (state_dfa[@intCast(u8dfa[byte])] == RUNE_REJECT) {
125 cursor.* -= 2; // +1 128 cursor.* -= 2; // +1
126 return .{ 129 return .{