[Gambas-devel] about PrettyPrinter

Charlie Reinl Karl.Reinl at ...16...
Sun Aug 8 23:45:55 CEST 2004


>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 ?

Oh, yeah if I mention 'eval' in the document, I mean of one of your two 
proposed places, eval or the comp.

>This need passing many options to the command line, but I  
>think syntax analyzing code must be centralized as much as possible.

I think the same for centralizing, for that I'm happy that we work together, 
because in that way ervery new basic command in gambas which is as new  
logical structure will be easier to include to PrettyPrinter.
But, the PrettyPrinter does NOT make syntax analyzing, it makes document 
analyzing.
The only things where it dedects 'mistakes'  in the syntax:
	Are that the END of a Proc will not have its place at the most left position, 
	if one or more logical structures are not closed correctly.

	Or it is at the most left position, but the lines up also, so more  logical
	structures where closed then opened.

For the parameters I don't understand ? Do you mean the PrettyPrinter 
Parameters ?

>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.
I also think so, and like you said centralized.


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

>Why not indenting declarations ?
Declarations outside of Procs are at the most left position.

Inside a Proc, this is one of the parameters (bEveryWithOutDim), if  they are 
indeted or not.

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

So it can be, like I said in the document, I haven't  analysed yet.
If so I need to know, when does this case ends

What I see, 
CATCH  could be followed by an END or by FINALLY , right ?
FINALLY could be only followed by an END

>You should define how many void lines you want between two SUB/FUNCTION 
>declarations.
Techincal not a problem, but I don't understand, for what reason, you made the 
blue line seperator.

>The option for indenting or not in SELECT CASE / END SELECT is good.
Dit you understand well that option :?
Without bWithInCase	:
	SELECT CASE Key
		CASE "H"
		doitWith_H()
		CASE "I"
		doitWith_I()
	END SELECT

With  bWithInCase	:
	SELECT CASE Key
		CASE "H"
			doitWith_H()
		CASE "I"
			doitWith_I()
	END SELECT

>Aligning comments to the next line... What for ?
It's a PrettyPrinter ! But you have an parameter (bAlignComments) to to that 
or not

>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.

And useless spaces at the beginning of the line.

Oh, why will you drop that, PrettyPrinter is an NOT automatique, the user has 
to start it. Useless spaces at line's end should be stripped anyway.

The idea of the PrettyPrinter, is that some people like me, like well arranged 
Text , but not all, but they don't like take care while writing (like me). So 
the PrettyPrinter makes that 'on demande' (push the button)

>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.

If you have questions about my explicatios, let me know .

>Regards,

-- 
>Benoit Minisini
>mailto:gambas at ...1...
Amicalement
Charlie




More information about the Devel mailing list