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 {
6666 shouldFlush = false;
6767 break :blk;
6868 }
69 if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| {
69 if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| {
7070 shouldFlush = true;
7171 break :blk;
7272 }
73 if (std.mem.indexOf(u8, symbols, s)) |_| {
73 if (std.mem.indexOfScalar(u8, symbols, c)) |_| {
7474 shouldFlush = true;
7575 break :blk;
7676 }
......@@ -88,11 +88,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {
8888 start = i;
8989 end = i;
9090 }
91 if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| {
91 if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| {
9292 start += 1;
9393 end += 1;
9494 }
95 if (std.mem.indexOf(u8, symbols, s)) |_| {
95 if (std.mem.indexOfScalar(u8, symbols, c)) |_| {
9696 ret = ret ++ &[_]Token{.{ .symbol = s }};
9797 start += 1;
9898 end += 1;