Thread overview
[phobos] std.regex
May 29, 2016
Chris Moller
May 29, 2016
David Nadlinger
May 31, 2016
Chris Moller
May 29, 2016
Starting with the usual turn-off disclaimer, "I'm new to D..." Sorry, but I'm in hair-tearing mode.

I'm trying to compile part of the sample code from dlang.org/phobos/std_regex.html:

import std.regex;
import std.stdio;

void main()
{
   // Print out all possible dd/mm/yy(yy) dates found in user input.
   auto r =
regex(r"\b[0-9][0-9]?/[0-9][0-9]?/[0-9][0-9](?:[0-9][0-9])?\b");
   foreach(line; stdin.byLine)
   {
     // matchAll() returns a range that can be iterated
     // to get all subsequent matches.
     foreach(c; matchAll(line, r))
       writeln(c.hit);
    }
}

What I'm getting is:

[0] (moller@qcore) >ldc2 -c re.d re.d
(13): Error: undefined identifier matchAll

[1] (moller@qcore) >ldc2 --version
LDC - the LLVM D compiler (0.12.0):
   based on DMD v2.063.2 and LLVM 3.3
   Default target: x86_64-redhat-linux-gnu
   Host CPU: core2
   http://dlang.org - http://wiki.dlang.org/LDC
   Registered Targets:
     aarch64 - AArch64
     arm - ARM
     cpp - C++ backend
     nvptx - NVIDIA PTX 32-bit
     nvptx64 - NVIDIA PTX 64-bit
     ppc32 - PowerPC 32
     ppc64 - PowerPC 64
     r600 - AMD GPUs HD2XXX-HD6XXX
     systemz - SystemZ
     thumb - Thumb
     x86 - 32-bit X86: Pentium-Pro and above
     x86-64 - 64-bit X86: EM64T and AMD64

[0] (moller@qcore) >uname -a
Linux qcore.mollernet.net 3.14.4-200.fc20.x86_64 #1 SMP Tue May 13
13:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

 From /etc/dmd.conf:
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
-L-L/usr/lib64 -L--export-dynamic


So, what am I doing wrong?

Thanks,
Chris Moller


May 29, 2016
Hi Chris,

On 29 May 2016, at 18:59, Chris Moller via phobos wrote:
> […]
> LDC - the LLVM D compiler (0.12.0):
>   based on DMD v2.063.2 and LLVM 3.3
> […]
> So, what am I doing wrong?

You are using an ancient LDC version (based on 2.063, which was released three years ago almost to the day) that simply didn't have the API yet.

