PDA

View Full Version : Source code formatting



ErosOlmi
23-09-2006, 20:58
Released a new tool able to analize source code and create a formatted copy.
Code will be indented by IF, FOR, WHILE, DO, SELECT levels.

This tool if available in thinAir menu: Tools/Utilities/Format code

At the time this message is posted, this tool is still under development.
For this reason this tool, when executed, will produce a new script file in order not to create any interference with your valuable scripts.
New file will have the same name and path of your original follower by an "_" char.

catventure
23-09-2006, 22:31
Hi Eros,

Thanks very much for new Tool - Format Code in ThinAir.
Very, very useful indeed for spacing out code and making it more readable.

I gave it a spin using TAB Editor sourcefile which is quite a lengthy one.
The resultant code formatted file produced a few errors when I ran it however...

This is what I found to be the cause. The comparison operators ">=" and "<=" are translated into the formatted file as "> =" and "< =" (***Note Spaces***)

The spaces can cause script errors by ThinBasic when the formatted sourcefile is run.
After doing a 'replace all' occurrences within the listing to correct these my program ran OK in ThinBasic.
You may have already fixed this but just letting you know in case you are not already aware of the situation, that is all.
It's a fine addition to ThinAir/ThinBasic.



Cheers,
catventure

ErosOlmi
23-09-2006, 23:52
catventure,

thanks a lot, Roberto will be happy.
No, I didn't fix it because Roberto added it at the very last time.
We will fix in next release. We want also fix some blank lines added here and there and show a window with some options like:

number of spaces to indent
number of lines to add before a function declaration
an option to apply format only to selected text or complete file
others


Ciao
Eros

RobertoBianchi
25-09-2006, 11:55
Hi Catventure,

I fixed the translation of the comparison operators, now they are translated as following:

">=" reformatted to " >= "
"<=" reformatted to " <= "

One space as head and one for tail.

Ciao,
Roberto