ok, here it is:
https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L78
simplified implementation and added missing escape symbols. Any symbol
missing?
I was basing myself based on http://dlang.org/phobos/std_regex.html, table
entry '\c where c is one of', but that was incomplete
On 05/29/2013 09:00 PM, baws wrote:
Erhm, why isnt this compiling guys? all i did was add your
suggestions... :/
Your code compiles here with dmd 2.062 and v2.063-devel-f6d55a9-dirty.
What is the compiler error in your case?
The program has a run time error though: args[1] is an invalid acc
On Thursday, 30 May 2013 at 04:30:11 UTC, Brad Anderson wrote:
[snip]
import std.stdio, std.algorithm, std.array;
void eat(R)(R r) { while(!r.empty) { r.front; r.popFront; } }
void main() {
size_t[dstring] dic;
stdin.byLine
.joiner(" ")
.array
.splitter('
On Thursday, 30 May 2013 at 04:12:56 UTC, Diggory wrote:
On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote:
On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
Is there a simple way to consume a range apart from
std.array.array? I don't need to result of the range stored
On Thursday, 30 May 2013 at 04:00:39 UTC, Jonathan M Davis wrote:
On Thursday, May 30, 2013 05:53:02 Brad Anderson wrote:
On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
> Is there a simple way to consume a range apart from
> std.array.array? I don't need to result of the range s
On Thursday, 30 May 2013 at 04:18:14 UTC, Jonathan M Davis wrote:
On Thursday, May 30, 2013 06:12:51 Diggory wrote:
On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote:
> On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson
> wrote:
>> Is there a simple way to consume a range apar
On Thursday, May 30, 2013 06:12:51 Diggory wrote:
> On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote:
> > On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
> >> Is there a simple way to consume a range apart from
> >> std.array.array? I don't need to result of the range s
On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote:
On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
Is there a simple way to consume a range apart from
std.array.array? I don't need to result of the range stored
in an array, I just need a lazy map to evaluate complete
On Wednesday, 29 May 2013 at 22:03:24 UTC, baws wrote:
Im trying to learn D, lovely language for a C++ lover. I have a
file Im trying to parse, but I need to read the contents as
binary data. I also need help understanding how read() works.
I'd like to read the first four bytes which identify t
On Thursday, May 30, 2013 05:53:02 Brad Anderson wrote:
> On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
> > Is there a simple way to consume a range apart from
> > std.array.array? I don't need to result of the range stored in
> > an array, I just need a lazy map to evaluate compl
Is there a simple way to consume a range apart from
std.array.array? I don't need to result of the range stored in
an array, I just need a lazy map to evaluate completely.
On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote:
Is there a simple way to consume a range apart from
std.array.array? I don't need to result of the range stored in
an array, I just need a lazy map to evaluate completely.
Obviously I could just popFront. To be more clear, I want
On Wednesday, 29 May 2013 at 23:33:30 UTC, timotheecour wrote:
something like this, which we should have in std.regex:
string escapeRegex(string a){
import std.string;
enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+':
`\+`, '?': `\?`, '(': `\(`, ')': `\)`];
return tra
something like this, which we should have in std.regex:
string escapeRegex(string a){
import std.string;
enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+': `\+`,
'?': `\?`, '(': `\(`, ')': `\)`];
return translate(a, transTable);
}
string escapeRegexReplace(string a){
See below:
import std.stdio;
import std.regex;
void main(){
"h(i".replace!(a=>a.hit~a.hit)(regex(`h\(`,"g")).writeln; //this works, but
I need to specify the escape manually
// "h(i".replace!(a=>a.hit~a.hit)(regex(`h(`,"gl")).writeln; //I'd like
this to work with a flag, say 'l' (lowercase L) as
See below:
import std.stdio;
import std.regex;
void main(){
"h(i".replace!(a=>a.hit~a.hit)(regex(`h\(`,"g")).writeln; //this
works, but I need to specify the escape manually
// "h(i".replace!(a=>a.hit~a.hit)(regex(`h(`,"gl")).writeln;
//I'd like this to work with a flag, say 'l' (lowercase L
On 05/29/2013 04:11 PM, bearophile wrote:
> Ali Çehreli:
>
>> writefln("0x%(%x%)", a);
>
> But usually I prefer to show all the zero nibbles:
> writefln("0x%(%02x%)", a); // Output: 0xa10207b
And only then the output would make sense. Thanks. :)
Ali
void main() {
import std.stdio;
ubyte[] a = [10, 16, 32, 123];
writefln("0x%(%02x%)", a); // Output: 0xa10207b
static assert(is(typeof(a[0]) == ubyte), "Only ubyte[]");
writefln("0x%(%x%)", a); // Output: 0x0a10207b
}
I have pasted the outputs inverted, sorry.
Bye,
bearoph
Ali Çehreli:
writefln("0x%(%x%)", a);
But usually I prefer to show all the zero nibbles:
void main() {
import std.stdio;
ubyte[] a = [10, 16, 32, 123];
writefln("0x%(%02x%)", a); // Output: 0xa10207b
static assert(is(typeof(a[0]) == ubyte), "Only ubyte[]");
writefln("0
On 05/29/2013 03:23 PM, Adam D. Ruppe wrote:
byte[] a = [10, 16, 32, 123];
writef("0x");
foreach(b; a)
writef("%x", b);
writef("\n");
There is also the nested array formatting. Pretty cool but dyslecix! :)
writefln("0x%(%x%)", a);
Ali
On Wednesday, 29 May 2013 at 22:03:24 UTC, baws wrote:
With my code, im getting the integer values, If i use
cast(byte[]) on read and writefln("Reading header info: 0x%x",
bytesRead[0]);
You're reading the file correctly, just not printing it all out
in hex.
writefln("Reading header in
On Wednesday, 29 May 2013 at 22:03:24 UTC, baws wrote:
Im trying to learn D, lovely language for a C++ lover. I have a
file Im trying to parse, but I need to read the contents as
binary data. I also need help understanding how read() works.
I'd like to read the first four bytes which identify t
Im trying to learn D, lovely language for a C++ lover. I have a
file Im trying to parse, but I need to read the contents as
binary data. I also need help understanding how read() works. I'd
like to read the first four bytes which identify the file header,
I need it to show as a sequence of byte
On Wednesday, 29 May 2013 at 21:17:29 UTC, Namespace wrote:
Why is the phobos lib automatically detected with dmd 2.062 ,
but not with 2.063?
I dunno, I suspected the sc.ini to be modified in some way, but
surprisingly nothing changed in there. Anyway I just built a
trivial sample program w/o
Why is the phobos lib automatically detected with dmd 2.062 , but
not with 2.063?
On Wednesday, 29 May 2013 at 06:19:33 UTC, Namespace wrote:
Davis (Debug) wird erzeugt
pragma(lib, "D:\\D\\dmd2\\windows\\lib\\phobos.lib");
Might help. Please try to define this somewhere in your code -
specifying the library in the project might also be sufficient.
On Wednesday, 29 May 2013 at 17:57:38 UTC, Namespace wrote:
http://dlang.org/phobos/object.html#.TypeInfo_Class
ah thanks, my eyes seem to skip right over that object link.
On Wednesday, 29 May 2013 at 17:54:12 UTC, Adam D. Ruppe wrote:
I can't find it - everything I know about typeinfo is from
reading druntime's source!
The TypeInfo classes look useful but it is kinda hard to get it
all from just the source.
http://dlang.org/phobos/object.html#.TypeInfo_Class
I can't find it - everything I know about typeinfo is from
reading druntime's source!
The TypeInfo classes look useful but it is kinda hard to get it
all from just the source.
Hello all,
I've been having some trouble trying to work out how to effectively duplicate a
multidimensional array in a way that preserves type qualifiers.
Now, obviously if we have a multidimensional array such as T[][] then calling
.dup will duplicate only the base array; so if we do something l
Solution:
pragma(lib, "D:\\D\\dmd2\\windows\\lib\\phobos.lib");
I have to link the phobos lib by myself. o.O
On 05/29/2013 06:32 AM, Jack Applegame wrote:
> I'm sorry. My english is terrible.
Please don't say that. :) Your English is very nice and I am sure
everybody here appreciates that you write in English.
Ali
Kenji Hara:
Please file it in bugzilla.
Kenji Hara
OK, I'll add it a bit later :-)
Bye,
bearophile
On Wednesday, 29 May 2013 at 14:50:36 UTC, bearophile wrote:
Dicebot:
I think this is a bug.
It will be fixed progressively in the next two or three DMD
versions.
Bye,
bearophile
Please file it in bugzilla.
Kenji Hara
Dicebot:
I think this is a bug.
It will be fixed progressively in the next two or three DMD
versions.
Bye,
bearophile
On Wednesday, 29 May 2013 at 13:30:12 UTC, Jack Applegame wrote:
Which difference between enum and static const with initializer?
enum is pure compile-time entity. It does not take space or have
a location, it is just a named value.
"static const x = 42" is a thread-local variable which is
in
Jack Applegame:
Which difference between enum and static const with initializer?
Currently nearly none. But it will be fixed in two or three DMD
versions, and they will become const and enum.
Bye,
bearophile
I'm sorry. My english is terrible.
Which difference between enum and static const with initializer?
struct A {
@("enum") enum int c1 = 10;
@("const") static const int c2 = 20;
}
static assert(__traits(getAttributes, A.c1)[0] == "enum");
static assert(__traits(getAttributes, A.c2)[0] == "const"); //
error
http://dpaste.
On Tuesday, 28 May 2013 at 21:15:55 UTC, Adam D. Ruppe wrote:
...
Also worth noting that if your distro uses systemd, than core
dumps by default are written to journal and managed via
coredumpctl :
http://www.freedesktop.org/software/systemd/man/systemd-coredumpctl.html
On Tuesday, 28 May 2013 at 21:15:55 UTC, Adam D. Ruppe wrote:
On Tuesday, 28 May 2013 at 21:06:14 UTC, Gary Willoughby wrote:
playing and I got a message of a seg fault and a core dump
written to a log.
like this?
Segmentation fault (core dumped)
That's actually more of a linux thing than a
This is a compiler regression in 2.063 release.
http://d.puremagic.com/issues/show_bug.cgi?id=10197
Kenji Hara
Thanks for looking into it.
Stewart
42 matches
Mail list logo