authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-06 02:17:10 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-06 02:17:10 -07:00
log564ac7158beaf3c6ace5ff795085d72a533b1915
treec4414dba4d47b0852a1be4d69688afe4dd572864
parente138d32d1a042dff857a6d3a73ec058051b463d5

tokenize- use indexOfScalar instead of indexOf for len 1 search


1 files changed, 4 insertions(+), 4 deletions(-)

src/tokenize.zig+4-4
...@@ -66,11 +66,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {...@@ -66,11 +66,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {
66 shouldFlush = false;66 shouldFlush = false;
67 break :blk;67 break :blk;
68 }68 }
69 if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| {69 if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| {
70 shouldFlush = true;70 shouldFlush = true;
71 break :blk;71 break :blk;
72 }72 }
73 if (std.mem.indexOf(u8, symbols, s)) |_| {73 if (std.mem.indexOfScalar(u8, symbols, c)) |_| {
74 shouldFlush = true;74 shouldFlush = true;
75 break :blk;75 break :blk;
76 }76 }
...@@ -88,11 +88,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {...@@ -88,11 +88,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {
88 start = i;88 start = i;
89 end = i;89 end = i;
90 }90 }
91 if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| {91 if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| {
92 start += 1;92 start += 1;
93 end += 1;93 end += 1;
94 }94 }
95 if (std.mem.indexOf(u8, symbols, s)) |_| {95 if (std.mem.indexOfScalar(u8, symbols, c)) |_| {
96 ret = ret ++ &[_]Token{.{ .symbol = s }};96 ret = ret ++ &[_]Token{.{ .symbol = s }};
97 start += 1;97 start += 1;
98 end += 1;98 end += 1;