In general, this list intended to be used for Phobos development discussions. You might find that you get better answers to such questions at dm.D.learn (check out https://forum.dlang.org/ and the mailing list/NNTP interface links).

Best,
David
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos
May 31, 2016
No idea, I just pasted your code in https://dpaste.dzfl.pl/cb18d29d187c and it works fine with dmd and ldc.

A few simple things you could try at this point:

* Search the stdlib source code for matchAll. You should find it.

* Try to qualify the name: std.regex.matchAll.

* Review your command line. It mentions "re.d" twice which is suspicious.


Andrei

On 05/29/2016 01:59 PM, Chris Moller via phobos wrote:
> Starting with the usual turn-off disclaimer, "I'm new to D..." Sorry,
> but I'm in hair-tearing mode.
>
> I'm trying to compile part of the sample code from
> dlang.org/phobos/std_regex.html:
>
> import std.regex;
> import std.stdio;
>
> void main()
> {
>    // Print out all possible dd/mm/yy(yy) dates found in user input.
>    auto r =
> regex(r"\b[0-9][0-9]?/[0-9][0-9]?/[0-9][0-9](?:[0-9][0-9])?\b");
>    foreach(line; stdin.byLine)
>    {
>      // matchAll() returns a range that can be iterated
>      // to get all subsequent matches.
>      foreach(c; matchAll(line, r))
>        writeln(c.hit);
>     }
> }
>
> What I'm getting is:
>
> [0] (moller@qcore) >ldc2 -c re.d re.d
> (13): Error: undefined identifier matchAll
>
> [1] (moller@qcore) >ldc2 --version
> LDC - the LLVM D compiler (0.12.0):
>    based on DMD v2.063.2 and LLVM 3.3
>    Default target: x86_64-redhat-linux-gnu
>    Host CPU: core2
> http://dlang.org - http://wiki.dlang.org/LDC
>    Registered Targets:
>      aarch64 - AArch64
>      arm - ARM
>      cpp - C++ backend
>      nvptx - NVIDIA PTX 32-bit
>      nvptx64 - NVIDIA PTX 64-bit
>      ppc32 - PowerPC 32
>      ppc64 - PowerPC 64
>      r600 - AMD GPUs HD2XXX-HD6XXX
>      systemz - SystemZ
>      thumb - Thumb
>      x86 - 32-bit X86: Pentium-Pro and above
>      x86-64 - 64-bit X86: EM64T and AMD64
>
> [0] (moller@qcore) >uname -a
> Linux qcore.mollernet.net 3.14.4-200.fc20.x86_64 #1 SMP Tue May 13
> 13:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
>  From /etc/dmd.conf:
> DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
> -L-L/usr/lib64 -L--export-dynamic
>
>
> So, what am I doing wrong?
>
> Thanks,
> Chris Moller
>
>
> _______________________________________________
> phobos mailing list
> phobos@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos
May 31, 2016
Thanks for the response.

After I upgraded from dmd 2.063 to 2.071, it worked.  I'm not sure what changed from one version to the next, but that seems to have been the problem.

Thanks,
Chris

On 05/31/16 12:59, Andrei Alexandrescu wrote:
> No idea, I just pasted your code in https://dpaste.dzfl.pl/cb18d29d187c and it works fine with dmd and ldc.
>
> A few simple things you could try at this point:
>
> * Search the stdlib source code for matchAll. You should find it.
>
> * Try to qualify the name: std.regex.matchAll.
>
> * Review your command line. It mentions "re.d" twice which is suspicious.
>
>
> Andrei
>
> On 05/29/2016 01:59 PM, Chris Moller via phobos wrote:
>> Starting with the usual turn-off disclaimer, "I'm new to D..." Sorry, but I'm in hair-tearing mode.
>>
>> I'm trying to compile part of the sample code from dlang.org/phobos/std_regex.html:
>>
>> import std.regex;
>> import std.stdio;
>>
>> void main()
>> {
>>    // Print out all possible dd/mm/yy(yy) dates found in user input.
>>    auto r =
>> regex(r"\b[0-9][0-9]?/[0-9][0-9]?/[0-9][0-9](?:[0-9][0-9])?\b");
>>    foreach(line; stdin.byLine)
>>    {
>>      // matchAll() returns a range that can be iterated
>>      // to get all subsequent matches.
>>      foreach(c; matchAll(line, r))
>>        writeln(c.hit);
>>     }
>> }
>>
>> What I'm getting is:
>>
>> [0] (moller@qcore) >ldc2 -c re.d re.d
>> (13): Error: undefined identifier matchAll
>>
>> [1] (moller@qcore) >ldc2 --version
>> LDC - the LLVM D compiler (0.12.0):
>>    based on DMD v2.063.2 and LLVM 3.3
>>    Default target: x86_64-redhat-linux-gnu
>>    Host CPU: core2
>> http://dlang.org - http://wiki.dlang.org/LDC
>>    Registered Targets:
>>      aarch64 - AArch64
>>      arm - ARM
>>      cpp - C++ backend
>>      nvptx - NVIDIA PTX 32-bit
>>      nvptx64 - NVIDIA PTX 64-bit
>>      ppc32 - PowerPC 32
>>      ppc64 - PowerPC 64
>>      r600 - AMD GPUs HD2XXX-HD6XXX
>>      systemz - SystemZ
>>      thumb - Thumb
>>      x86 - 32-bit X86: Pentium-Pro and above
>>      x86-64 - 64-bit X86: EM64T and AMD64
>>
>> [0] (moller@qcore) >uname -a
>> Linux qcore.mollernet.net 3.14.4-200.fc20.x86_64 #1 SMP Tue May 13
>> 13:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>>
>>  From /etc/dmd.conf:
>> DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
>> -L-L/usr/lib64 -L--export-dynamic
>>
>>
>> So, what am I doing wrong?
>>
>> Thanks,
>> Chris Moller
>>
>>
>> _______________________________________________
>> phobos mailing list
>> phobos@puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>
>