Understanding the code beautifier tool
This is an introduction to the source code beautifier tool.
The code beautifier tool built in the fglcomp compiler can be used to reformat .4gl source modules and get a readable source code, using consistent indentation and source layout rules across modules.
The code beautifier supports uppercase or lowercase keyword coding conventions. See the --fo-lowercase-keywords
option usage for more details.
Formatting options can be specified on the fglcomp command line, or in a configuration file (it is recommended to use the configuration file instead of commande line options).
- Indents source lines for nested code blocks
- Converts language keywords to uppercase or lowercase
- Adds or removes space characters between tokens
- Breaks long lines
- Can use space or tab as indentiation characters
- Can indent parts of the source file
By default, the new reformatted source code is written to the standard output stream (stdout).
Use the --fo-inplace
option to
replace directly the original source file.
The input source file must compile. Indenting a source file with errors will produce an unpredictable result.
- fglformatdiff can reformat code line changes referenced by a diff command output.
- fglgitformat can reformat code line changes referenced by a GIT commit. Use this tool instead of fglformatdiff, if GIT is your version control system.