Merge pull request #816 from alexnask/ascii-deprecated-removed

Use new versions of now removed std.ascii declarations
This commit is contained in:
Lee Cannon 2022-12-12 00:18:23 +00:00 committed by GitHub
commit 878464ea72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ const zls_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.build.Builder) !void {
const current_zig = builtin.zig_version; const current_zig = builtin.zig_version;
const min_zig = std.SemanticVersion.parse("0.11.0-dev.399+44ee1c885") catch return; // whereabouts allocgate 2.0 const min_zig = std.SemanticVersion.parse("0.11.0-dev.715+cffbb32d3") catch return; // Deprecated ascii symbols removed
if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig }));
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});

View File

@ -796,7 +796,7 @@ pub fn identifierFromPosition(pos_index: usize, handle: DocumentStore.Handle) []
} }
fn isSymbolChar(char: u8) bool { fn isSymbolChar(char: u8) bool {
return std.ascii.isAlNum(char) or char == '_'; return std.ascii.isAlphanumeric(char) or char == '_';
} }
fn gotoDefinitionSymbol( fn gotoDefinitionSymbol(

View File

@ -77,7 +77,7 @@ pub fn collectDocComments(allocator: std.mem.Allocator, tree: Ast, doc_comments:
while (true) : (curr_line_tok += 1) { while (true) : (curr_line_tok += 1) {
const comm = tokens[curr_line_tok]; const comm = tokens[curr_line_tok];
if ((container_doc and comm == .container_doc_comment) or (!container_doc and comm == .doc_comment)) { if ((container_doc and comm == .container_doc_comment) or (!container_doc and comm == .doc_comment)) {
try lines.append(std.mem.trim(u8, tree.tokenSlice(curr_line_tok)[3..], &std.ascii.spaces)); try lines.append(std.mem.trim(u8, tree.tokenSlice(curr_line_tok)[3..], &std.ascii.whitespace));
} else break; } else break;
} }

View File

@ -299,7 +299,7 @@ fn createDiscardText(builder: *Builder, identifier_name: []const u8, declaration
const indent = find_indent: { const indent = find_indent: {
const line = offsets.lineSliceUntilIndex(builder.handle.text, declaration_start); const line = offsets.lineSliceUntilIndex(builder.handle.text, declaration_start);
for(line) |char, i| { for(line) |char, i| {
if(!std.ascii.isSpace(char)) { if(!std.ascii.isWhitespace(char)) {
break :find_indent line[0..i]; break :find_indent line[0..i];
} }
} }
@ -600,5 +600,5 @@ fn getCaptureLoc(text: []const u8, loc: offsets.Loc, is_index_payload: bool) ?Ca
} }
fn isSymbolChar(char: u8) bool { fn isSymbolChar(char: u8) bool {
return std.ascii.isAlNum(char) or char == '_'; return std.ascii.isAlphanumeric(char) or char == '_';
} }

View File

@ -41,7 +41,7 @@ pub fn fromPath(allocator: std.mem.Allocator, path: []const u8) ![]const u8 {
// On windows, we need to lowercase the drive name. // On windows, we need to lowercase the drive name.
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
if (buf.items.len > prefix.len + 1 and if (buf.items.len > prefix.len + 1 and
std.ascii.isAlpha(buf.items[prefix.len]) and std.ascii.isAlphanumeric(buf.items[prefix.len]) and
std.mem.startsWith(u8, buf.items[prefix.len + 1 ..], "%3A")) std.mem.startsWith(u8, buf.items[prefix.len + 1 ..], "%3A"))
{ {
buf.items[prefix.len] = std.ascii.toLower(buf.items[prefix.len]); buf.items[prefix.len] = std.ascii.toLower(buf.items[prefix.len]);