mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
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:
parent
0e1afe82cb
commit
76e1cfd2e9
8 changed files with 21 additions and 20 deletions
|
@ -316,7 +316,7 @@ module std.algorithm;
|
||||||
import std.c.string;
|
import std.c.string;
|
||||||
import std.array, std.container, std.conv, std.ctype, std.exception,
|
import std.array, std.container, std.conv, std.ctype, std.exception,
|
||||||
std.functional, std.math, std.metastrings, std.range, std.string,
|
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)
|
version(unittest)
|
||||||
{
|
{
|
||||||
|
@ -2145,7 +2145,7 @@ unittest
|
||||||
auto splitter(Range)(Range input)
|
auto splitter(Range)(Range input)
|
||||||
if (isSomeString!Range)
|
if (isSomeString!Range)
|
||||||
{
|
{
|
||||||
return splitter!isspace(input);
|
return splitter!(std.uni.isUniWhite)(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
|
|
|
@ -14,7 +14,7 @@ module std.array;
|
||||||
|
|
||||||
import core.memory, core.bitop;
|
import core.memory, core.bitop;
|
||||||
import std.algorithm, std.conv, std.ctype, std.encoding, std.exception,
|
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;
|
import std.c.string : memcpy;
|
||||||
version(unittest) import core.exception, std.stdio, std.typetuple;
|
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)
|
auto splitter(String)(String s) if (isSomeString!String)
|
||||||
{
|
{
|
||||||
return std.algorithm.splitter!isspace(s);
|
return std.algorithm.splitter!(std.uni.isUniWhite)(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
|
|
|
@ -20,7 +20,8 @@ import core.stdc.math : ldexpl;
|
||||||
import core.memory, core.stdc.errno, core.stdc.string,
|
import core.memory, core.stdc.errno, core.stdc.string,
|
||||||
core.stdc.stdlib;
|
core.stdc.stdlib;
|
||||||
import std.algorithm, std.array, std.ctype, std.exception, std.math, std.range,
|
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;
|
import std.metastrings;
|
||||||
|
|
||||||
//debug=conv; // uncomment to turn on debugging printf's
|
//debug=conv; // uncomment to turn on debugging printf's
|
||||||
|
@ -1314,7 +1315,7 @@ if (isInputRange!Source && /*!isSomeString!Source && */isFloatingPoint!Target)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
enforce(!p.empty, bailOut());
|
enforce(!p.empty, bailOut());
|
||||||
if (!isspace(p.front)) break;
|
if (!std.uni.isUniWhite(p.front)) break;
|
||||||
p.popFront();
|
p.popFront();
|
||||||
}
|
}
|
||||||
char sign = 0; /* indicating + */
|
char sign = 0; /* indicating + */
|
||||||
|
|
|
@ -828,8 +828,8 @@ struct FormatSpec(Char)
|
||||||
{
|
{
|
||||||
if (trailing.ptr[0] == ' ')
|
if (trailing.ptr[0] == ' ')
|
||||||
{
|
{
|
||||||
while (!r.empty && isspace(r.front)) r.popFront();
|
while (!r.empty && std.ctype.isWhite(r.front)) r.popFront();
|
||||||
//r = std.algorithm.find!(not!isspace)(r);
|
//r = std.algorithm.find!(not!(std.ctype.isWhite))(r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -280,7 +280,7 @@ Negates predicate $(D pred).
|
||||||
Example:
|
Example:
|
||||||
----
|
----
|
||||||
string a = " Hello, world!";
|
string a = " Hello, world!";
|
||||||
assert(find!(not!isspace)(a) == "Hello, world!");
|
assert(find!(not!isWhite)(a) == "Hello, world!");
|
||||||
----
|
----
|
||||||
*/
|
*/
|
||||||
template not(alias pred)
|
template not(alias pred)
|
||||||
|
|
|
@ -83,7 +83,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void skipWhitespace() {
|
void skipWhitespace() {
|
||||||
while(isspace(peekChar())) next = 0;
|
while(isWhite(peekChar())) next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dchar getChar(bool SkipWhitespace = false)() {
|
dchar getChar(bool SkipWhitespace = false)() {
|
||||||
|
|
|
@ -1034,13 +1034,13 @@ Returns the number of parenthesized captures
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
for (i = 0; i <= cmax; i++)
|
for (i = 0; i <= cmax; i++)
|
||||||
if (isspace(i))
|
if (isWhite(i))
|
||||||
r.bits[i] = 1;
|
r.bits[i] = 1;
|
||||||
goto Lrs;
|
goto Lrs;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
for (i = 1; i <= cmax; i++)
|
for (i = 1; i <= cmax; i++)
|
||||||
if (!isspace(i))
|
if (!isWhite(i))
|
||||||
r.bits[i] = 1;
|
r.bits[i] = 1;
|
||||||
goto Lrs;
|
goto Lrs;
|
||||||
|
|
||||||
|
@ -2504,7 +2504,7 @@ Returns $(D hit) (converted to $(D string) if necessary).
|
||||||
debug(std_regex) writefln("\tREspace");
|
debug(std_regex) writefln("\tREspace");
|
||||||
if (src == input.length)
|
if (src == input.length)
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
if (!isspace(input[src]))
|
if (!isWhite(input[src]))
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
src++;
|
src++;
|
||||||
pc++;
|
pc++;
|
||||||
|
@ -2514,7 +2514,7 @@ Returns $(D hit) (converted to $(D string) if necessary).
|
||||||
debug(std_regex) writefln("\tREnotspace");
|
debug(std_regex) writefln("\tREnotspace");
|
||||||
if (src == input.length)
|
if (src == input.length)
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
if (isspace(input[src]))
|
if (isWhite(input[src]))
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
src++;
|
src++;
|
||||||
pc++;
|
pc++;
|
||||||
|
|
12
std/regexp.d
12
std/regexp.d
|
@ -2062,7 +2062,7 @@ public bool test(string s)
|
||||||
debug(regexp) printf("\tREspace\n");
|
debug(regexp) printf("\tREspace\n");
|
||||||
if (src == input.length)
|
if (src == input.length)
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
if (!isspace(input[src]))
|
if (!isWhite(input[src]))
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
src++;
|
src++;
|
||||||
pc++;
|
pc++;
|
||||||
|
@ -2072,7 +2072,7 @@ public bool test(string s)
|
||||||
debug(regexp) printf("\tREnotspace\n");
|
debug(regexp) printf("\tREnotspace\n");
|
||||||
if (src == input.length)
|
if (src == input.length)
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
if (isspace(input[src]))
|
if (isWhite(input[src]))
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
src++;
|
src++;
|
||||||
pc++;
|
pc++;
|
||||||
|
@ -2614,13 +2614,13 @@ private:
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
for (i = 0; i <= cmax; i++)
|
for (i = 0; i <= cmax; i++)
|
||||||
if (isspace(i))
|
if (isWhite(i))
|
||||||
r.bits[i] = 1;
|
r.bits[i] = 1;
|
||||||
goto Lrs;
|
goto Lrs;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
for (i = 1; i <= cmax; i++)
|
for (i = 1; i <= cmax; i++)
|
||||||
if (!isspace(i))
|
if (!isWhite(i))
|
||||||
r.bits[i] = 1;
|
r.bits[i] = 1;
|
||||||
goto Lrs;
|
goto Lrs;
|
||||||
|
|
||||||
|
@ -3072,14 +3072,14 @@ private:
|
||||||
case REspace:
|
case REspace:
|
||||||
r.setbitmax(0x7F);
|
r.setbitmax(0x7F);
|
||||||
for (c = 0; c <= r.maxc; c++)
|
for (c = 0; c <= r.maxc; c++)
|
||||||
if (isspace(c))
|
if (isWhite(c))
|
||||||
r.bits[c] = 1;
|
r.bits[c] = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case REnotspace:
|
case REnotspace:
|
||||||
r.setbitmax(0x7F);
|
r.setbitmax(0x7F);
|
||||||
for (c = 0; c <= r.maxc; c++)
|
for (c = 0; c <= r.maxc; c++)
|
||||||
if (!isspace(c))
|
if (!isWhite(c))
|
||||||
r.bits[c] = 1;
|
r.bits[c] = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue