[Gambas-devel] about PrettyPrinter

Benoit Minisini gambas at ...1...
Sun Aug 8 11:49:38 CEST 2004


On Saturday 07 August 2004 22:25, Charlie wrote:
> Salut,
>
> send you the second part.
> Where I try to explain what I need to work with 'eval'
> It's a OOo 2 doc.
>
> Amicalement
> Charlie

I think... I think :-)

Wouldn't it be a better idea to pretty print the code directly with the 
compiler, or to create a pretty-printer program that uses the same sources 
than the compiler ? This need passing many options to the command line, but I 
think syntax analyzing code must be centralized as much as possible.

The need some modifications in the compiler of course, because at the moment, 
the compiler parser removes every useless things at early stage: spaces, 
comments, even some new lines. They should be kept for the pretty printer.

I will made the needed modifications, so that you could simply add a source 
file in the compiler to parse the pattern array generated by the parser. I 
think pretty printing code will be simpler after the job done by the parser.

As for the options you described in your document, it is not very clear.

Why not indenting declarations ?

I think CATCH and FINALLY should be put at the beginning of the line, like 
SUB, PROCEDURE, FUNCTION and END.

You should define how many void lines you want between two SUB/FUNCTION 
declarations.

The option for indenting or not in SELECT CASE / END SELECT is good.

Aligning comments to the next line... What for ?

Useless spaces at line's end should be stripped. This is already done by the 
IDE actually, but if the pretty-printer remove them, I will drop the 
duplicated code.

When we will agree with the options, I will add them to the compiler main 
source file - Or to a new executable, I don't know yet.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list