m3format, pretty printing or checking the indentation of Modula-3 units

This program is useful to check if Modula-3 units adhere to the usual programming conventions (indentation, lower/upper case in identifiers), and as an example of an application traversing every type of node contained in the abstract syntax tree.

It accepts the usual m3tk options for specifying the location of units (modules, interfaces, generic modules...) and the name of units to process. Then, options specific to "m3format" specify the mode of operation, check versus pretty print, and the amount of information to print. The options are the following:

-Tfile
Read the unit location map from "file". Typically the location map generated by m3build, .M3IMPTAB, is used.
file1 file2...
Process the units in the named files. By default the abstract syntax tree content is printed after the semantic analysis.
-format .ext
Pretty print the named files and write the output to file1.ext, file2.ext...
-check
Check if the named files follow the programming conventions (default) even if pretty printing is requested with -format.
-verbose
Print the list of units processed.
-underscore
Do not complain about underscore characters being used in identifiers.

Here is a sample usage executed from within the m3format package on a LINUXELF machine.

LINUXELF/m3format -TLINUXELF/.M3IMPTAB -format .new -check src/Main.m3