From 25b755a843d1f4b7afcf182c61db57d05fae2679 Mon Sep 17 00:00:00 2001 From: jmdavis Date: Wed, 22 Jun 2011 19:20:15 -0700 Subject: [PATCH] Reverted isAsciiWhite to isWhite. --- std/ascii.d | 6 +++--- std/ctype.d | 2 +- std/format.d | 4 ++-- std/functional.d | 2 +- std/json.d | 2 +- std/regex.d | 8 ++++---- std/regexp.d | 12 ++++++------ std/stream.d | 14 +++++++------- std/string.d | 4 ++-- std/uni.d | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/std/ascii.d b/std/ascii.d index 0ef28e27b..136ee86cd 100644 --- a/std/ascii.d +++ b/std/ascii.d @@ -174,7 +174,7 @@ unittest Whether or not $(D c) is a whitespace character. That includes the space, tab, vertical tab, form feed, carriage return, and linefeed characters. +/ -bool isAsciiWhite(dchar c) @safe pure nothrow +bool isWhite(dchar c) @safe pure nothrow { return c <= 0x7F ? cast(bool)(_ctype[c] & _SPC) : false; } @@ -182,10 +182,10 @@ bool isAsciiWhite(dchar c) @safe pure nothrow unittest { foreach(c; whitespace) - assert(isAsciiWhite(c)); + assert(isWhite(c)); foreach(c; chain(digits, letters)) - assert(!isAsciiWhite(c)); + assert(!isWhite(c)); } diff --git a/std/ctype.d b/std/ctype.d index f8e9dea35..4e5f24ed4 100644 --- a/std/ctype.d +++ b/std/ctype.d @@ -76,7 +76,7 @@ pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; } /** * $(RED Scheduled for deprecation in December 2011. Please use - * $(D std.ascii.isAsciiWhite) instead.) + * $(D std.ascii.isWhite) instead.) * * Returns !=0 if c is a space, tab, vertical tab, form feed, * carriage return, or linefeed. diff --git a/std/format.d b/std/format.d index 9759ffb91..aed967fda 100644 --- a/std/format.d +++ b/std/format.d @@ -828,8 +828,8 @@ struct FormatSpec(Char) { if (trailing.ptr[0] == ' ') { - while (!r.empty && std.ascii.isAsciiWhite(r.front)) r.popFront(); - //r = std.algorithm.find!(not!(std.ascii.isAsciiWhite))(r); + while (!r.empty && std.ascii.isWhite(r.front)) r.popFront(); + //r = std.algorithm.find!(not!(std.ascii.isWhite))(r); } else { diff --git a/std/functional.d b/std/functional.d index d08afa920..1879404bb 100644 --- a/std/functional.d +++ b/std/functional.d @@ -280,7 +280,7 @@ Negates predicate $(D pred). Example: ---- string a = " Hello, world!"; -assert(find!(not!isAsciiWhite)(a) == "Hello, world!"); +assert(find!(not!isWhite)(a) == "Hello, world!"); ---- */ template not(alias pred) diff --git a/std/json.d b/std/json.d index 3ba189ad2..8384d755f 100644 --- a/std/json.d +++ b/std/json.d @@ -83,7 +83,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) { } void skipWhitespace() { - while(isAsciiWhite(peekChar())) next = 0; + while(isWhite(peekChar())) next = 0; } dchar getChar(bool SkipWhitespace = false)() { diff --git a/std/regex.d b/std/regex.d index 46833af6d..39ca98e46 100644 --- a/std/regex.d +++ b/std/regex.d @@ -1034,13 +1034,13 @@ Returns the number of parenthesized captures case 's': for (i = 0; i <= cmax; i++) - if (isAsciiWhite(i)) + if (isWhite(i)) r.bits[i] = 1; goto Lrs; case 'S': for (i = 1; i <= cmax; i++) - if (!isAsciiWhite(i)) + if (!isWhite(i)) r.bits[i] = 1; goto Lrs; @@ -2504,7 +2504,7 @@ Returns $(D hit) (converted to $(D string) if necessary). debug(std_regex) writefln("\tREspace"); if (src == input.length) goto Lnomatch; - if (!isAsciiWhite(input[src])) + if (!isWhite(input[src])) goto Lnomatch; src++; pc++; @@ -2514,7 +2514,7 @@ Returns $(D hit) (converted to $(D string) if necessary). debug(std_regex) writefln("\tREnotspace"); if (src == input.length) goto Lnomatch; - if (isAsciiWhite(input[src])) + if (isWhite(input[src])) goto Lnomatch; src++; pc++; diff --git a/std/regexp.d b/std/regexp.d index 814389cee..a5a4e2b90 100644 --- a/std/regexp.d +++ b/std/regexp.d @@ -2062,7 +2062,7 @@ public bool test(string s) debug(regexp) printf("\tREspace\n"); if (src == input.length) goto Lnomatch; - if (!isAsciiWhite(input[src])) + if (!isWhite(input[src])) goto Lnomatch; src++; pc++; @@ -2072,7 +2072,7 @@ public bool test(string s) debug(regexp) printf("\tREnotspace\n"); if (src == input.length) goto Lnomatch; - if (isAsciiWhite(input[src])) + if (isWhite(input[src])) goto Lnomatch; src++; pc++; @@ -2614,13 +2614,13 @@ private: case 's': for (i = 0; i <= cmax; i++) - if (isAsciiWhite(i)) + if (isWhite(i)) r.bits[i] = 1; goto Lrs; case 'S': for (i = 1; i <= cmax; i++) - if (!isAsciiWhite(i)) + if (!isWhite(i)) r.bits[i] = 1; goto Lrs; @@ -3072,14 +3072,14 @@ private: case REspace: r.setbitmax(0x7F); for (c = 0; c <= r.maxc; c++) - if (isAsciiWhite(c)) + if (isWhite(c)) r.bits[c] = 1; return 1; case REnotspace: r.setbitmax(0x7F); for (c = 0; c <= r.maxc; c++) - if (!isAsciiWhite(c)) + if (!isWhite(c)) r.bits[c] = 1; return 1; diff --git a/std/stream.d b/std/stream.d index 6561e9c4c..293d47405 100644 --- a/std/stream.d +++ b/std/stream.d @@ -753,7 +753,7 @@ class Stream : InputStream, OutputStream { case 'i': case 'I': { - while (isAsciiWhite(c)) { + while (isWhite(c)) { c = getc(); count++; } @@ -858,7 +858,7 @@ class Stream : InputStream, OutputStream { case 'g': case 'G': { - while (isAsciiWhite(c)) { + while (isWhite(c)) { c = getc(); count++; } @@ -941,7 +941,7 @@ class Stream : InputStream, OutputStream { } break; case 's': { // string - while (isAsciiWhite(c)) { + while (isWhite(c)) { c = getc(); count++; } @@ -952,7 +952,7 @@ class Stream : InputStream, OutputStream { p = va_arg!(char[]*)(args); s = *p; } - while (!isAsciiWhite(c) && c != char.init) { + while (!isWhite(c) && c != char.init) { if (strlen < s.length) { s[strlen] = c; } else { @@ -985,7 +985,7 @@ class Stream : InputStream, OutputStream { if (width < 0) width = 1; else - while (isAsciiWhite(c)) { + while (isWhite(c)) { c = getc(); count++; } @@ -1008,8 +1008,8 @@ class Stream : InputStream, OutputStream { default: // read character as is goto nws; } - } else if (isAsciiWhite(fmt[i])) { // skip whitespace - while (isAsciiWhite(c)) + } else if (isWhite(fmt[i])) { // skip whitespace + while (isWhite(c)) c = getc(); i++; } else { // read character as is diff --git a/std/string.d b/std/string.d index 86b04b44a..542309297 100644 --- a/std/string.d +++ b/std/string.d @@ -185,7 +185,7 @@ alias std.ascii.newline newline; /********************************** * $(RED Scheduled for deprecation in December 2011. - * Please use $(XREF ascii, isAsciiWhite) or $(XREF uni, isUniWhite) instead.) + * Please use $(XREF ascii, isWhite) or $(XREF uni, isUniWhite) instead.) * * Returns true if c is ASCII whitespace or unicode LS or PS. */ @@ -194,7 +194,7 @@ else bool iswhite(C)(C c) if(is(Unqual!C : dchar)) { pragma(msg, softDeprec!("2.054", "December 2011", "iswhite", - "std.ascii.isAsciiWhite or std.uni.isUniWhite")); + "std.ascii.isWhite or std.uni.isUniWhite")); return c <= 0x7F ? indexOf(whitespace, c) != -1 diff --git a/std/uni.d b/std/uni.d index 5495ce176..f4808a7d3 100644 --- a/std/uni.d +++ b/std/uni.d @@ -29,7 +29,7 @@ enum dchar paraSep = '\u2029'; /// UTF paragraph separator +/ bool isUniWhite(dchar c) @safe pure nothrow { - return std.ascii.isAsciiWhite(c) || + return std.ascii.isWhite(c) || c == lineSep || c == paraSep || c == '\u0085' || c == '\u00A0' || c == '\u1680' || c == '\u180E' || (c >= '\u2000' && c <= '\u200A') ||