[Lazarus] Using FPC parser/tokenizer for code formatting

Florian Klaempfl florian at freepascal.org
Mon May 31 13:36:49 CEST 2010


Adem schrieb:
> On 2010-05-31 05:36, Doug Chamberlin wrote:
> 
> Doug,
> 
>> I have great interest in a parser-based code formatting tool. However,
> I have doubt that using the compiler's parser is the best solution.
> 
> It may not be the best solution basically bexause it was written solely
> for the compiler's needs. IOW, a very customized, special purpose one.
> 
> Yet, as far as parser goes, it is the best solution. Because it is the
> originial source of information. Any new additions as well as
> corrections go in there --

This is not necessarily true. Someone might hack in support for a new
procedure specifier. However, it is not guranteed that this one would be
exposed in any way to an external interface.

> if something then begin
>   something;
> end else begin
>   somethingelse;
> end;
> 
> it can also reorganize some comments in such constructs.

The compiler simply discards comments and it has no infrastructure to
link comments in any way to code.




More information about the Lazarus mailing list