From 564ac7158beaf3c6ace5ff795085d72a533b1915 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 6 Aug 2021 02:17:10 -0700 Subject: [PATCH] tokenize- use indexOfScalar instead of indexOf for len 1 search --- src/tokenize.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tokenize.zig b/src/tokenize.zig index e01b36ae68dd4bf7f4f689c754d19d70c55ddfaa..401401df19149991c5f5669bdf3200cefd4a7dbc 100644 --- a/src/tokenize.zig +++ b/src/tokenize.zig @@ -66,11 +66,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token { shouldFlush = false; break :blk; } - if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| { + if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| { shouldFlush = true; break :blk; } - if (std.mem.indexOf(u8, symbols, s)) |_| { + if (std.mem.indexOfScalar(u8, symbols, c)) |_| { shouldFlush = true; break :blk; } @@ -88,11 +88,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token { start = i; end = i; } - if (std.mem.indexOf(u8, Token.skippedChars, s)) |_| { + if (std.mem.indexOfScalar(u8, Token.skippedChars, c)) |_| { start += 1; end += 1; } - if (std.mem.indexOf(u8, symbols, s)) |_| { + if (std.mem.indexOfScalar(u8, symbols, c)) |_| { ret = ret ++ &[_]Token{.{ .symbol = s }}; start += 1; end += 1; -- 2.54.0