[Lazarus] Using FPC parser/tokenizer for code formatting

Mattias Gärtner nc-gaertnma at netcologne.de
Mon May 31 12:07:52 CEST 2010


Zitat von Adem <listmember at letterboxes.org>:

> [...]
> While I do remember talking about 'un-with'ing (or, 'de-with'ing), I  
> am not sure if Anthony did get around implementing it in JCF. This  
> (admittedly an extreme one, one which I haven't even checked to see  
> if it compiles) is the kind of stuff I am talking about:
>
> var
>   Box1: TRect;
>   Box2: TRect;
> begin
>   With Box1, Box2 do begin
>      Left := Left;
>      Top := Top;
>      Right := MyRight;
>      Bottom := Bottom;
>   end;
> end;
>
> I'd like something to take care of this sort of stuff; but I am not  
> sure it has to be the code formatter --a refactoring tool sounds  
> like a better one for the job definition.
>
> If so, it brings us to the 'refactoring tool'; which --unless I am  
> mistaken-- there isn't one for FPC/Lazarus/others. If such a thing  
> doesn't exist, I can only guess it is simply because there isn't the  
> infrastructure suitably ready for it --how many of us would  
> undertake writing a fully-fledged parser engine before writing a  
> refactoring tool (which is hard enough) for non-commercial puposes?  
> Same goes for code analysis tools etc.

The infrastructure exists. I just didn't know that there is demand for this.


> These are the reasons why I am pinning so much hope on modularizing  
> tokenizer/parser/compiler trio. Once that done, someone else  
> (singular or plural) --I am hoping-- will step in to write those  
> tools which in return help developing all sorts of other tools  
> better and faster.


Mattias







More information about the Lazarus mailing list