View mode: basic / threaded / horizontal-split · Log in · Help
June 29, 2012
Re: foreach syntax
> Which is easy.

Even on Windows? :O
June 29, 2012
Re: foreach syntax
On 06/29/2012 06:27 PM, Namespace wrote:
> You mean just change line 3817 to
> if (t->value == TOKcomma || t->value == TOKsemicolon || t->value ==
> TOKin) ?
> But know i have to rebuild dmd (i use windows), and i never did this
> before. :/

You'll also have to change the line that says expect(TOKsemicolon);
June 29, 2012
Re: foreach syntax
On Friday, 29 June 2012 at 17:08:36 UTC, Namespace wrote:
>> Which is easy.
>
> Even on Windows? :O

I tried with win32.mak in src/dmd and i get a dmd.exe. But the 
compiler still says
"found 'in' when expecting ';'!" if i try to write foreach (val 
in vals) {.
Have i edit the wrong line in paste.c or fails my build?
June 29, 2012
Re: foreach syntax
On 06/29/2012 07:47 PM, Namespace wrote:
> On Friday, 29 June 2012 at 17:08:36 UTC, Namespace wrote:
>>> Which is easy.
>>
>> Even on Windows? :O
>
> I tried with win32.mak in src/dmd and i get a dmd.exe. But the compiler
> still says
> "found 'in' when expecting ';'!" if i try to write foreach (val in vals) {.
> Have i edit the wrong line in paste.c or fails my build?

You have to edit both relevant lines.
June 29, 2012
Re: foreach syntax
> You'll also have to change the line that says 
> expect(TOKsemicolon);

In what? comment out?
June 29, 2012
Re: foreach syntax
On 06/29/2012 07:50 PM, Namespace wrote:
>> You'll also have to change the line that says expect(TOKsemicolon);
>
> In what? comment out?

Looking at some other parts of the parse.c source reveals that

if(token.value == TOKin) nextToken(); else expect(TOKsemicolon);

might get you going.
June 29, 2012
Re: foreach syntax
On Friday, 29 June 2012 at 17:55:57 UTC, Timon Gehr wrote:
> On 06/29/2012 07:50 PM, Namespace wrote:
>>> You'll also have to change the line that says 
>>> expect(TOKsemicolon);
>>
>> In what? comment out?
>
> Looking at some other parts of the parse.c source reveals that
>
> if(token.value == TOKin) nextToken(); else expect(TOKsemicolon);
>
> might get you going.

I think i'm to stupid for that, sry. I comment out "check" (just 
for testing) but then i get much more errors if i try to compile 
"foreach (val in vals) {".
June 29, 2012
Re: foreach syntax
On 06/29/2012 08:04 PM, Namespace wrote:
> On Friday, 29 June 2012 at 17:55:57 UTC, Timon Gehr wrote:
>> On 06/29/2012 07:50 PM, Namespace wrote:
>>>> You'll also have to change the line that says expect(TOKsemicolon);
>>>
>>> In what? comment out?
>>
>> Looking at some other parts of the parse.c source reveals that
>>
>> if(token.value == TOKin) nextToken(); else expect(TOKsemicolon);
>>
>> might get you going.
>
> I think i'm to stupid for that, sry.

My bad:

Replacing the line with the following, together with the other change 
you made, works:

if(token.value == TOKin) nextToken(); else check(TOKsemicolon);
June 29, 2012
Re: foreach syntax
> My bad:
>
> Replacing the line with the following, together with the other 
> change you made, works:
>
> if(token.value == TOKin) nextToken(); else check(TOKsemicolon);

Impressive, thanks a lot, sometimes I'm a bit stupid. :)

Last question: It works fine, but i'm getting now "DMD v2.059 
DEBUG" if i compile. Do I need a special flag by recompiling?
June 29, 2012
Re: foreach syntax
On 06/29/2012 08:18 PM, Namespace wrote:
>> My bad:
>>
>> Replacing the line with the following, together with the other change
>> you made, works:
>>
>> if(token.value == TOKin) nextToken(); else check(TOKsemicolon);
>
> Impressive, thanks a lot, sometimes I'm a bit stupid. :)
>
> Last question: It works fine, but i'm getting now "DMD v2.059 DEBUG" if
> i compile. Do I need a special flag by recompiling?

I don't have a windows system handy, but you could try the following:

make -fwin32.mak release
1 2 3 4
Top | Discussion index | About this forum | D home