[Lazarus] Using FPC parser/tokenizer for code formatting

Adem listmember at letterboxes.org
Mon May 31 15:16:29 CEST 2010


On 2010-05-31 15:48, Aleksa Todorovic wrote:
> On Mon, May 31, 2010 at 14:15, Adem<listmember at letterboxes.org>  wrote:
>    
>> 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 probably won't be possible because (as noted by Mattias) compiler
> doesn't actually parse false-branch of $IFDEFs, and this cut-off is
> done before syntax check during source code preprocessing.
>    
Are we mixing what the compiler does with what the parser does here?

Personally, I am not bothered with what the compiler does internally; as 
long as the parser produces an alternative branch (that the compiler can 
choose to ignore), I am OK with it.

The question is, can the parser be made to do that?
>>> 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.
> Well... "someone with the correct skill" already made suggestion to
> better invest time/energy/money in improving another parser (one from
> fcl, codetools, ...), and leave compiler's one intact. That is the
> best approach, I'd say.
>    
Spending time/energy/money on improving another parser?

Yes, it does sound like a sensible thing --for now.

But, let's project a few years down the line, to a time when this other 
parser has reached a 'perfect' stage.

You'll have competing products one pulling one way, the other pulling 
another. You'll also have two main parties one favoring one over the other.

By then, both of those projects will have gained sufficient inertia to 
make it impossible to alter and/or combine?

It's like "if you don't like the plumbing in this kitchen here, go build 
your own house with a kitchen of your desires"..

Does that always have to be like that?

-- 
Cheers,

Adem





More information about the Lazarus mailing list