Replaced calls to std.ctype.isspace with std.ctype.isWhite.

In a few places, I replaced it with std.uni.isUniWhite, but for the most
part, I replaced it with std.ctype.isWhite.
This commit is contained in:
jmdavis 2011-06-12 14:34:48 -07:00
parent 0e1afe82cb
commit 76e1cfd2e9
8 changed files with 21 additions and 20 deletions

View file

@ -316,7 +316,7 @@ module std.algorithm;
import std.c.string;
import std.array, std.container, std.conv, std.ctype, std.exception,
std.functional, std.math, std.metastrings, std.range, std.string,
std.traits, std.typecons, std.typetuple, std.stdio;
std.traits, std.typecons, std.typetuple, std.stdio, std.uni;
version(unittest)
{
@ -2145,7 +2145,7 @@ unittest
auto splitter(Range)(Range input)
if (isSomeString!Range)
{
return splitter!isspace(input);
return splitter!(std.uni.isUniWhite)(input);
}
unittest

View file

@ -14,7 +14,7 @@ module std.array;
import core.memory, core.bitop;
import std.algorithm, std.conv, std.ctype, std.encoding, std.exception,
std.range, std.string, std.traits, std.typecons, std.utf;
std.range, std.string, std.traits, std.typecons, std.uni, std.utf;
import std.c.string : memcpy;
version(unittest) import core.exception, std.stdio, std.typetuple;
@ -814,7 +814,7 @@ assert(equal(splitter(a), ["", "a", "bcd", "ef", "gh"][]));
*/
auto splitter(String)(String s) if (isSomeString!String)
{
return std.algorithm.splitter!isspace(s);
return std.algorithm.splitter!(std.uni.isUniWhite)(s);
}
unittest

View file

@ -20,7 +20,8 @@ import core.stdc.math : ldexpl;
import core.memory, core.stdc.errno, core.stdc.string,
core.stdc.stdlib;
import std.algorithm, std.array, std.ctype, std.exception, std.math, std.range,
std.stdio, std.string, std.traits, std.typecons, std.typetuple, std.utf;
std.stdio, std.string, std.traits, std.typecons, std.typetuple, std.uni,
std.utf;
import std.metastrings;
//debug=conv; // uncomment to turn on debugging printf's
@ -1314,7 +1315,7 @@ if (isInputRange!Source && /*!isSomeString!Source && */isFloatingPoint!Target)
for (;;)
{
enforce(!p.empty, bailOut());
if (!isspace(p.front)) break;
if (!std.uni.isUniWhite(p.front)) break;
p.popFront();
}
char sign = 0; /* indicating + */

View file

@ -828,8 +828,8 @@ struct FormatSpec(Char)
{
if (trailing.ptr[0] == ' ')
{
while (!r.empty && isspace(r.front)) r.popFront();
//r = std.algorithm.find!(not!isspace)(r);
while (!r.empty && std.ctype.isWhite(r.front)) r.popFront();
//r = std.algorithm.find!(not!(std.ctype.isWhite))(r);
}
else
{

View file

@ -280,7 +280,7 @@ Negates predicate $(D pred).
Example:
----
string a = " Hello, world!";
assert(find!(not!isspace)(a) == "Hello, world!");
assert(find!(not!isWhite)(a) == "Hello, world!");
----
*/
template not(alias pred)

View file

@ -83,7 +83,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) {
}
void skipWhitespace() {
while(isspace(peekChar())) next = 0;
while(isWhite(peekChar())) next = 0;
}
dchar getChar(bool SkipWhitespace = false)() {

View file

@ -1034,13 +1034,13 @@ Returns the number of parenthesized captures
case 's':
for (i = 0; i <= cmax; i++)
if (isspace(i))
if (isWhite(i))
r.bits[i] = 1;
goto Lrs;
case 'S':
for (i = 1; i <= cmax; i++)
if (!isspace(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 (!isspace(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 (isspace(input[src]))
if (isWhite(input[src]))
goto Lnomatch;
src++;
pc++;

View file

@ -2062,7 +2062,7 @@ public bool test(string s)
debug(regexp) printf("\tREspace\n");
if (src == input.length)
goto Lnomatch;
if (!isspace(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 (isspace(input[src]))
if (isWhite(input[src]))
goto Lnomatch;
src++;
pc++;
@ -2614,13 +2614,13 @@ private:
case 's':
for (i = 0; i <= cmax; i++)
if (isspace(i))
if (isWhite(i))
r.bits[i] = 1;
goto Lrs;
case 'S':
for (i = 1; i <= cmax; i++)
if (!isspace(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 (isspace(c))
if (isWhite(c))
r.bits[c] = 1;
return 1;
case REnotspace:
r.setbitmax(0x7F);
for (c = 0; c <= r.maxc; c++)
if (!isspace(c))
if (!isWhite(c))
r.bits[c] = 1;
return 1;