Eiffel Pretty-Printer PreviousNext

gedoc can be used as an Eiffel pretty-printer. The resulting class texts will be formatted using the same Eiffel guidelines as used throughout the Eiffel code of the Gobo Eiffel Project. The Eiffel pretty-printer will generate valid Eiffel code. It will keep all Eiffel comments, possibly in different locations in the class text to follow the Gobo Eiffel guidelines.

You will notice in the examples below that the command-line option --format is not specified. This is because --format=pretty_print is the default format for gedoc.

Pretty-printing a single class

There are two ways to pretty-print a single class FOO:

	gedoc --force foo.e
	gedoc --force --class=FOO project.ecf
where foo.e is the file containing class FOO, and project.ecf is an ECF file describing an Eiffel project containing class FOO.

The command-line option --force tells gedoc to overwrite the file containing the class being pretty-printed. Without this option, files will not be overwritten and gedoc will emit an error message. Alternatively, the command-line option --interactive can be used. It will ask confirmation to the user before overwriting files. If you want to generate the pretty-printed file in a directory different from the one containing the original class text file, you should use the command-line option --output.

Pretty-printing an Eiffel project

Here is how to pretty-print all Eiffel classes in an Eiffel project:

	gedoc --force project.ecf
where project.ecf is an ECF file describing the Eiffel project. You can also pretty-print a subset of classes in this Eiffel project, using the command-line option --class with wildcards. For example, to pretty-print only the classes of a given Eiffel library whose names start with DS_, just type:
	gedoc --force --class=DS_* project.ecf

As seen in the previous section, the command-line option --output can be used to generate the pretty-printed files in a directory different from the ones contaning the original class text files. The command-line option --library-prefix can also be used to generate the pretty-printed files in a subfolder of this output directory whose name is the name of the Eiffel library containing these Eiffel classes (one subfolder per library).

Copyright 2017-2019, Eric Bezault
Last Updated: 15 March 2019