phobos/std
Witold Baryluk a8d4b00f98 Fix issue 21926 - Allow leadings zeros in std.conv.octal
First of all, the DDoc currently says that:

"Leading zero is allowed, but not required."

The current implementation doesn't respect that.

D lexer allows leading zero(s) also.

And when considering octal from string, there is no possibility
of confusion, as the comments in the code claim. Disallowing
leading zeros for octal conversion from string, does not help
with anything actually.

So lets allow leading zeros.

Allowing leading zeros, does help when implementing various
APIs (i.e. glibc, Linux kernel), where a lot of octal constant,
are defined with multiple leading zeros, for readability and
alignment, in C headers. Having to manually or automatically
special case these when porting such API definitions, is
counter-productive.

Example from a Linux kernel (`include/uapi/linux/stat.h`):

```c
#define S_IFMT  00170000
#define S_IFSOCK 0140000
#define S_IFLNK	 0120000
#define S_IFREG  0100000
#define S_IFBLK  0060000
#define S_IFDIR  0040000
#define S_IFCHR  0020000
#define S_IFIFO  0010000
#define S_ISUID  0004000
#define S_ISGID  0002000
#define S_ISVTX  0001000
```

With this patch, now it is trivial and easier to convert these to D:

```d
...
enum S_ISVTX = octal!"0001000";
```

while being close to original. That helps with readability,
and long term maintenance.

In fact the run-time version provided by `parse!(int)(string, 8)`
also supports leading zeros already. So this makes `octal`
more consistent `parse`.
2021-05-20 01:48:15 +02:00
..
algorithm Break line to please maximum line length enforced by style checker 2021-05-17 12:04:06 +02:00
container Annotate std/container/dlist.d to please dlang/dmd#12520 2021-05-18 01:58:16 +02:00
datetime Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
digest Fix DIP1000 violation in sdt.digest.hmac 2021-04-13 01:35:41 +02:00
experimental Annotate bitmapped_block.d to please dlang/dmd#12520 2021-05-18 01:13:52 +02:00
format Revert "Fix Issue 9489 - writeln of struct with disabled copy ctor" 2021-05-17 23:03:37 +02:00
internal Merge pull request #8081 from nordlow/fix-pure-scope-bigint 2021-05-18 09:40:09 -07:00
math std.math.algebraic: Convert hypot to a template 2021-05-11 12:22:13 +02:00
net Annotate std/net/isemail.d to please dlang/dmd#12520 2021-05-18 00:29:19 +02:00
range Annotate std/range/package.d to please dlang/dmd#12520 2021-05-18 11:31:41 +02:00
regex Remove duplicate assumePureFunction from std.regex 2021-05-10 13:17:42 +02:00
uni Annotate std/uni/package.d to please dlang/dmd#12520 2021-05-17 18:30:15 +02:00
windows
array.d
ascii.d
base64.d Annotate std/base64.d to please dlang/dmd#12520 #8076 2021-05-18 03:28:07 +02:00
bigint.d bigint.d: add return annotations for opOpAssign() 2021-05-18 09:43:40 -07:00
bitmanip.d Annotate std/bitmanip to please dlang/dmd#12520 2021-05-18 04:48:36 +02:00
compiler.d
complex.d std.complex: Add missing imports in unittests for non-DigitalMars targets 2021-05-11 14:30:35 +02:00
concurrency.d Fix Issue 21512 - RedBlackTree!Tid treats any values as duplicated except for Tid.init 2021-05-03 00:48:43 +02:00
conv.d Fix issue 21926 - Allow leadings zeros in std.conv.octal 2021-05-20 01:48:15 +02:00
csv.d Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
demangle.d
encoding.d Rename the initial value of some enums from init to _init 2021-05-12 10:56:46 +08:00
exception.d Typifiy an always throwing method as noreturn (#7834) 2021-05-05 10:56:48 +08:00
file.d Make rmdir unittest @safe 2021-05-10 16:36:18 +02:00
functional.d
getopt.d Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
json.d Annotate std/json.d to please dlang/dmd#12520 2021-05-18 11:02:18 +02:00
mathspecial.d
meta.d Make staticIsSorted use static foreach instead of recursion 2021-05-10 19:20:37 +02:00
mmfile.d
numeric.d Merge pull request #7975 from ibuclaw/numeric/lcm 2021-04-22 15:36:55 +08:00
outbuffer.d
package.d
parallelism.d Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
path.d Annotate std/path.d to please dlang/dmd#12520, absolutePath excluded 2021-05-19 04:06:24 +02:00
process.d Annotate std/process.d to please dlang/dmd#12520 2021-05-17 19:00:50 +08:00
random.d Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
signals.d
socket.d Annotate std/socket.d to please dlang/dmd#12520 2021-05-17 21:50:31 +02:00
stdint.d
stdio.d fix Issue 21920 - [REG master] Error: auto can only be used as part of auto ref for template function parameters 2021-05-17 23:03:37 +02:00
string.d Annotate std/string.d to please dlang/dmd#12520 2021-05-17 19:37:00 +02:00
sumtype.d Narrow imports of std.math in the rest of phobos. 2021-04-21 03:00:57 +02:00
system.d
traits.d std.traits: Fix unittest for isNumeric 2021-05-18 05:13:18 +02:00
typecons.d Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-04-25 21:19:23 +02:00
typetuple.d
uri.d
utf.d Annotate std/utf.d to please dlang/dmd#12520 2021-05-17 17:15:35 +02:00
uuid.d
variant.d Try to make std.variant.maxSize non-recursive 2021-04-14 14:16:46 +02:00
xml.d Annotate std/xml.d to please dlang/dmd#12520 2021-05-17 14:09:09 +02:00
zip.d
zlib.d