Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Sven Barth via fpc-pascal
Am 15.10.2019 um 23:46 schrieb Ryan Joseph: On Oct 15, 2019, at 5:26 PM, Benito van der Zander wrote: you could do var it: pointer; obj: TObject absolute it; begin for it in list do begin // continue on like before using “obj” instead of “it" end; That is a

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Ryan Joseph
> On Oct 15, 2019, at 6:13 PM, Michael Van Canneyt > wrote: > > Of course there is: make the list the correct type. No typecasting needed > then. I guess I’ll get used to it but we have lots of code like this (snippet I posted earlier from the parser): Declarations: TFPList; // list of

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Michael Van Canneyt
On Tue, 15 Oct 2019, Ryan Joseph wrote: On Oct 15, 2019, at 5:26 PM, Benito van der Zander wrote: you could do var it: pointer; obj: TObject absolute it; begin for it in list do begin // continue on like before using “obj” instead of “it" end; That is a clever

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Ryan Joseph
> On Oct 15, 2019, at 5:26 PM, Benito van der Zander wrote: > > you could do > > var > it: pointer; > obj: TObject absolute it; > begin > for it in list do > begin > // continue on like before using “obj” instead of “it" > end; > That is a clever solution but it’s

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Michael Van Canneyt
On Tue, 15 Oct 2019, Benito van der Zander wrote: Hi, On 14.10.19 15:44, Ryan Joseph wrote: var it: pointer; obj: TObject; begin for it in list do begin obj := TObject(it); // continue on like before using “obj” instead of “it" end; That’s our realistic

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Benito van der Zander
Hi, On 14.10.19 15:44, Ryan Joseph wrote: var it: pointer; obj: TObject; begin for it in list do begin obj := TObject(it); // continue on like before using “obj” instead of “it" end; That’s our realistic best use case now but it requires 2 extra steps. I hope

Re: [fpc-pascal] fcl-passrc errors

2019-10-14 Thread Ryan Joseph
> On Oct 14, 2019, at 8:02 AM, Sven Barth via fpc-pascal > wrote: > > No. Nothing of that. There is a variable in the for-in-loop and nothing more. > Anything else currently is a bug and *will* break. > I don’t disagree with anything you’re saying but this is going to make for-in loops

Re: [fpc-pascal] fcl-passrc errors

2019-10-14 Thread Mattias Gaertner via fpc-pascal
On Mon, 14 Oct 2019 14:02:44 +0200 Sven Barth via fpc-pascal wrote: > Mattias Gaertner via fpc-pascal > schrieb am Mo., 14. Okt. 2019, 10:39: >[...] > First you agree with me and then you provide in essence the same > examples as Ryan? So what is it now? Ryan gave several examples. I agreed

Re: [fpc-pascal] fcl-passrc errors

2019-10-14 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal schrieb am Mo., 14. Okt. 2019, 10:39: > On Mon, 14 Oct 2019 07:37:38 +0200 > Sven Barth via fpc-pascal wrote: > > >[...] > > Because the iterator returns a Pointer and not whatever you think it > > might return. If you know it's something else, you cast that

Re: [fpc-pascal] fcl-passrc errors

2019-10-14 Thread Michael Van Canneyt
On Mon, 14 Oct 2019, Mattias Gaertner via fpc-pascal wrote: On Mon, 14 Oct 2019 07:37:38 +0200 Sven Barth via fpc-pascal wrote: [...] Because the iterator returns a Pointer and not whatever you think it might return. If you know it's something else, you cast that inside the loop. I

Re: [fpc-pascal] fcl-passrc errors

