[Lazarus] Using FPC parser/tokenizer for code formatting

Adem listmember at letterboxes.org
Mon May 31 14:15:56 CEST 2010


On 2010-05-31 14:57, Florian Klaempfl wrote:
>> But, the parser does produce a parse tree, doesn't it.
> FPC doesn't produce a parse tree during compilation. The parser puts
> declarations/definitions immediatly into the symtables, for code an
> intermediate representation is created which is indeed a tree but no
> more a parse tree because statements might already be transformed.
>    
So, if I understand this right, the code is parsed but instead of 
producing a tree, a more directly usable structure is created.

Now, the question is, can it be made to produce (in parallel with what 
it already does) a tree to be used elsewhere?

>>>> 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.
>>>        
>> 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?
>>      
> No idea, at least I expect a lot of pitfalls.
>    
Pitfalls.. definitely --and probably more than what anyone can guess now.

That's why I'd like someone with the correct skill set to handle it.

-- 
Cheers,

Adem





More information about the Lazarus mailing list