Gambas Function sorter
Posted: Wednesday 19th January 2022 3:46am
Darn my code becomes a mess.
So i was working on a function sorter.
I then integrated the code into my gambas
Attached is the test proggy.
How it works...
You load a gambas source code into it and it analyses the text...
Anything in the global space above the functions is considered the Header apart from comments after the last definition.
So any comments/wiki comments between the last global definition and the first function is considered the 1st functions pre-text.
The file is read and the functions are listed, any text between functions is stored as the next functions pre-text.
So the FileMap.class data then consists of the header and the functions along with their pre-text.
This should preserve any comments/wiki text and anything else.
The data can then be sorted using the gambas Sort flags (gb.ascent, gb.IgnoreCase, etc) with FileMap.Sort()
The app enables toggling most of the options the FileMap supports.
Options..
Array Sort options,, toggle gb.IgnoreCase, gb.Natural, gb.Ascent/gb.Descent.
Form_Open() on top, that will place Form_Open() as the first function after any special methods
You can manually move functions around with the up and down buttons and save it as you like.
Set the amount of lines between the Header and the functions.
Set the amount of lines between the functions.
Latest version
So i was working on a function sorter.
I then integrated the code into my gambas
Attached is the test proggy.
How it works...
You load a gambas source code into it and it analyses the text...
Anything in the global space above the functions is considered the Header apart from comments after the last definition.
So any comments/wiki comments between the last global definition and the first function is considered the 1st functions pre-text.
The file is read and the functions are listed, any text between functions is stored as the next functions pre-text.
So the FileMap.class data then consists of the header and the functions along with their pre-text.
This should preserve any comments/wiki text and anything else.
The data can then be sorted using the gambas Sort flags (gb.ascent, gb.IgnoreCase, etc) with FileMap.Sort()
The app enables toggling most of the options the FileMap supports.
Options..
Array Sort options,, toggle gb.IgnoreCase, gb.Natural, gb.Ascent/gb.Descent.
Form_Open() on top, that will place Form_Open() as the first function after any special methods
You can manually move functions around with the up and down buttons and save it as you like.
Set the amount of lines between the Header and the functions.
Set the amount of lines between the functions.
Latest version