Re: Looking for a code beautifier for Informix -4gl
Posted in 1996
>
> In article <01bb83f8$e5b086e0$65c0d6cd@websurfer>,
> Ravikumar Thiagarajan <ravit@caribsurf.com> wrote:
> >Is there a good code beautifier available for Informix-4gl
>
> There are a couple in the IIUG software archive, but I think the main
> thing that they do is capitalize keywords. Check:
>
> http://www.iiug.org/software/
> ftp://ftp.iiug.org/pub/informix/pub/
>
> If you find a utility that actually reformats a source file, please let
> me know.
>
> Thanks,
>
> Walt.
Ummm, errr... I happen to be working on one right now. I should be finishing
it up this weekend. I'm done with the grosser layers of the code and
starting to work on the finer elements. I will be needing some beta testers.
Volunteers?
In gross terms:
I'm writing this a) because I want one, b) to improve my 'c', c) because I
have a little free time at the moment. The problem I have seen with my own
previous indenter and other indenters is that the rules are hard coded into
the program. This means that changing the rule for any given indentation
requires changing code.
My latest effort keeps its rules in a keywords file. The program opens the
proper keyword file given the language you are using - so there is no need
to rewrite an indenter for each new language that comes down the pike.
It will upshift, downshift or leave alone keywords.
It will upshift, downshift or leave alone non-keywords.
It ignores anything within a comment block.
Comment strings ('--', '{', '#', '/*') are specified in the rules file.
Indentation styles can be specified for any of the known keywords, or
you can add your own. All capabilities can be turned on or off.
Gross capabilities include:
a) Dual indent for DEFINE blocks and operation blocks:
DEFINE a CHAR(14),
b SMALLINT,
.....
LET a = b
+ c
- d
b) Master Block / Sub Block concepts:
INPUT ....
FROM ......
BEFORE ...
LET .....
AFTER .....
LET ....
END INPUT
c) Sentence Start, keywords can be told to start on a new line:
SELECT * FROM SYSTABLES WHERE TABID = 1
Becomes:
SELECT *
FROM systables
WHERE tabid = 1
d) 'Decimal' indenting. Positioning is based on the right hand side
of the keyword.
SELECT *
FROM systables
WHERE tabid = 1
e) Exception indenting:
WHILE TRUE
.....
.....
LABEL exception:
.....
END WHILE
f) Block In indenting:
IF a=7 THEN
CALL this()
ELSE <--- indented back
CALL that()
END IF
g) Indentation amount is configurable on a gross and fine level:
Indentation=3
WHILE Indentation=6 (for example)
h) Inline comments:
# This is a test of the national emergency broadcast network. This is only a test
Becomes:
# This is a test of the national emergency
# broadcast network. This is only a test
Again it is configurable.
If you have some capability that you think should be added please let me know.
If you would like to volunteer to be a beta tester please let me know.
cheers
j.
_____________________________________________________________________________
Jack Parker - Hewlett Packard, DMD/IS Boise, Idaho, USA
jparker@boi.hp.com Currently on loan to PLD/PE
_____________________________________________________________________________
If anything can go wrong, fix it. To hell with Murphy.
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________