Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions etc/c/zlib.d
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ int deflateInit2(z_streamp strm,
this version of the library.

The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
(the size of the history buffer). It should be in the range 8 .. 15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
Expand Down Expand Up @@ -728,7 +728,7 @@ int deflateParams(z_streamp strm, int level, int strategy);
strategy is changed, and if any input has been consumed in a previous
deflate() call, then the input available so far is compressed with the old
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
for the compression levels 0, 1..3, and 4..9 respectively. The new level
for the compression levels 0, 1 .. 3, and 4 .. 9 respectively. The new level
and strategy will take effect at the next call of deflate().

If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
Expand Down Expand Up @@ -842,7 +842,7 @@ int inflateInit2(z_streamp strm, int windowBits)
before by the caller.

The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
size (the size of the history buffer). It should be in the range 8 .. 15 for
this version of the library. The default value is 15 if inflateInit is used
instead. windowBits must be greater than or equal to the windowBits value
provided to deflateInit2() while compressing, or it must be equal to 15 if
Expand Down Expand Up @@ -1073,7 +1073,7 @@ int inflateBackInit(z_stream* strm, int windowBits, ubyte* window)
calls. The fields zalloc, zfree and opaque in strm must be initialized
before the call. If zalloc and zfree are Z_NULL, then the default library-
derived memory allocation routines are used. windowBits is the base two
logarithm of the window size, in the range 8..15. window is a caller
logarithm of the window size, in the range 8 .. 15. window is a caller
supplied buffer of that size. Except for special applications where it is
assured that deflate was used with small window sizes, windowBits must be 15
and a 32K byte window must be supplied to be able to decompress general
Expand Down Expand Up @@ -1127,7 +1127,7 @@ int inflateBack(z_stream* strm,
number of bytes of provided input, and a pointer to that input in buf. If
there is no input available, in() must return zero -- buf is ignored in that
case -- and inflateBack() will return a buffer error. inflateBack() will
call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
call out(out_desc, buf, len) to write the uncompressed data buf[0 .. len-1].
out() should return zero on success, or non-zero on failure. If out()
returns non-zero, inflateBack() will return with an error. Neither in() nor
out() are permitted to change the contents of the window provided to
Expand Down Expand Up @@ -1684,7 +1684,7 @@ void gzclearerr(gzFile file);

uint adler32(uint adler, const(ubyte)* buf, uint len);
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
Update a running Adler-32 checksum with the bytes buf[0 .. len-1] and
return the updated checksum. If buf is Z_NULL, this function returns the
required initial value for the checksum.

Expand Down Expand Up @@ -1718,7 +1718,7 @@ uint adler32_combine(uint adler1, uint adler2, z_off_t len2);

uint crc32(uint crc, const(ubyte)* buf, uint len);
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
Update a running CRC-32 with the bytes buf[0 .. len-1] and return the
updated CRC-32. If buf is Z_NULL, this function returns the required
initial value for the crc. Pre- and post-conditioning (one's complement) is
performed within this function so it shouldn't be done by the application.
Expand Down
3 changes: 3 additions & 0 deletions posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ style: ../dscanner/dsc
@echo "Enforce space after cast(...)"
grep -nrE '[^"]cast\([^)]*?\)[[:alnum:]]' $$(find . -name '*.d') ; test $$? -eq 1

@echo "Enforce space between a .. b"
grep -nrE '[[:alnum:]][.][.][[:alnum:]]|[[:alnum:]] [.][.][[:alnum:]]|[[:alnum:]][.][.] [[:alnum:]]' $$(find . -name '*.d' | grep -vE 'std/string.d|std/uni.d') ; test $$? -eq 1

# at the moment libdparse has problems to parse some modules (->excludes)
@echo "Running DScanner"
../dscanner/dsc --config .dscanner.ini --styleCheck $$(find etc std -type f -name '*.d' | grep -vE 'std/traits.d|std/typecons.d') -I.
Expand Down
4 changes: 2 additions & 2 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ auto castSwitch(choices...)(Object switchObject)

// Check for overshadowing:
immutable indexOfOvershadowingChoice =
indexOfFirstOvershadowingChoiceOnLast!(choices[0..index + 1]);
indexOfFirstOvershadowingChoiceOnLast!(choices[0 .. index + 1]);
static assert(indexOfOvershadowingChoice == index,
"choice number %d(type %s) is overshadowed by choice number %d(type %s)".format(
index + 1, CastClass.stringof, indexOfOvershadowingChoice + 1,
Expand Down Expand Up @@ -335,7 +335,7 @@ auto castSwitch(choices...)(Object switchObject)
static if (Parameters!(choice).length == 0)
{
immutable indexOfOvershadowingChoice =
indexOfFirstOvershadowingChoiceOnLast!(choices[0..index + 1]);
indexOfFirstOvershadowingChoiceOnLast!(choices[0 .. index + 1]);

// Check for overshadowing:
static assert(indexOfOvershadowingChoice == index,
Expand Down
12 changes: 6 additions & 6 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ private struct MapResult(alias fun, Range)
assert(squares[3] == 16);

// Test slicing.
auto squareSlice = squares[1..squares.length - 1];
auto squareSlice = squares[1 .. squares.length - 1];
assert(equal(squareSlice, [4, 9][]));
assert(squareSlice.back == 9);
assert(squareSlice[1] == 9);
Expand Down Expand Up @@ -770,9 +770,9 @@ private struct MapResult(alias fun, Range)
static assert(!is(ms1[0])); //narrow strings can't be indexed
assert(ms2[0] == '日');
assert(ms3[0] == 'H');
static assert(!is(ms1[0..1])); //narrow strings can't be sliced
assert(equal(ms2[0..2], "日本"w));
assert(equal(ms3[0..2], "HE"));
static assert(!is(ms1[0 .. 1])); //narrow strings can't be sliced
assert(equal(ms2[0 .. 2], "日本"w));
assert(equal(ms3[0 .. 2], "HE"));

// Issue 5753
static void voidFun(int) {}
Expand Down Expand Up @@ -2985,7 +2985,7 @@ The number of seeds must be correspondingly increased.
int res;
if (actEmpty) return res;

foreach (i; 0..100)
foreach (i; 0 .. 100)
{
res = dg(i);
if (res) break;
Expand All @@ -3002,7 +3002,7 @@ The number of seeds must be correspondingly increased.
assert(reduce!("a + b", max)(tuple(5, 0), oa) == tuple(hundredSum + 5, 99));

// Test for throwing on empty range plus no seed.
assertThrown(reduce!"a + b"([1, 2][0..0]));
assertThrown(reduce!"a + b"([1, 2][0 .. 0]));

oa.actEmpty = true;
assertThrown(reduce!"a + b"(oa));
Expand Down
16 changes: 8 additions & 8 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ $(HTTP sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):

{
int[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
copy(a[5..10], a[4..9]);
assert(a[4..9] == [6, 7, 8, 9, 10]);
copy(a[5 .. 10], a[4 .. 9]);
assert(a[4 .. 9] == [6, 7, 8, 9, 10]);
}

{ // Test for bug 7898
Expand Down Expand Up @@ -2024,23 +2024,23 @@ if (isBidirectionalRange!Range
import std.typecons : Tuple;
alias S = Tuple!(int[2]);
S[] soffsets;
foreach (start; 0..5)
foreach (start; 0 .. 5)
foreach (end; min(start+1,5) .. 5)
soffsets ~= S([start,end]);
alias D = Tuple!(int[2],int[2]);
D[] doffsets;
foreach (start1; 0..10)
foreach (start1; 0 .. 10)
foreach (end1; min(start1+1,10) .. 10)
foreach (start2; end1 ..10)
foreach (start2; end1 .. 10)
foreach (end2; min(start2+1,10) .. 10)
doffsets ~= D([start1,end1],[start2,end2]);
alias T = Tuple!(int[2],int[2],int[2]);
T[] toffsets;
foreach (start1; 0..15)
foreach (start1; 0 .. 15)
foreach (end1; min(start1+1,15) .. 15)
foreach (start2; end1..15)
foreach (start2; end1 .. 15)
foreach (end2; min(start2+1,15) .. 15)
foreach (start3; end2..15)
foreach (start3; end2 .. 15)
foreach (end3; min(start3+1,15) .. 15)
toffsets ~= T([start1,end1],[start2,end2],[start3,end3]);

Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ unittest
size_t[] arr;
arr.length = 1024;

foreach (k; 0..arr.length) arr[k] = k;
foreach (k; 0 .. arr.length) arr[k] = k;
swapRanges(arr[0..$/2], arr[$/2..$]);

sort!(pred, SwapStrategy.unstable)(arr);
Expand Down
12 changes: 6 additions & 6 deletions std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ if (isNarrowString!String)
int opApply(scope int delegate(ref int) dg)
{
int res;
foreach (i; 0..10)
foreach (i; 0 .. 10)
{
res = dg(i);
if (res) break;
Expand Down Expand Up @@ -862,7 +862,7 @@ if (!isSomeString!(T[])

// Takes arguments array, pos, stuff
// Spread apart array[] at pos by moving elements
(() @trusted { copyBackwards(array[pos..oldLen], array[pos+to_insert..$]); })();
(() @trusted { copyBackwards(array[pos .. oldLen], array[pos+to_insert..$]); })();

// Initialize array[pos .. pos+to_insert] with stuff[]
auto j = 0;
Expand Down Expand Up @@ -977,7 +977,7 @@ if (isSomeString!(T[]) && allSatisfy!(isCharOrStringOrDcharRange, U))
{
// immutable/const, just construct a new array
auto app = appender!(T[])();
app.put(array[0..pos]);
app.put(array[0 .. pos]);
foreach (i, E; U)
app.put(stuff[i]);
app.put(array[pos..$]);
Expand Down Expand Up @@ -1211,7 +1211,7 @@ pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs)
@safe pure nothrow unittest
{
auto a = [1, 2, 3, 4, 5];
auto b = a[0..2];
auto b = a[0 .. 2];

assert(a.sameHead(b));
}
Expand Down Expand Up @@ -1668,7 +1668,7 @@ if (isInputRange!RoR &&
import std.utf : encode;
RetTypeElement[4 / RetTypeElement.sizeof] encodeSpace;
immutable size_t sepArrLength = encode(encodeSpace, sep);
return join(ror, encodeSpace[0..sepArrLength]);
return join(ror, encodeSpace[0 .. sepArrLength]);
}
else
{
Expand Down Expand Up @@ -2631,7 +2631,7 @@ body
@system unittest
{
auto a = [1, 2, 3, 4, 5];
auto b = replaceSlice(a, a[1..4], [0, 0, 0]);
auto b = replaceSlice(a, a[1 .. 4], [0, 0, 0]);

assert(b == [1, 0, 0, 0, 5]);
}
Expand Down
32 changes: 16 additions & 16 deletions std/ascii.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ version (unittest)
}


immutable fullHexDigits = "0123456789ABCDEFabcdef"; /// 0..9A..Fa..f
immutable hexDigits = fullHexDigits[0..16]; /// 0..9A..F
immutable lowerHexDigits = "0123456789abcdef"; /// 0..9a..f
immutable digits = hexDigits[0..10]; /// 0..9
immutable octalDigits = digits[0..8]; /// 0..7
immutable letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /// A..Za..z
immutable uppercase = letters[0..26]; /// A..Z
immutable lowercase = letters[26..52]; /// a..z
immutable fullHexDigits = "0123456789ABCDEFabcdef"; /// 0 .. 9A .. Fa .. f
immutable hexDigits = fullHexDigits[0 .. 16]; /// 0 .. 9A .. F
immutable lowerHexDigits = "0123456789abcdef"; /// 0 .. 9a .. f
immutable digits = hexDigits[0 .. 10]; /// 0 .. 9
immutable octalDigits = digits[0 .. 8]; /// 0 .. 7
immutable letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /// A .. Za .. z
immutable uppercase = letters[0 .. 26]; /// A .. Z
immutable lowercase = letters[26 .. 52]; /// a .. z
immutable whitespace = " \t\v\r\n\f"; /// ASCII _whitespace

/++
Expand All @@ -60,7 +60,7 @@ else

/++
Params: c = The character to test.
Returns: Whether $(D c) is a letter or a number (0..9, a..z, A..Z).
Returns: Whether $(D c) is a letter or a number (0 .. 9, a .. z, A .. Z).
+/
bool isAlphaNum(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -90,7 +90,7 @@ bool isAlphaNum(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is an ASCII letter (A..Z, a..z).
Returns: Whether $(D c) is an ASCII letter (A .. Z, a .. z).
+/
bool isAlpha(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -121,7 +121,7 @@ bool isAlpha(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is a lowercase ASCII letter (a..z).
Returns: Whether $(D c) is a lowercase ASCII letter (a .. z).
+/
bool isLower(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -152,7 +152,7 @@ bool isLower(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is an uppercase ASCII letter (A..Z).
Returns: Whether $(D c) is an uppercase ASCII letter (A .. Z).
+/
bool isUpper(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -183,7 +183,7 @@ bool isUpper(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is a digit (0..9).
Returns: Whether $(D c) is a digit (0 .. 9).
+/
bool isDigit(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -215,7 +215,7 @@ bool isDigit(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is a digit in base 8 (0..7).
Returns: Whether $(D c) is a digit in base 8 (0 .. 7).
+/
bool isOctalDigit(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -244,7 +244,7 @@ bool isOctalDigit(dchar c) @safe pure nothrow @nogc

/++
Params: c = The character to test.
Returns: Whether $(D c) is a digit in base 16 (0..9, A..F, a..f).
Returns: Whether $(D c) is a digit in base 16 (0 .. 9, A .. F, a .. f).
+/
bool isHexDigit(dchar c) @safe pure nothrow @nogc
{
Expand Down Expand Up @@ -465,7 +465,7 @@ bool isPrintable(dchar c) @safe pure nothrow @nogc
/++
Params: c = The character to test.
Returns: Whether or not $(D c) is in the ASCII character set - i.e. in the
range 0..0x7F.
range 0 .. 0x7F.
+/
pragma(inline, true)
bool isASCII(dchar c) @safe pure nothrow @nogc
Expand Down
Loading