[Lazarus] Using FPC parser/tokenizer for code formatting

Sven Barth pascaldragon at googlemail.com
Fri May 28 15:26:30 CEST 2010


Hi!

Am 28.05.2010 14:12, schrieb Adem:
> Given that I have some time to spare now, I would like to tackle using
> FPC's own parser/tokenizer engine for a code formatter.
>
> Trouble is, I am not familiar enough with the internals of FPC source
> tree; meaning I don't even know where to begin looking for the relevant
> files in the FPC tree.
>
> Could someone point me in the right direction please.
>
> I'd also like to hear opinions whether I should spend time on this, or
> even whether it is a good idea to use FPC's parser/tokenizer engine for
> code formatter.
>

I don't think that it would be a wise idea to use the compiler's 
parser/tokenizer for this. It is too much trimed for its main purpose: 
compiling.
But you might try the parser in packages/fcl-passrc which is used inside 
the fpdoc tool. It also has it's own (small) wiki page here: 
http://wiki.freepascal.org/fcl-passrc
As far as I understood it, it was extended to also parse implementation 
sections (for documentation only interface sections are needed). It 
still has some bugs (see BugTracker), but it seems to work rather well.

Regards,
Sven




More information about the Lazarus mailing list