[Lazarus] Using FPC parser/tokenizer for code formatting

Adem listmember at letterboxes.org
Mon May 31 14:21:34 CEST 2010


On 2010-05-31 15:00, Mattias Gärtner wrote:
> Zitat von Adem <listmember at letterboxes.org>:
>
>> [...]
>>> The compiler simply discards comments and it has no infrastructure to
>>> link comments in any way to code.
>>>
>> Naturally, comments are no good for the compiler --so, I am assuming 
>> that the current parser does recognise comments but does not add them 
>> to the parse tree; if so, it is fine, all it will have to do is to 
>> add those nodes while the compiler still ignores them. Would that be 
>> too difficult to add?
> I think the biggest problems are the directives. The compiler parser 
> 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?

-- 
Cheers,

Adem





More information about the Lazarus mailing list