[Lazarus] Using FPC parser/tokenizer for code formatting
Marco van de Voort
marcov at stack.nl
Mon May 31 14:53:58 CEST 2010
On Mon, May 31, 2010 at 03:21:34PM +0300, Adem wrote:
> > simply skips ELSE code.
> > A code formatter should not ignore that parts.
> > How do you want to format an include file for another target?
> > How to handle macros?
> At this moment, all I can utter will be theoretical stuff. Like,
> producing alternative branches for directives and formatting them. I
> have no idea to offer for macros though.
>
> But, knowing that you have spent far^n more time on those issues than I
> am, I have a feeling (or, hope) you will have much more practicable
> suggestions (than mine) for those sorts of problems.
>
> How would *you* deal with macros?
There are not much options here. It is text substitution based, so if you
want to transform generic _source_ containing macros, you are pretty much
limited to ascii transformations.
However FPC's macro use is extremely low, and usually it is only used to
define a conditional calling convention. If you limit it to that, you only
need a "custom" directive token, and some scanner hackery.
More information about the Lazarus
mailing list