Skip to content

Commit 91c1649

Browse files
committed
Keep the old functions working for now and deprecate them
1 parent 29c223e commit 91c1649

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

lib/std/ascii.zig

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ const std = @import("std");
1212
const mem = std.mem;
1313
const testing = std.testing;
1414

15-
// TODO: remove these after the release of 0.10.0
16-
const isAlNum = @compileError("deprecated: use isAlphanumeric");
17-
const eqlIgnoreCase = @compileError("deprecated: use eqlInsensitive");
18-
const isPrint = @compileError("deprecated: use isPrintable");
19-
const startsWithIgnoreCase = @compileError("deprecated: use startsWithInsensitive");
20-
const lessThanIgnoreCase = @compileError("deprecated: use lessThanInsensitive");
21-
const orderIgnoreCase = @compileError("deprecated: use orderInsensitive");
22-
const indexOfIgnoreCase = @compileError("deprecated: use indexOfInsensitive");
23-
const indexOfIgnoreCasePos = @compileError("deprecated: use indexOfInsensitivePos");
24-
const endsWithIgnoreCase = @compileError("deprecated: use endsWithInsensitive");
25-
const control_code = @compileError("deprecated: use control");
26-
const isBlank = @compileError("deprecated: use `char == ' ' or char == '\t'`");
27-
const isXDigit = @compileError("deprecated: use isHexadecimal");
28-
const isCntrl = @compileError("deprecated: use isControl");
29-
const isAlpha = @compileError("deprecated: use isAlphabetic");
30-
const isSpace = @compileError("deprecated: use isWhitespace");
31-
const spaces = @compileError("deprecated: use whitespace");
32-
const isPunct = @compileError("deprecated: write your own function suited to your particular case");
33-
const isGraph = @compileError("deprecated: use `isPrintable(char) and char != ' '`");
34-
3515
/// Contains constants for the C0 control codes of the ASCII encoding.
3616
///
3717
/// See also: https://en.wikipedia.org/wiki/C0_and_C1_control_codes and `is_control`
@@ -436,3 +416,45 @@ pub fn orderInsensitive(lhs: []const u8, rhs: []const u8) std.math.Order {
436416
pub fn lessThanInsensitive(lhs: []const u8, rhs: []const u8) bool {
437417
return orderInsensitive(lhs, rhs) == .lt;
438418
}
419+
420+
// TODO: remove everything below this line after 0.10.0
421+
422+
/// DEPRECATED: use `isAlphanumeric`
423+
pub const isAlNum = isAlphanumeric;
424+
/// DEPRECATED: use `eqlInsensitive`
425+
pub const eqlIgnoreCase = eqlInsensitive;
426+
/// DEPRECATED: use `isPrintable`
427+
pub const isPrint = isPrintable;
428+
/// DEPRECATED: use `startsWithInsensitive`
429+
pub const startsWithIgnoreCase = startsWithInsensitive;
430+
/// DEPRECATED: use `lessThanInsensitive`
431+
pub const lessThanIgnoreCase = lessThanInsensitive;
432+
/// DEPRECATED: use `orderInsensitive`
433+
pub const orderIgnoreCase = orderInsensitive;
434+
/// DEPRECATED: use `indexOfInsensitive`
435+
pub const indexOfIgnoreCase = indexOfInsensitive;
436+
/// DEPRECATED: use `indexOfInsensitivePos`
437+
pub const indexOfIgnoreCasePos = indexOfInsensitivePos;
438+
/// DEPRECATED: use `endsWithInsensitive`
439+
pub const endsWithIgnoreCase = endsWithInsensitive;
440+
/// DEPRECATED: use `control`
441+
pub const control_code = control;
442+
/// DEPRECATED: use `char == ' ' or char == '\t'`
443+
fn isBlank(char: u8) bool {
444+
return char == ' ' or char == '\t';
445+
}
446+
/// DEPRECATED: use `isHexadecimal`
447+
pub const isXDigit = isHexadecimal;
448+
/// DEPRECATED: use `isControl`
449+
pub const isCntrl = isControl;
450+
/// DEPRECATED: use `isAlphabetic`
451+
pub const isAlpha = isAlphabetic;
452+
/// DEPRECATED: use `isWhitespace`
453+
pub const isSpace = isWhitespace;
454+
/// DEPRECATED: use `whitespace`
455+
pub const spaces = whitespace;
456+
pub const isPunct = @compileError("removed: write your own function suited to your particular case");
457+
/// DEPRECATED: use `isPrintable(char) and char != ' '`
458+
fn isGraph(char: u8) bool {
459+
return isPrintable(char) and char != ' ';
460+
}

0 commit comments

Comments
 (0)