Difference between revisions of "Pretty"

From Liberty Eiffel Wiki
Jump to navigation Jump to search
(from the old page)
 
m (s/LibertyEiffel/Liberty Eiffel/)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
[[Category:Tool]]
<!-- translation hint: see http://smarteiffel.loria.fr/man/pretty.html -->
 
   
<TT>pretty</TT> is the SmartEiffel pretty-printer (code beautifier) for Eiffel source files. In a normal installation, it is invoked by the command <b><TT>[[se]]&nbsp;pretty</TT></b>.
+
<TT>pretty</TT> is the Liberty Eiffel pretty-printer (code beautifier) for Eiffel source files. In a normal installation, it is invoked by the command <b><TT>[[se]]&nbsp;pretty</TT></b>.
   
 
== Synopsis ==
 
== Synopsis ==
Line 9: Line 9:
 
The <code>source_file</code> argument must be some existing Eiffel source file path as for example <code>"integer.e"</code> or <code>"lib/kernel/integer.e"</code>.
 
The <code>source_file</code> argument must be some existing Eiffel source file path as for example <code>"integer.e"</code> or <code>"lib/kernel/integer.e"</code>.
   
One can specify more than one file name at a time in order to apply the pretty command on all the specified files. All the corresponding files are reprinted in a pretty way.
+
One can specify more than one file name at a time in order to apply the pretty command to all the specified files. All the corresponding files are rewritten in a pretty way.
   
There are four modes of pretty-printing: ''-zen'', ''-default'', ''-end'' and ''-parano'' mode. Only one mode can be selected and the mode ''-default'' is the default mode.
+
There are four modes of pretty reformatting: ''-zen'', ''-default'', ''-end'' and ''-parano'' mode. Only one mode can be selected and ''-default'' is the default mode.
   
=== Options for pretty printing ===
+
=== Options ===
  +
  +
==== Information ====
   
 
{| cellspacing="4" cellpadding="0" width="100%"
 
{| cellspacing="4" cellpadding="0" width="100%"
Line 24: Line 26:
 
|-
 
|-
 
| valign="top" | <code>-version</code>
 
| valign="top" | <code>-version</code>
| Display the SmartEiffel version number.
+
| Display the Liberty Eiffel version number.
  +
|}
  +
  +
==== Warnings ====
  +
  +
{| cellspacing="4" cellpadding="0" width="100%"
 
|-
 
|-
  +
| width="20%" valign="top" | <code>-style_warning</code>
  +
| Display warning messages about non-compliance with Eiffel style rules.
  +
|-
  +
| valign="top" | <code>-no_warning</code>
  +
| Suppress all warning messages.
  +
|}
  +
  +
==== Message Styles ====
  +
  +
{| cellspacing="4" cellpadding="0" width="100%"
  +
|-
  +
| width="20%" valign="top" | <code>-flymake_mode</code>
  +
| Display messages in a compact format suitable for processing by tools such as Emacs' Flymake mode.
  +
|}
  +
  +
==== Style ====
  +
  +
{| cellspacing="4" cellpadding="0" width="100%"
 
| valign="top" | <code>-zen</code>
 
| valign="top" | <code>-zen</code>
| Print as few as possible (i.e. very compact output). No end mark comment for routines, no end comments for statements (if, inspect, debug, ...).
+
| Produce as little as possible (i.e. very compact output). No end mark comment for routines, no end comments for statements (if, inspect, debug, ...).
 
|-
 
|-
 
| valign="top" | <code>-default</code>
 
| valign="top" | <code>-default</code>
Line 33: Line 58:
 
|-
 
|-
 
| valign="top" | <code>-end</code>
 
| valign="top" | <code>-end</code>
| The same printing as <code>-default</code> but also print end mark comments for all routines.
+
| The same format as <code>-default</code> but add end mark comments for all routines.
 
|-
 
|-
 
| valign="top" | <code>-parano</code>
 
| valign="top" | <code>-parano</code>
| Same printing as <code>-end</code> but also print end mark comments for all statements (if, inspect, debug, ...).
+
| Same format as <code>-end</code> but add end mark comments for all statements (if, inspect, debug, ...).
  +
|-
|- valign="top" | <code>-no_warning</code>
 
  +
| valign="top" | <code>-no_warning</code>
 
| Suppress output for all warning messages (error messages are still printed).
 
| Suppress output for all warning messages (error messages are still printed).
 
|}
 
|}

Latest revision as of 03:06, 22 June 2016


pretty is the Liberty Eiffel pretty-printer (code beautifier) for Eiffel source files. In a normal installation, it is invoked by the command se pretty.

Synopsis

  • se pretty [options] <source_file>

The source_file argument must be some existing Eiffel source file path as for example "integer.e" or "lib/kernel/integer.e".

One can specify more than one file name at a time in order to apply the pretty command to all the specified files. All the corresponding files are rewritten in a pretty way.

There are four modes of pretty reformatting: -zen, -default, -end and -parano mode. Only one mode can be selected and -default is the default mode.

Options

Information

-help Display a short summary of the command line syntax, as well as a complete list of pretty's options.
-verbose Display (an enormous amount of) information during the process: a complete list of files loaded, and so on.
-version Display the Liberty Eiffel version number.

Warnings

-style_warning Display warning messages about non-compliance with Eiffel style rules.
-no_warning Suppress all warning messages.

Message Styles

-flymake_mode Display messages in a compact format suitable for processing by tools such as Emacs' Flymake mode.

Style

-zen Produce as little as possible (i.e. very compact output). No end mark comment for routines, no end comments for statements (if, inspect, debug, ...).
-default The default mode. This is close to what we are using for our library.
-end The same format as -default but add end mark comments for all routines.
-parano Same format as -end but add end mark comments for all statements (if, inspect, debug, ...).
-no_warning Suppress output for all warning messages (error messages are still printed).

Security and Backup File

For the security of your sources files, a backup file is created before writing the new file. The backup file name is "foo.bak" when source file name is "foo.e". The backup file is written in the same directory as the source file.

If an old backup file already exists before pretty printing, the pretty command exits with an error message.

To be sure that the pretty-printing is correct, the output file is parsed again. Even if the second parsing gives no errors, backup file is not removed. Thus you can recompile and test your Eiffel program to check that the beautified files did not break anything, before removing the backup files yourself.