2019-10-14 Thread Mattias Gaertner via fpc-pascal
On Mon, 14 Oct 2019 07:37:38 +0200 Sven Barth via fpc-pascal wrote: >[...] > Because the iterator returns a Pointer and not whatever you think it > might return. If you know it's something else, you cast that inside > the loop. I agree with Sven. What about the other way round? For example

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Sven Barth via fpc-pascal
Am 13.10.2019 um 23:19 schrieb Ryan Joseph: On Oct 13, 2019, at 11:11 AM, Sven Barth via fpc-pascal wrote: Then specialize the list with the correct type. This issue *will* be fixed and is not up to discussion. Here’s some code from the parser today. TFPList is being used because it’s a

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Ryan Joseph
> On Oct 13, 2019, at 11:11 AM, Sven Barth via fpc-pascal > wrote: > > Then specialize the list with the correct type. > > This issue *will* be fixed and is not up to discussion. > Here’s some code from the parser today. TFPList is being used because it’s a generic storage for various

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sun, 13 Oct 2019, Ryan Joseph wrote: On Oct 13, 2019, at 12:30 PM, Michael Van Canneyt wrote: Ahah... That needs to be tested then. This seems to be a bug. Can you please create a bug with a compilable example ? - Please test the operator because I don’t think the parser

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Ryan Joseph
> On Oct 13, 2019, at 12:30 PM, Michael Van Canneyt > wrote: > > Ahah... > > That needs to be tested then. This seems to be a bug. Can you please create > a bug with a compilable example ? > >> - Please test the operator because I don’t think the parser understands it. > > OK, that's

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sun, 13 Oct 2019, Michael Van Canneyt wrote: - This is a new version from 3 days ago. - The record sections failed because they are inside a function. If I pull the record out of the function they work. Ahah... That needs to be tested then. This seems to be a bug. Can you please

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sun, 13 Oct 2019, Ryan Joseph wrote: To be clear: here I meant that 'currently that will definitely not be done in fcl-passrc.' This is a problem then because I wanted to make a language server for FPC but if the parser doesn’t understand accepted FPC syntax the whole thing falls

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am So., 13. Okt. 2019, 16:22: > > > > On Oct 13, 2019, at 5:58 AM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > >> Delphi does not allow it: > >> > >> [dcc32 Error] Project1.dpr(18): E1019 For loop control variable must be > simple local

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Ryan Joseph
> On Oct 13, 2019, at 5:58 AM, Sven Barth via fpc-pascal > wrote: > >> Delphi does not allow it: >> >> [dcc32 Error] Project1.dpr(18): E1019 For loop control variable must be >> simple local variable >> >> I don't think this should be allowed, either. > > Same. Why not? I just had this

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Ryan Joseph
> On Oct 13, 2019, at 6:18 AM, Michael Van Canneyt > wrote: > >>> Well spotted. I didn't notice that the extension was missing. >>> >>> That will definitely not be done in fcl-passrc. > > To be clear: > > here I meant that 'currently that will definitely not be done in fcl-passrc.' This

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sun, 13 Oct 2019, Sven Barth via fpc-pascal wrote: Could the missing ".inc" be the problem? I have not checked, but it could be that FPC always adds ".inc" if no extension is present. Well spotted. I didn't notice that the extension was missing. That will definitely not be done in

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Sven Barth via fpc-pascal
Am 13.10.2019 um 11:26 schrieb Michael Van Canneyt: On Sun, 13 Oct 2019, Sven Barth via fpc-pascal wrote: Just type casting because the array is an array of pointers. I get these errors otherwise "Incompatible types: got "Pointer" expected “TEntity"”. I could use a proper type in a generic

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sun, 13 Oct 2019, Sven Barth via fpc-pascal wrote: Just type casting because the array is an array of pointers. I get these errors otherwise "Incompatible types: got "Pointer" expected “TEntity"”. I could use a proper type in a generic array but I don’t always do that. I didn't know

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Sven Barth via fpc-pascal
Michael Van Canneyt schrieb am So., 13. Okt. 2019, 08:20: > > 2) For..in loops > > > > EParserError: Expected := or in at token "(" in file > > > > /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Examples/EmptyWindow.pas > at line 138 column > >

Re: [fpc-pascal] fcl-passrc errors

2019-10-13 Thread Michael Van Canneyt
On Sat, 12 Oct 2019, Ryan Joseph wrote: On Oct 12, 2019, at 6:43 PM, Michael Van Canneyt wrote: 1) class operators for records EParserError: Expected "procedure" at token "operator" in file

Re: [fpc-pascal] fcl-passrc errors

2019-10-12 Thread Ryan Joseph
On Oct 12, 2019, at 6:43 PM, Michael Van Canneyt wrote:1) class operators for recordsEParserError: Expected "procedure" at token "operator" in file /Users/ryanjoseph/Developer/Projects/FPC/GLCanvas/GLCanvas.pas at line 115 column 7class operator TVertex3.= (constref a, b: TVertex3):

Re: [fpc-pascal] fcl-passrc errors

2019-10-12 Thread Michael Van Canneyt
On Sat, 12 Oct 2019, Ryan Joseph wrote: More tests with the parser but it seems like it doesn’t know quite a bit of syntax. Are these not implemented yet? 1) class operators for records EParserError: Expected "procedure" at token "operator" in file